Project

General

Profile

Actions

User story #20007

closed

We should be able to return an arbitrary report from the technique editor

Added by Félix DALLIDET about 3 years ago. Updated about 3 years ago.

Status:
Released
Priority:
N/A
Category:
Generic methods
Target version:
UX impact:
Suggestion strength:
User visibility:
Effort required:
Name check:
To do
Fix check:
To do
Regression:

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.

But if I want it to also work in audit (since this will only audit if the partition is properly mounted) I currently do not have any good way to set this up.
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.

An idea to solve this issue is to define a 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.

Actions #1

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.

Actions #2

Updated by Benoît PECCATTE about 3 years ago

If i understand correctly the message is the same whatever the status

Actions #3

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 ?)

Actions #4

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

Actions #5

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

Actions #6

Updated by Félix DALLIDET about 3 years ago

  • Status changed from New to In progress
  • Assignee set to Félix DALLIDET
Actions #7

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
Actions #8

Updated by Félix DALLIDET about 3 years ago

  • Status changed from Pending technical review to Pending release

Applied in changeset commit:db430bae5341e9b4b5c46fb3813c34a48c6fc314.

Actions #9

Updated by Benoît PECCATTE about 3 years ago

  • Project changed from 41 to Rudder
  • Category changed from Generic methods to Generic methods
Actions #10

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.

Actions

Also available in: Atom PDF