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 over 2 years ago. Updated over 2 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

Also available in: Atom PDF