Bug #26483
openError when trying to add a node property when “Change audit logs” are mandatory
Description
Rudder 8.2.5
If both “Enable change audit logs” and “Make logs messages mandatory” are checked in Rudder server config, then trying to add a node property in the node's properties page results in error message : « Error when Saving node propertie, details : The server had a problem, try again later »
The webapp log shows :
INFO api-processing.response-error - An error occurred while updating Node 'fc726a00-dfe8-497a-b1c1-8543d3468c94'; cause was: There was an error while extracting reason message; cause was: Inconsistency: Reason field is mandatory and should be at least 5 characters long
Making the audit log messages non mandatory solves this.
Updated by Nicolas CHARLES about 1 month ago
- Related to Bug #10578: Cannot add node property when audit message is mandatory added
Updated by François ARMAND about 1 month ago
We used to have a default message automatically added in that case, see correction in 4.1: https://github.com/Normation/rudder/pull/1627/files
Updated by François ARMAND about 1 month ago
- Assignee set to Clark ANDRIANASOLO
- Priority changed from To review to 1 (highest)
It's P1 because the only workaround is to disable the audit message which is often a mandatory requirement in Big Companies
Updated by Clark ANDRIANASOLO about 1 month ago
- Status changed from New to In progress
Updated by Clark ANDRIANASOLO about 1 month ago
- Status changed from In progress to New
This happens on every attempt to update properties (adding one, removing one, deleting one from the UI, in fact it is the same POST /api/nodes/{node_id}
in the API, which suffers from the same problem).
From the groups page, it works though (and it is also a "group update" in the REST API)
But in the request, there is a reason
field in the API request from both places, so it is likely a problem in the Node API only, which expects a mandatory reason :
>>> curl -X POST -H "X-API-TOKEN: $(cat /var/rudder/run/api-token)" http://localhost:8081/rudder/api/latest/nodes/root -H "Content-Type: application/json" --data '{"properties":[{"name":"audit","value":"testtest"}],"reason":"ras"}' {"action":"updateNode","result":"error","errorDetails":"An error occurred while updating Node 'root'; cause was: There was an error while extracting reason message; cause was: Inconsistency: Reason field is mandatory and should be at least 5 characters long"}
Updated by Clark ANDRIANASOLO about 1 month ago
· Edited
It does not cause an issue in the groups API, nor directives and rules APIs, that seem to ignore the reason
field.
- groups can be created without a reason field (defaults as empty string)
- rules do not validate the reason length (it needs to be at least 5 chars long), but prevents saving by disabling the button if the field is empty (allows it when field is blank, it does not seem to trim whitespaces from the string)
Updated by Clark ANDRIANASOLO about 1 month ago
- Status changed from New to Pending technical review
- Pull Request set to https://github.com/Normation/rudder/pull/6233
Updated by Clark ANDRIANASOLO 26 days ago
- Status changed from Pending technical review to Pending release
Applied in changeset rudder|e708baeccb2f524d4ed7c82a7d54d4a2e9ef73b6.