User story #20007
closedWe should be able to return an arbitrary report from the technique editor
Description
When using Rudder, I often find myself wanting to report an information which is not caused by the direct result of a method.
For instance, if I want to audit that a partition is correctly mounted on my node, I need to use a command execution method.
The only methods which let met use a command execution in audit mode are:
- condition from command
- variable from command
Which always return a compliant report, and define a specific condition based on the error code returned by the command.
The condition is pretty useless to build my compliance.
report_unless
method. This method would do nothing, except reporting in two different manners:
- Default case is reporting under a given status
- Except when a specific condition is defined, then, report under a different report status.
For instance, a previous method defined a my_cmd_audit_{true|false}
condition. I want it to return a success when the my_cmd_audit_true
is defined, and an error otherwise.
I will be able to do so, using:
-report_unless: -report_message: my condition was correct! -default_status: error -unless: my_cmd_audit_true -unless_status: success
It is the same logic than when using a condition in a tehcnique, which will always reports a na report, unless the condition is verified.
Updated by Benoît PECCATTE about 3 years ago
report_message:" my condition was correct!" unless: "my_cmd_audit_true" means report OK if audit is false in plain English. This is self contradictory hence completely confusing.
Updated by Benoît PECCATTE about 3 years ago
If i understand correctly the message is the same whatever the status
Updated by Benoît PECCATTE about 3 years ago
Let's drop de the backward definition with multiple negation.
A suggestion :
report_on(message, condition, status, error_status)
Report the message message on condition condition with the status status.
If the condition is not met, report with the status error_status. (with which message ?)
Updated by Benoît PECCATTE about 3 years ago
But we could instead have a different method :
report_audit(subject, compliant_condition, non_compliant_condition)Report and audit message on the subject subject with a compliant, non compliant or error status based on the conditions.
- true,true -> error
- true,false -> compliant
- false,true -> non compliant
- false,false -> error
We could have a report_enforce on the same model with kept_condition,repaired_condition
Updated by Benoît PECCATTE about 3 years ago
or a report_any which change it mode to audit or enforce based on current mode
Updated by Félix DALLIDET about 3 years ago
- Status changed from New to In progress
- Assignee set to Félix DALLIDET
Updated by Félix DALLIDET about 3 years ago
- Status changed from In progress to Pending technical review
- Assignee changed from Félix DALLIDET to Benoît PECCATTE
- Pull Request set to https://github.com/Normation/ncf/pull/1313
Updated by Félix DALLIDET about 3 years ago
- Status changed from Pending technical review to Pending release
Applied in changeset commit:db430bae5341e9b4b5c46fb3813c34a48c6fc314.
Updated by Benoît PECCATTE about 3 years ago
- Project changed from 41 to Rudder
- Category changed from Generic methods to Generic methods
Updated by Vincent MEMBRÉ about 3 years ago
- Status changed from Pending release to Released
This bug has been fixed in Rudder 7.0.0~beta2 which was released today.