Skip to content

Commit

Permalink
[Backport 4.5-7.16] Remove ?pretty of request (#5532) (#5540)
Browse files Browse the repository at this point in the history
Remove `?pretty` of request (#5532)

* Remove ?pretty of request

* Add changelog

---------

Co-authored-by: Álex Ruiz <alejandro.ruiz.becerra@wazuh.com>
(cherry picked from commit c39128a)

Co-authored-by: Federico Rodriguez <federico.rodriguez@wazuh.com>
  • Loading branch information
yenienserrano and asteriscos authored Jun 9, 2023
1 parent 723f2a9 commit f1fd018
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 30 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Removed deprecated request and code in agent's view [#5451](https://github.com/wazuh/wazuh-kibana-app/pull/5451)
- Removed unnecessary dashboard queries caused by the deploy agent view. [#5453](https://github.com/wazuh/wazuh-kibana-app/pull/5453)
- Removed repeated and unnecessary requests in security section. [#5500](https://github.com/wazuh/wazuh-kibana-app/pull/5500)
- Removed pretty parameter from cron job requests. [#5532](https://github.com/wazuh/wazuh-kibana-app/pull/5532)
- Removed unnecessary requests in `Management/Status` section. [#5528](https://github.com/wazuh/wazuh-kibana-app/pull/5528)

## Wazuh v4.4.3 - Kibana 7.10.2, 7.16.x, 7.17.x - Revision 01
Expand Down
39 changes: 39 additions & 0 deletions docker/imposter/cluster/cluster-node-info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

var selectedNode = context.request.queryParams.select

switch (selectedNode) {
case 'name':
respond()
.withStatusCode(200)
.withFile('cluster/node/select-name.json');
break;
default:
respond()
.withStatusCode(200)
.withFile('cluster/node/response-with-everything.json');
break;
}

// Commented code is used to test the restart only
//
// var storeWazuh = stores.open('storeWazuh');
// var attemptRestart = storeWazuh.load('attempt');
// var callRestart = storeWazuh.load('callRestart');
// if (callRestart) {
// if (attemptRestart < 10) {
// storeWazuh.save('attempt', attemptRestart + 1);
// respond()
// .withStatusCode(200)
// .withFile('cluster/cluster-node-info-no-restart.json')
// } else {
// storeWazuh.save('attempt', 0);
// storeWazuh.save('callRestart', false);
// respond()
// .withStatusCode(200)
// .withFile('cluster/cluster-node-info.json')
// }
// } else {
// respond()
// .withStatusCode(200)
// .withFile('cluster/cluster-node-info.json')
// }
24 changes: 0 additions & 24 deletions docker/imposter/cluster/cluster_node_info.js

This file was deleted.

50 changes: 50 additions & 0 deletions docker/imposter/cluster/node/select-name.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"data": {
"affected_items": [
{
"name": "master-node"
},
{
"name": "worker1"
},
{
"name": "worker2"
},
{
"name": "worker3"
},
{
"name": "worker4"
},
{
"name": "worker5"
},
{
"name": "worker6"
},
{
"name": "worker7"
},
{
"name": "worker8"
},
{
"name": "worker9"
},
{
"name": "worker10"
},
{
"name": "worker11"
},
{
"name": "worker12"
}
],
"total_affected_items": 3,
"total_failed_items": 0,
"failed_items": []
},
"message": "All selected nodes information was returned",
"error": 0
}
2 changes: 1 addition & 1 deletion docker/imposter/wazuh-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ resources:
path: /cluster/nodes
response:
statusCode: 200
scriptFile: cluster/cluster_node_info.js
scriptFile: cluster/cluster-node-info.js

# Get nodes healthcheck
- method: GET
Expand Down
10 changes: 5 additions & 5 deletions server/start/cron-scheduler/predefined-jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const jobs: {[key:string]: IJob} = {
'manager-stats-remoted': {
status: true,
method: "GET",
request: '/manager/stats/remoted?pretty',
request: '/manager/stats/remoted',
params: {},
interval: '0 */5 * * * *',
index: {
Expand All @@ -36,7 +36,7 @@ export const jobs: {[key:string]: IJob} = {
'manager-stats-analysisd': {
status: true,
method: "GET",
request: '/manager/stats/analysisd?pretty',
request: '/manager/stats/analysisd',
params: {},
interval: '0 */5 * * * *',
index: {
Expand All @@ -49,7 +49,7 @@ export const jobs: {[key:string]: IJob} = {
status: true,
method: "GET",
request: {
request: '/cluster/{nodeName}/stats/remoted?pretty',
request: '/cluster/{nodeName}/stats/remoted',
params: {
nodeName: {
request: '/cluster/nodes?select=name'
Expand All @@ -68,7 +68,7 @@ export const jobs: {[key:string]: IJob} = {
status: true,
method: "GET",
request: {
request: '/cluster/{nodeName}/stats/analysisd?pretty',
request: '/cluster/{nodeName}/stats/analysisd',
params: {
nodeName: {
request: '/cluster/nodes?select=name'
Expand All @@ -83,4 +83,4 @@ export const jobs: {[key:string]: IJob} = {
mapping: '{"analysisd": ${data.affected_items[0]}, "apiName": ${apiName}, "nodeName": ${nodeName}, "cluster": "true"}',
}
},
}
}

0 comments on commit f1fd018

Please sign in to comment.