Bug #23683
Updated by Alexis Mousset about 1 year ago
See the attached technique export. The generated technique looks like this: <pre> 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"; } </pre> 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: <pre> 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"; } </pre> The diff: <pre><code class="diff"> <pre> 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}), </code></pre> </pre>