Project

General

Profile

Actions

Architecture #15783

closed

User story #6099: We should be able to call actions as many times as we want

Make class_prefix unique

Added by Félix DALLIDET over 4 years ago. Updated about 2 years ago.

Status:
Resolved
Priority:
N/A
Category:
Generic methods
Target version:
Effort required:
Medium
Name check:
To do
Fix check:
To do
Regression:

Description

With the technique editor, the big idea is to define techniques that can be decline in multiple directives.
One of the problem is: if we have the same call made to a generic method, it will most likely be ignored at execution time by cfengine. Leading to broken reporting and
no easy way to properly what was executed on the system.

Since in Rudder, one directive is ALWAYS bond to only one technique, we could use the directive_id as key differentiator between each policy applied.
Which means that every call to a rudder logger or pure cfengine promise should be followed by a comment based on the directive id.

See:

    commands:
        "${command}" 
          contain => in_shell,
          classes => classes_generic_return_code_list_two("${old_class_prefix}", "${class_prefix}", @{kept_list}, @{repaired_list}),
          comment => "${report_data.directive_id}";

And

usebundle  => _log_v3("Execute the command ${command}", "${command}", "${old_class_prefix}", "${class_prefix}", @{args}),
comment => "${report_data.directive_id}";

This way every directive will be forced to execute its promises and reports on it, even if the exact same one was already evaluated sooner in the process.
But every exact same call will produce classes based on the same element which make reporting undoable. To avoid this we should also base the resulting classes
of each GM on the directive id
.

Where:

        "old_class_prefix"  string => canonify("command_execution_result_${command}");
        "args"               slist => { "${command}", "${kept_codes}", "${repaired_codes}" };
        "report_param"      string => join("_", args);
        "full_class_prefix" string => canonify("command_execution_result_${report_param}");
        "class_prefix"      string => string_head("${full_class_prefix}", "1000");

will become:

        "old_class_prefix"  string => canonify("${report_data.canonified_directive_id}_command_execution_result_${command}");
        "args"               slist => { "${command}", "${kept_codes}", "${repaired_codes}" };
        "report_param"      string => join("_", args);
        "full_class_prefix" string => canonify("${report_data.canonified_directive_id}_command_execution_result_${report_param}");
        "class_prefix"      string => string_head("${full_class_prefix}", "1000");


Subtasks 2 (0 open2 closed)

User story #15784: Base log on the directive id and add a canonified directive id in report_dataReleasedNicolas CHARLESActions
Bug #16078: Applying directives using the exact same GM with same parameters will always result in missing reportsResolvedAlexis MoussetActions
Actions

Also available in: Atom PDF