-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Force option enabled by default when inserting agents #318
Labels
Comments
Fixed Tested insert:
If we use force=1 the insert is forced:
|
Changes required causes that it was possible to add new agents with a name or IP already present: # mocha test/test_agents_2.js
Agents
PUT/agents/:agent_name
✓ Request (345ms)
✓ Errors: Name already present (290ms)
✓ Params: Bad agent name
DELETE/agents/:agent_id
✓ Request (288ms)
✓ Errors: ID is not present (291ms)
✓ Params: Bad agent id
POST/agents
Any
✓ Request (287ms)
✓ Check key (271ms)
✓ Errors: Name already present (256ms)
✓ Filters: Missing field name
✓ Filters: Invalid field
IP Automatic
✓ Request: Automatic IP (497ms)
✓ Errors: Duplicated IP (399ms)
IP
✓ Request (479ms)
✓ Filters: Bad IP
✓ Filters: Bad IP 2
POST/agents/insert
Any
✓ Request (432ms)
1) Errors: Name already present
2) Errors: ID already present
✓ Errors: Invalid key (312ms)
✓ Filters: Missing fields
✓ Filters: Invalid field
IP Automatic
✓ Request: Automatic IP (342ms)
3) Errors: Duplicated IP
IP
✓ Request (283ms)
✓ Filters: Bad IP
✓ Filters: Bad IP 2
24 passing (11s)
3 failing
1) Agents
POST/agents/insert
Any
Errors: Name already present:
Uncaught AssertionError: expected Object {
error: 0,
data: Object {
id: '751',
key: 'NzUxIE5ld0FnZW50UG9zdEluc2VydCBhbnkgMWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXphYmNkZWZnaGk2NA=='
}
} to have property message
at Assertion.fail (node_modules/should/cjs/should.js:258:17)
at Assertion.value [as properties] (node_modules/should/cjs/should.js:335:19)
at Test.<anonymous> (test/test_agents_2.js:484:42)
at Test.assert (node_modules/supertest/lib/test.js:179:6)
at assert (node_modules/supertest/lib/test.js:131:12)
at /shared/wazuh-api/node_modules/supertest/lib/test.js:128:5
at Test.Request.callback (node_modules/superagent/lib/node/index.js:619:12)
at /shared/wazuh-api/node_modules/superagent/lib/node/index.js:795:18
at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/parsers/json.js:16:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
2) Agents
POST/agents/insert
Any
Errors: ID already present:
Uncaught AssertionError: expected Object {
error: 0,
data: Object {
id: '750',
key: 'NzUwIE5ld0FnZW50UG9zdEluc2VydCBhbnkgMWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXphYmNkZWZnaGk2NA=='
}
} to have property message
at Assertion.fail (node_modules/should/cjs/should.js:258:17)
at Assertion.value [as properties] (node_modules/should/cjs/should.js:335:19)
at Test.<anonymous> (test/test_agents_2.js:503:42)
at Test.assert (node_modules/supertest/lib/test.js:179:6)
at assert (node_modules/supertest/lib/test.js:131:12)
at /shared/wazuh-api/node_modules/supertest/lib/test.js:128:5
at Test.Request.callback (node_modules/superagent/lib/node/index.js:619:12)
at /shared/wazuh-api/node_modules/superagent/lib/node/index.js:795:18
at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/parsers/json.js:16:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
3) Agents
POST/agents/insert
IP Automatic
Errors: Duplicated IP:
Uncaught AssertionError: expected Object {
error: 0,
data: Object {
id: '756',
key: 'NzU2IE5ld0FnZW50UG9zdEluc2VydDMgMTI3LjAuMC4xIDFhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5emFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6YWJjZGVmZ2hpNjQ='
}
} to have property message
at Assertion.fail (node_modules/should/cjs/should.js:258:17)
at Assertion.value [as properties] (node_modules/should/cjs/should.js:335:19)
at Test.<anonymous> (test/test_agents_2.js:615:42)
at Test.assert (node_modules/supertest/lib/test.js:179:6)
at assert (node_modules/supertest/lib/test.js:131:12)
at /shared/wazuh-api/node_modules/supertest/lib/test.js:128:5
at Test.Request.callback (node_modules/superagent/lib/node/index.js:619:12)
at /shared/wazuh-api/node_modules/superagent/lib/node/index.js:795:18
at IncomingMessage.<anonymous> (node_modules/superagent/lib/node/parsers/json.js:16:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9) |
Reopen this issue due to collateral effects. Will close again when we reach a good solution. |
This was referenced Jun 11, 2019
This issue will be fixed in wazuh/wazuh#3527. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello team,
The
/agents/insert
API call is not raising an exception when an agent with the same ID is already present:The issue can be fixed setting
force=0
instead offorce=-1
inagent.py
file:Best regards,
Marta
The text was updated successfully, but these errors were encountered: