-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #23799: Make rudderc able to compile techniques using a per met…
…hod policy mode override (#5207)
- Loading branch information
Showing
11 changed files
with
361 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
[default] | ||
extend-ignore-re = [ | ||
"[0-9a-fA-F]{8}[-_][0-9a-fA-F]{4}[-_][0-9a-fA-F]{4}[-_][0-9a-fA-F]{4}[-_][0-9a-fA-F]{12}" | ||
] | ||
|
||
[default.extend-words] | ||
# from fusion | ||
SOFTWARES = "SOFTWARES" | ||
# crate name | ||
flate = "flate" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
policies/rudderc/tests/cases/general/policy_mode/metadata.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<TECHNIQUE name="test audit"> | ||
<DESCRIPTION>test audit</DESCRIPTION> | ||
<USEMETHODREPORTING>true</USEMETHODREPORTING> | ||
<MULTIINSTANCE>false</MULTIINSTANCE> | ||
<POLICYGENERATION>separated</POLICYGENERATION> | ||
<AGENT type="cfengine-community"> | ||
<BUNDLES> | ||
<NAME>test_audit</NAME> | ||
</BUNDLES> | ||
<FILES> | ||
<FILE name="technique.cf"> | ||
<INCLUDED>true</INCLUDED> | ||
</FILE> | ||
</FILES> | ||
</AGENT> | ||
<AGENT type="dsc"> | ||
<BUNDLES> | ||
<NAME>Test-Audit</NAME> | ||
</BUNDLES> | ||
<FILES> | ||
<FILE name="technique.ps1"> | ||
<INCLUDED>true</INCLUDED> | ||
</FILE> | ||
</FILES> | ||
</AGENT> | ||
<SECTIONS> | ||
<SECTION name="In audit mode" id="46b8025a-0b06-485c-9127-50e4258ee7e6" component="true" multivalued="true"> | ||
<REPORTKEYS> | ||
<VALUE id="46b8025a-0b06-485c-9127-50e4258ee7e6"> | ||
/tmp/1 | ||
</VALUE> | ||
</REPORTKEYS> | ||
</SECTION> | ||
<SECTION name="In omit mode" id="1eedce7b-3441-4251-bdd6-706fda3ec7a8" component="true" multivalued="true"> | ||
<REPORTKEYS> | ||
<VALUE id="1eedce7b-3441-4251-bdd6-706fda3ec7a8"> | ||
/tmp/1 | ||
</VALUE> | ||
</REPORTKEYS> | ||
</SECTION> | ||
<SECTION name="In enforce mode" id="dbd5ba50-8dfc-11ee-a57e-84a938c470d4" component="true" multivalued="true"> | ||
<REPORTKEYS> | ||
<VALUE id="dbd5ba50-8dfc-11ee-a57e-84a938c470d4"> | ||
/tmp/1 | ||
</VALUE> | ||
</REPORTKEYS> | ||
</SECTION> | ||
<SECTION name="In default mode" id="1d809592-808e-4177-8351-8b7b7769af69" component="true" multivalued="true"> | ||
<REPORTKEYS> | ||
<VALUE id="1d809592-808e-4177-8351-8b7b7769af69"> | ||
/tmp/1 | ||
</VALUE> | ||
</REPORTKEYS> | ||
</SECTION> | ||
</SECTIONS> | ||
</TECHNIQUE> |
53 changes: 53 additions & 0 deletions
53
policies/rudderc/tests/cases/general/policy_mode/technique.cf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# @name test audit | ||
# @version 1.0 | ||
|
||
bundle agent test_audit { | ||
|
||
vars: | ||
"args" slist => {}; | ||
"report_param" string => join("_", args); | ||
"full_class_prefix" string => canonify("test_audit_${report_param}"); | ||
"class_prefix" string => string_head("${full_class_prefix}", "1000"); | ||
|
||
methods: | ||
"46b8025a-0b06-485c-9127-50e4258ee7e6_${report_data.directive_id}" usebundle => call_test_audit_46b8025a_0b06_485c_9127_50e4258ee7e6("In audit mode", "/tmp/1", "46b8025a-0b06-485c-9127-50e4258ee7e6", @{args}, "${class_prefix}", "/tmp/1", "foobar", "true"); | ||
|
||
"1eedce7b-3441-4251-bdd6-706fda3ec7a8_${report_data.directive_id}" usebundle => call_test_audit_1eedce7b_3441_4251_bdd6_706fda3ec7a8("In omit mode", "/tmp/1", "1eedce7b-3441-4251-bdd6-706fda3ec7a8", @{args}, "${class_prefix}", "/tmp/1", "foobar", "true"); | ||
|
||
"dbd5ba50-8dfc-11ee-a57e-84a938c470d4_${report_data.directive_id}" usebundle => call_test_audit_dbd5ba50_8dfc_11ee_a57e_84a938c470d4("In enforce mode", "/tmp/1", "dbd5ba50-8dfc-11ee-a57e-84a938c470d4", @{args}, "${class_prefix}", "/tmp/1", "foobar", "true"); | ||
|
||
"1d809592-808e-4177-8351-8b7b7769af69_${report_data.directive_id}" usebundle => call_test_audit_1d809592_808e_4177_8351_8b7b7769af69("In default mode", "/tmp/1", "1d809592-808e-4177-8351-8b7b7769af69", @{args}, "${class_prefix}", "/tmp/1", "foobar", "true"); | ||
|
||
} | ||
bundle agent call_test_audit_46b8025a_0b06_485c_9127_50e4258ee7e6(c_name, c_key, report_id, args, class_prefix, path, lines, enforce) { | ||
|
||
methods: | ||
"46b8025a-0b06-485c-9127-50e4258ee7e6_${report_data.directive_id}" usebundle => _method_reporting_context_v4("${c_name}", "${c_key}", "${report_id}"); | ||
"46b8025a-0b06-485c-9127-50e4258ee7e6_${report_data.directive_id}" usebundle => push_dry_run_mode("true"); | ||
"46b8025a-0b06-485c-9127-50e4258ee7e6_${report_data.directive_id}" usebundle => file_content("${path}", "${lines}", "${enforce}"); | ||
"46b8025a-0b06-485c-9127-50e4258ee7e6_${report_data.directive_id}" usebundle => pop_dry_run_mode(); | ||
|
||
} | ||
bundle agent call_test_audit_1eedce7b_3441_4251_bdd6_706fda3ec7a8(c_name, c_key, report_id, args, class_prefix, path, lines, enforce) { | ||
|
||
methods: | ||
"1eedce7b-3441-4251-bdd6-706fda3ec7a8_${report_data.directive_id}" usebundle => _method_reporting_context_v4("${c_name}", "${c_key}", "${report_id}"); | ||
"1eedce7b-3441-4251-bdd6-706fda3ec7a8_${report_data.directive_id}" usebundle => file_content("${path}", "${lines}", "${enforce}"); | ||
|
||
} | ||
bundle agent call_test_audit_dbd5ba50_8dfc_11ee_a57e_84a938c470d4(c_name, c_key, report_id, args, class_prefix, path, lines, enforce) { | ||
|
||
methods: | ||
"dbd5ba50-8dfc-11ee-a57e-84a938c470d4_${report_data.directive_id}" usebundle => _method_reporting_context_v4("${c_name}", "${c_key}", "${report_id}"); | ||
"dbd5ba50-8dfc-11ee-a57e-84a938c470d4_${report_data.directive_id}" usebundle => push_dry_run_mode("false"); | ||
"dbd5ba50-8dfc-11ee-a57e-84a938c470d4_${report_data.directive_id}" usebundle => file_content("${path}", "${lines}", "${enforce}"); | ||
"dbd5ba50-8dfc-11ee-a57e-84a938c470d4_${report_data.directive_id}" usebundle => pop_dry_run_mode(); | ||
|
||
} | ||
bundle agent call_test_audit_1d809592_808e_4177_8351_8b7b7769af69(c_name, c_key, report_id, args, class_prefix, path, lines, enforce) { | ||
|
||
methods: | ||
"1d809592-808e-4177-8351-8b7b7769af69_${report_data.directive_id}" usebundle => _method_reporting_context_v4("${c_name}", "${c_key}", "${report_id}"); | ||
"1d809592-808e-4177-8351-8b7b7769af69_${report_data.directive_id}" usebundle => file_content("${path}", "${lines}", "${enforce}"); | ||
|
||
} |
Oops, something went wrong.