Actions
Bug #23683
closedWhen a technique scope variable is used in a component key in a method call, logger fails to define the noop conditions in not_applicable cases
Pull Request:
Severity:
Major - prevents use of part of Rudder | no simple workaround
UX impact:
User visibility:
Operational - other Techniques | Rudder settings | Plugins
Effort required:
Small
Priority:
0
Name check:
To do
Fix check:
Error - Fixed
Regression:
No
Description
See the attached technique export.
The generated technique looks like this:
bundle agent testing_bug(bob) { vars: "args" slist => {"${bob}"}; "report_param" string => join("_", args); "full_class_prefix" string => canonify("testing_bug_${report_param}"); "class_prefix" string => string_head("${full_class_prefix}", "1000"); methods: "f9408f65-e172-4f85-9ed8-90d34cb8dc32_${report_data.directive_id}" usebundle => call_f9408f65_e172_4f85_9ed8_90d34cb8dc32("no report", "gdm3", "f9408f65-e172-4f85-9ed8-90d34cb8dc32", @{args}, "${class_prefix}", "gdm3"); "3ede173b-6030-4340-955d-3a11c367e08d_${report_data.directive_id}" usebundle => call_3ede173b_6030_4340_955d_3a11c367e08d("doing stuff", "/bin/true ${bob}", "3ede173b-6030-4340-955d-3a11c367e08d", @{args}, "${class_prefix}", "/bin/true ${bob}", "0"); } bundle agent call_f9408f65_e172_4f85_9ed8_90d34cb8dc32(c_name, c_key, report_id, args, class_prefix, name) { methods: "f9408f65-e172-4f85-9ed8-90d34cb8dc32_${report_data.directive_id}" usebundle => _method_reporting_context_v4("${c_name}", "${c_key}", "${report_id}"); "f9408f65-e172-4f85-9ed8-90d34cb8dc32_${report_data.directive_id}" usebundle => package_check_installed("${name}"); } bundle agent call_3ede173b_6030_4340_955d_3a11c367e08d(c_name, c_key, report_id, args, class_prefix, command, compliant_codes) { methods: "3ede173b-6030-4340-955d-3a11c367e08d_${report_data.directive_id}" usebundle => _method_reporting_context_v4("${c_name}", "${c_key}", "${report_id}"); "3ede173b-6030-4340-955d-3a11c367e08d_${report_data.directive_id}" usebundle => audit_from_command("${command}", "${compliant_codes}"), if => "undefined"; "3ede173b-6030-4340-955d-3a11c367e08d_${report_data.directive_id}" usebundle => _classes_noop(canonify("${class_prefix}_audit_from_command_/bin/true ${bob}")), unless => "undefined"; "3ede173b-6030-4340-955d-3a11c367e08d_${report_data.directive_id}" usebundle => log_rudder("Skipping method 'Audit from command' with key parameter '/bin/true ${bob}' since condition 'undefined' is not reached", "/bin/true ${bob}", canonify("${class_prefix}_audit_from_command_/bin/true ${bob}"), canonify("${class_prefix}_audit_from_command_/bin/true ${bob}"), @{args}), unless => "undefined"; }
Inside the call_3ede173b_6030_4340_955d_3a11c367e08d bundle the ${bob} variable is not defined and so, the _classes_noop fails to define any condition.
The generated technique should look like this instead:
bundle agent testing_bug(bob) { vars: "args" slist => {"${bob}"}; "report_param" string => join("_", args); "full_class_prefix" string => canonify("testing_bug_${report_param}"); "class_prefix" string => string_head("${full_class_prefix}", "1000"); methods: "f9408f65-e172-4f85-9ed8-90d34cb8dc32_${report_data.directive_id}" usebundle => call_f9408f65_e172_4f85_9ed8_90d34cb8dc32("no report", "gdm3", "f9408f65-e172-4f85-9ed8-90d34cb8dc32", @{args}, "${class_prefix}", "gdm3"); "3ede173b-6030-4340-955d-3a11c367e08d_${report_data.directive_id}" usebundle => call_3ede173b_6030_4340_955d_3a11c367e08d("doing stuff", "/bin/true ${bob}", "3ede173b-6030-4340-955d-3a11c367e08d", @{args}, "${class_prefix}", "/bin/true ${bob}", "0"); } bundle agent call_f9408f65_e172_4f85_9ed8_90d34cb8dc32(c_name, c_key, report_id, args, class_prefix, name) { methods: "f9408f65-e172-4f85-9ed8-90d34cb8dc32_${report_data.directive_id}" usebundle => _method_reporting_context_v4("${c_name}", "${c_key}", "${report_id}"); "f9408f65-e172-4f85-9ed8-90d34cb8dc32_${report_data.directive_id}" usebundle => package_check_installed("${name}"); } bundle agent call_3ede173b_6030_4340_955d_3a11c367e08d(c_name, c_key, report_id, args, class_prefix, command, compliant_codes) { methods: "3ede173b-6030-4340-955d-3a11c367e08d_${report_data.directive_id}" usebundle => _method_reporting_context_v4("${c_name}", "${c_key}", "${report_id}"); "3ede173b-6030-4340-955d-3a11c367e08d_${report_data.directive_id}" usebundle => audit_from_command("${command}", "${compliant_codes}"), if => "undefined"; "3ede173b-6030-4340-955d-3a11c367e08d_${report_data.directive_id}" usebundle => _classes_noop(canonify("${class_prefix}_audit_from_command_${c_key}")), unless => "undefined"; "3ede173b-6030-4340-955d-3a11c367e08d_${report_data.directive_id}" usebundle => log_rudder("Skipping method 'Audit from command' with key parameter '/bin/true ${bob}' since condition 'undefined' is not reached", "/bin/true ${bob}", canonify("${class_prefix}_audit_from_command_${c_key}"), canonify("${class_prefix}_audit_from_command_${c_key}"), @{args}), unless => "undefined"; }
The diff:
28c28
< "3ede173b-6030-4340-955d-3a11c367e08d_${report_data.directive_id}" usebundle => _classes_noop(canonify("${class_prefix}_audit_from_command_/bin/true ${bob}")),
---
> "3ede173b-6030-4340-955d-3a11c367e08d_${report_data.directive_id}" usebundle => _classes_noop(canonify("${class_prefix}_audit_from_command_${c_key}")),
30c30
< "3ede173b-6030-4340-955d-3a11c367e08d_${report_data.directive_id}" usebundle => log_rudder("Skipping method 'Audit from command' with key parameter '/bin/true ${bob}' since condition 'undefined' is not reached", "/bin/true ${bob}", canonify("${class_prefix}_audit_from_command_/bin/true ${bob}"), canonify("${class_prefix}_audit_from_command_/bin/true ${bob}"), @{args}),
---
> "3ede173b-6030-4340-955d-3a11c367e08d_${report_data.directive_id}" usebundle => log_rudder("Skipping method 'Audit from command' with key parameter '/bin/true ${bob}' since condition 'undefined' is not reached", "/bin/true ${bob}", canonify("${class_prefix}_audit_from_command_${c_key}"), canonify("${class_prefix}_audit_from_command_${c_key}"), @{args}),
Updated by Alexis Mousset about 1 year ago
- Status changed from New to In progress
Updated by Alexis Mousset about 1 year ago
- Status changed from In progress to Pending technical review
- Assignee changed from Alexis Mousset to Félix DALLIDET
- Pull Request set to https://github.com/Normation/rudder/pull/5147
Updated by Alexis Mousset about 1 year ago
- Status changed from Pending technical review to Pending release
Applied in changeset rudder|f7a80d18c979031177a1d67072e6d7902e5d6f62.
Updated by Clark ANDRIANASOLO about 1 year ago
- Fix check changed from To do to Error - Fixed
Updated by Vincent MEMBRÉ 9 months ago
- Status changed from Pending release to Released
Actions