Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #23652: iteration in technique editor with package method don't report correctly #1413

Draft
wants to merge 2 commits into
base: branches/rudder/7.3
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/acceptance/default_ncf.cf.sub
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ bundle agent apply_gm_v4(name, args, status, result_class, mode)
"d_uuid" string => canonify("d_${uuid}");
"r_uuid" string => canonify("r_${uuid}");

"c_arg0" string => canonify("${arg0}");
classes:
"pass3" expression => "pass2";
"pass2" expression => "pass1";
Expand Down Expand Up @@ -239,7 +240,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}_${d_uuid}_${c_arg0}", "${status}", "method_id_${result_class}"),
comment => "${c_uuid}";


Expand Down Expand Up @@ -292,6 +293,8 @@ bundle agent apply_gm_v4(name, args, status, result_class, mode)
"Found unexpected class ${define_expected_classes.unexpected_classes_class_prefix_${result_class}}"
ifvarclass => "${define_expected_classes.unexpected_classes_class_prefix_${result_class}}",
comment => "${c_uuid}";

"Arg0 canonified is ${c_arg0}";
}

# Mimic default node properties values
Expand Down
1 change: 0 additions & 1 deletion tests/acceptance/testall
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#

set -e

#
# Detect and replace non-POSIX shell
#
Expand Down
6 changes: 3 additions & 3 deletions tree/20_cfe_basics/log_rudder.cf
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,9 @@ bundle agent _method_reporting_context_v4(c_name, c_key, report_id)
# Non-canonified version, to be used in reports
"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}");
# it needs the directive_id to enforce unicity, and the c_key to work with iterator
"report_data.report_id" string => canonify("${report_id}_${report_data.directive_id}_${c_key}");
"report_data.method_id" string => canonify("${report_id}_${report_data.directive_id}_${c_key}");
"report_data.identifier" string => "${report_data.rule_id}@@${report_data.directive_id}@@${report_data.report_id_r}";

methods:
Expand Down
4 changes: 2 additions & 2 deletions tree/30_generic_methods/command_execution.cf
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ bundle agent command_execution(command)

methods:
pass3.dry_run::
"${report_data.method_id}" usebundle => _classes_noop("${report_data.method_id}");
"${report_data.method_id}" usebundle => _classes_noop("${report_data.method_id}_${command}");
"${report_data.method_id}" usebundle => _classes_noop("${class_prefix}");
pass3::
"${report_data.method_id}" usebundle => log_rudder_v4("${command}", "Execute command", "${command}");
commands:
pass2.!pass3.!dry_run::
"${command}"
contain => in_shell,
classes => classes_generic_two("${report_data.method_id}", "${class_prefix}");
classes => classes_generic_two("${report_data.method_id}_${command}", "${class_prefix}");
}