diff --git a/contrib/masterfiles/git-failsafe.cf b/contrib/masterfiles/git-failsafe.cf index 672a3e0301..a03600493f 100644 --- a/contrib/masterfiles/git-failsafe.cf +++ b/contrib/masterfiles/git-failsafe.cf @@ -247,7 +247,7 @@ bundle agent git_update perms => u_m("755"), depth_search => u_recurse_basedir("inf"), action => u_immediate, - ifvarclass => "hpux"; + if => "hpux"; "/usr/local/bin" comment => "Ensure cfengine binaries were copied to /usr/local/bin", diff --git a/examples/augment.cf b/examples/augment.cf index 87a476e956..3bedd7fba7 100644 --- a/examples/augment.cf +++ b/examples/augment.cf @@ -2,8 +2,9 @@ bundle common def { vars: # Only define this variable if it is not yet defined. - "example_augment_string_override" - unless => isvariable("example_augment_string_override"); + "example_augment_string" + string => "fallback value when not defined in def.json", + unless => isvariable("example_augment_string"); # Define this variable regardless if it has been set in def.json "example_augment_list_override" @@ -18,16 +19,16 @@ bundle agent main reports: "Def var: '$(def_vars)'"; - "def.example_augment_string_override = '$(def.example_augment_string_override)'"; + "def.example_augment_string = '$(def.example_augment_string)'"; "def.example_augment_list_override = '$(def.example_augment_list_override)'"; "def.example_augment_structured_override[key1] = '$(def.example_augment_structured_override[key1])'"; } #+begin_src example_output #@ ``` #@ R: Def var: 'default:def.example_augment_structured_override' -#@ R: Def var: 'default:def.example_augment_string_override' +#@ R: Def var: 'default:def.example_augment_string' #@ R: Def var: 'default:def.example_augment_list_override' -#@ R: def.example_augment_string_override = 'defined in def.json' +#@ R: def.example_augment_string = 'defined in def.json' #@ R: def.example_augment_list_override = 'defined' #@ R: def.example_augment_list_override = 'in' #@ R: def.example_augment_list_override = 'bundle' diff --git a/examples/classfilterdata_array_of_objects.cf b/examples/classfilterdata_array_of_objects.cf index 224cde4924..6dbd9caebc 100644 --- a/examples/classfilterdata_array_of_objects.cf +++ b/examples/classfilterdata_array_of_objects.cf @@ -7,13 +7,13 @@ bundle agent __main__ vars: "original" data => '[ - { "file": "/tmp/foo", "ifvarclass": "role_1" }, - { "file": "/tmp/bar", "ifvarclass": "role_2" }, - { "file": "/tmp/baz", "ifvarclass": "(role_1|role_2)" } + { "file": "/tmp/foo", "if": "role_1" }, + { "file": "/tmp/bar", "if": "role_2" }, + { "file": "/tmp/baz", "if": "(role_1|role_2)" } ]'; "filtered" - data => classfilterdata("original", "array_of_objects", "ifvarclass"); + data => classfilterdata("original", "array_of_objects", "if"); reports: "Filtered data: $(with)" @@ -26,11 +26,11 @@ bundle agent __main__ #@ R: Filtered data: [ #@ { #@ "file": "/tmp/bar", -#@ "ifvarclass": "role_2" +#@ "if": "role_2" #@ }, #@ { #@ "file": "/tmp/baz", -#@ "ifvarclass": "(role_1|role_2)" +#@ "if": "(role_1|role_2)" #@ } #@ ] #@ ``` diff --git a/examples/classfilterdata_object_of_objects.cf b/examples/classfilterdata_object_of_objects.cf index 69ea750dc9..d0ae0db6ea 100644 --- a/examples/classfilterdata_object_of_objects.cf +++ b/examples/classfilterdata_object_of_objects.cf @@ -7,13 +7,13 @@ bundle agent __main__ vars: "original" data => '{ - "/tmp/foo": { "ifvarclass": "role_1" }, - "/tmp/bar": { "ifvarclass": "role_2" }, - "/tmp/baz": { "ifvarclass": "(role_1|role_2)" } + "/tmp/foo": { "if": "role_1" }, + "/tmp/bar": { "if": "role_2" }, + "/tmp/baz": { "if": "(role_1|role_2)" } }'; "filtered" - data => classfilterdata("original", "object_of_objects", "ifvarclass"); + data => classfilterdata("original", "object_of_objects", "if"); reports: "Filtered data: $(with)" @@ -25,10 +25,10 @@ bundle agent __main__ #@ ``` #@ R: Filtered data: { #@ "/tmp/bar": { -#@ "ifvarclass": "role_2" +#@ "if": "role_2" #@ }, #@ "/tmp/baz": { -#@ "ifvarclass": "(role_1|role_2)" +#@ "if": "(role_1|role_2)" #@ } #@ } #@ ``` diff --git a/tests/acceptance/00_basics/04_bundles/wrong-bundle-type.cf b/tests/acceptance/00_basics/04_bundles/wrong-bundle-type.cf index 34f8381459..891fec99e5 100644 --- a/tests/acceptance/00_basics/04_bundles/wrong-bundle-type.cf +++ b/tests/acceptance/00_basics/04_bundles/wrong-bundle-type.cf @@ -16,7 +16,7 @@ bundle agent init bundle agent test { vars: - "subout" string => execresult("${sys.cf_agent} -Kf ${this.promise_filename}.sub", "noshell"); + "subout" string => execresult("${sys.cf_agent} -Kf $(this.promise_dirname)/wrong-bundle-type.sub.x.cf", "noshell"); } bundle agent check diff --git a/tests/acceptance/00_basics/04_bundles/wrong-bundle-type.cf.sub b/tests/acceptance/00_basics/04_bundles/wrong-bundle-type.sub.x.cf similarity index 100% rename from tests/acceptance/00_basics/04_bundles/wrong-bundle-type.cf.sub rename to tests/acceptance/00_basics/04_bundles/wrong-bundle-type.sub.x.cf diff --git a/tests/acceptance/01_vars/02_functions/classfilterdata_collecting.cf b/tests/acceptance/01_vars/02_functions/classfilterdata_collecting.cf index dba9671cdf..d40d5a4aa8 100644 --- a/tests/acceptance/01_vars/02_functions/classfilterdata_collecting.cf +++ b/tests/acceptance/01_vars/02_functions/classfilterdata_collecting.cf @@ -14,21 +14,21 @@ bundle agent init "mode": "755", "owner": "root", "group": "root", - "ifvarclass": "role_1" + "if": "role_1" }, { "file": "/tmp/bar", "mode": "600", "owner": "root", "group": "root", - "ifvarclass": "role_2" + "if": "role_2" }, { "file": "/tmp/baz", "mode": "644", "owner": "root", "group": "root", - "ifvarclass": "(role_1|role_2)" + "if": "(role_1|role_2)" } ]'; } @@ -44,7 +44,7 @@ bundle agent test vars: "filtered" - data => classfilterdata(readjson("$(G.testfile).json"), "auto", "ifvarclass"); + data => classfilterdata(readjson("$(G.testfile).json"), "auto", "if"); } bundle agent check @@ -57,14 +57,14 @@ bundle agent check "mode": "600", "owner": "root", "group": "root", - "ifvarclass": "role_2" + "if": "role_2" }, { "file": "/tmp/baz", "mode": "644", "owner": "root", "group": "root", - "ifvarclass": "(role_1|role_2)" + "if": "(role_1|role_2)" } ]'); "actual" diff --git a/tests/acceptance/02_classes/01_basic/if_resolving_classexpression_from_datacontainer.cf b/tests/acceptance/02_classes/01_basic/if_resolving_classexpression_from_datacontainer.cf index bdaf17203e..ba14969dd7 100644 --- a/tests/acceptance/02_classes/01_basic/if_resolving_classexpression_from_datacontainer.cf +++ b/tests/acceptance/02_classes/01_basic/if_resolving_classexpression_from_datacontainer.cf @@ -11,7 +11,7 @@ bundle agent test { meta: "description" -> { "CFE-3319" } - string => "Test that if/ifvarclass can check class expressions from within a data container"; + string => "Test that if can check class expressions from within a data container"; vars: diff --git a/tests/acceptance/dcs.sub.cf b/tests/acceptance/dcs.sub.cf index 15bba3cd3d..757943343b 100644 --- a/tests/acceptance/dcs.sub.cf +++ b/tests/acceptance/dcs.sub.cf @@ -116,16 +116,16 @@ bundle common G vars: # General commands. "$(cmds)" string => "$(paths[$(paths_indices)])$(const.dirsep)$(cmds)$(exeext)", - ifvarclass => canonify("$(paths_indices)_$(cmds)$(exeext)"); + if => canonify("$(paths_indices)_$(cmds)$(exeext)"); # Special cases. "$(sbin_cmds)" string => "$(paths[$(paths_indices)])$(const.dirsep)$(sbin_cmds)$(exeext)", - ifvarclass => canonify("$(paths_indices)_$(sbin_cmds)$(exeext)"); + if => canonify("$(paths_indices)_$(sbin_cmds)$(exeext)"); # gmake has higher priority, so should come last. "make" string => "$(paths[$(paths_indices)])$(const.dirsep)make$(exeext)", - ifvarclass => canonify("$(paths_indices)_make$(exeext)"); + if => canonify("$(paths_indices)_make$(exeext)"); "make" string => "$(paths[$(paths_indices)])$(const.dirsep)gmake$(exeext)", - ifvarclass => canonify("$(paths_indices)_gmake$(exeext)"); + if => canonify("$(paths_indices)_gmake$(exeext)"); # on solaris, gsed works more like GNU sed, such as having `-i` option solaris:: @@ -247,7 +247,7 @@ bundle agent test_run(filename) AUTO:: "any" usebundle => "$(default.tests)", - ifvarclass => canonify("have_test_run_$(default.tests)"); + if => canonify("have_test_run_$(default.tests)"); reports: !AUTO:: @@ -460,15 +460,15 @@ bundle agent dcs_report_generic_classes(x) reports: DEBUG:: - "class '$(x)_$(choices)' was defined" ifvarclass => '$(x)_$(choices)'; - "class '$(x)_$(choices)' was NOT defined" ifvarclass => '!$(x)_$(choices)'; + "class '$(x)_$(choices)' was defined" if => '$(x)_$(choices)'; + "class '$(x)_$(choices)' was NOT defined" if => '!$(x)_$(choices)'; } bundle agent dcs_generic_classes_to_string(x) { vars: "choices" slist => { "repaired", "failed", "denied", "timeout", "kept" }; - "s[$(choices)]" string => "$(x)_$(choices)", ifvarclass => '$(x)_$(choices)'; + "s[$(choices)]" string => "$(x)_$(choices)", if => '$(x)_$(choices)'; "found_unsorted" slist => getvalues(s); "found" slist => sort(found_unsorted, "lex"); "found_str" string => format("%S", found); @@ -792,13 +792,13 @@ reports: bundle agent dcs_passif(classname, test) { reports: - "$(test) Pass" ifvarclass => $(classname); - "$(test) FAIL" ifvarclass => not($(classname)); + "$(test) Pass" if => $(classname); + "$(test) FAIL" if => not($(classname)); EXTRA:: - "$(this.bundle): passing based on class '$(classname)'" ifvarclass => $(classname); + "$(this.bundle): passing based on class '$(classname)'" if => $(classname); DEBUG:: - "$(this.bundle): failing based on class '$(classname)'" ifvarclass => not($(classname)); + "$(this.bundle): failing based on class '$(classname)'" if => not($(classname)); } bundle agent dcs_pass(test) @@ -872,17 +872,17 @@ bundle agent dcs_passif_expected(expected, not_expected, test) reports: DEBUG:: "$(this.bundle): bad: $(ex) was NOT defined" - ifvarclass => "!$(ex)"; + if => "!$(ex)"; "$(this.bundle): bad: $(notex) WAS defined" - ifvarclass => "$(notex)"; + if => "$(notex)"; EXTRA:: "$(this.bundle): good: $(ex) WAS defined" - ifvarclass => "$(ex)"; + if => "$(ex)"; "$(this.bundle): good: $(notex) was NOT defined" - ifvarclass => "!$(notex)"; + if => "!$(notex)"; } ####################################################### @@ -906,17 +906,17 @@ bundle agent dcs_passif_output(wanted, unwanted, command, test) reports: DEBUG:: "$(this.bundle): bad: '$(wanted)' was NOT found in the output of '$(command)'" - ifvarclass => "!__passif_output_wanted"; + if => "!__passif_output_wanted"; "$(this.bundle): bad: '$(unwanted)' WAS found in the output of '$(command)'" - ifvarclass => "__passif_output_unwanted"; + if => "__passif_output_unwanted"; EXTRA:: "$(this.bundle): good: '$(wanted)' WAS found in the output of '$(command)'" - ifvarclass => "__passif_output_wanted"; + if => "__passif_output_wanted"; "$(this.bundle): good: '$(unwanted)' was NOT found in the output of '$(command)'" - ifvarclass => "!__passif_output_unwanted"; + if => "!__passif_output_unwanted"; DEBUG:: "$(this.bundle): the output of command '$(command)' was: '$(subout)'"; diff --git a/tests/unit/data/body_executor_control_empty.cf b/tests/unit/data/body_executor_control_empty.cf index 8b13789179..314b71f668 100644 --- a/tests/unit/data/body_executor_control_empty.cf +++ b/tests/unit/data/body_executor_control_empty.cf @@ -1 +1 @@ - +# No configuration for cf-execd here diff --git a/tests/unit/data/constraint_lval_invalid.cf b/tests/unit/data/constraint_lval_invalid.cf deleted file mode 100644 index 588f84ec38..0000000000 --- a/tests/unit/data/constraint_lval_invalid.cf +++ /dev/null @@ -1,7 +0,0 @@ -bundle agent test -{ - files: - "$(G.testdir)/shouldnotexist" - create => "true", - nonexistent_attribute => "abc"; -} diff --git a/tests/unit/data/vars_multiple_types.cf b/tests/unit/data/vars_multiple_types.x.cf similarity index 100% rename from tests/unit/data/vars_multiple_types.cf rename to tests/unit/data/vars_multiple_types.x.cf diff --git a/tests/unit/policy_test.c b/tests/unit/policy_test.c index 11311d0c2c..26ffea99ce 100644 --- a/tests/unit/policy_test.c +++ b/tests/unit/policy_test.c @@ -138,7 +138,7 @@ static void test_body_control_no_arguments(void) static void test_vars_multiple_types(void) { - Seq *errs = LoadAndCheck("vars_multiple_types.cf"); + Seq *errs = LoadAndCheck("vars_multiple_types.x.cf"); assert_int_equal(1, errs->length); SeqDestroy(errs);