diff --git a/tests/acceptance/default_ncf.cf.sub b/tests/acceptance/default_ncf.cf.sub index f2699c74..5517758d 100644 --- a/tests/acceptance/default_ncf.cf.sub +++ b/tests/acceptance/default_ncf.cf.sub @@ -242,7 +242,7 @@ bundle agent apply_gm_v4(name, args, status, result_class, mode) pass2:: "expected_classes" usebundle => define_expected_classes("${class_prefix}", "${status}", "class_prefix_${result_class}"), comment => "${c_uuid}"; - "expected_classes" usebundle => define_expected_classes("${c_uuid}_${d_uuid}", "${status}", "method_id_${result_class}"), + "expected_classes" usebundle => define_expected_classes("${c_uuid}_0", "${status}", "method_id_${result_class}"), comment => "${c_uuid}"; diff --git a/tree/10_ncf_internals/initialization.cf b/tree/10_ncf_internals/initialization.cf index a537f04c..fa02feaa 100644 --- a/tree/10_ncf_internals/initialization.cf +++ b/tree/10_ncf_internals/initialization.cf @@ -25,6 +25,8 @@ bundle agent initialization vars: # Reporting context for Rudder "report_data.should_report" string => "true"; + # Global counter + "report_data.index" int => "0"; files: "${sys.workdir}/modules" diff --git a/tree/20_cfe_basics/log_rudder.cf b/tree/20_cfe_basics/log_rudder.cf index eb880540..08549450 100644 --- a/tree/20_cfe_basics/log_rudder.cf +++ b/tree/20_cfe_basics/log_rudder.cf @@ -140,7 +140,7 @@ bundle agent log_rudder(message, class_parameter, old_class_prefix, class_prefix bundle agent log_rudder_v4(parameter_value, message, details) { vars: - "component_key" string => "${report_data.component_key}"; + "component_key" string => "${report_data.component_key}"; rudder_report_force_component_none:: "component_key" string => "None"; @@ -149,7 +149,9 @@ bundle agent log_rudder_v4(parameter_value, message, details) "component_key" string => "${parameter_value}", if_match_regex => ""; methods: - "${report_data.method_id}_${component_key}" usebundle => _rudder_common_reports_generic("${report_data.technique_name}", "${report_data.report_id}", "${report_data.identifier}", "${report_data.component_name}", "${component_key}", "${message} ${details}"); + "${report_data.method_id}" usebundle => _classes_copy("${report_data.method_id}", "${report_data.report_id}"), + if => "${report_data.should_report}"; + "${report_data.method_id}" usebundle => _rudder_common_reports_generic("${report_data.technique_name}", "${report_data.method_id}", "${report_data.identifier}", "${report_data.component_name}", "${component_key}", "${message} ${details}"); } # @name Log for Non Applicable call to generic method @@ -518,8 +520,8 @@ bundle agent _method_reporting_context_v4(c_name, c_key, report_id) "report_data.report_id_r" string => "${report_id}"; # Canonified version, to be used in policies (as class prefix) # it needs the directive_id to enforce unicity - "report_data.report_id" string => canonify("${report_id}_${report_data.directive_id}"); - "report_data.method_id" string => canonify("${report_id}_${report_data.directive_id}"); + "report_data.report_id" string => canonify("${report_id}"); + "report_data.method_id" string => canonify("${report_id}_${report_data.index}"); "report_data.identifier" string => "${report_data.rule_id}@@${report_data.directive_id}@@${report_data.report_id_r}"; methods: @@ -552,7 +554,7 @@ bundle agent rudder_reporting_context_v4(d_id, r_id, t_name, c_name, c_key, repo "report_data.report_id_r" string => "${report_id}"; # Canonified version, to be used in policies (as class prefix) "report_data.report_id" string => canonify("${report_id}"); - "report_data.method_id" string => canonify("${report_id}"); + "report_data.method_id" string => canonify("${report_id}_${report_data.index}"); "report_data.identifier" string => "${report_data.rule_id}@@${report_data.directive_id}@@${report_data.report_id_r}"; methods: @@ -581,6 +583,7 @@ bundle agent dump_reporting_context report_id_r = ${report_data.report_id_r} report_id = ${report_data.report_id} method_id = ${report_data.method_id} + index = ${report_data.index} }"; } @@ -597,6 +600,7 @@ bundle agent clean_reporting_context "report_data.report_id_r" string => ""; "report_data.report_id" string => ""; "report_data.method_id" string => ""; + # We MUST NOT reset the index } bundle agent disable_reporting