diff --git a/services/autorun/hello.cf b/services/autorun/hello.cf index 051de66311..8765bba644 100644 --- a/services/autorun/hello.cf +++ b/services/autorun/hello.cf @@ -1,7 +1,7 @@ bundle agent hello_world_autorun { meta: - "tags" slist => { "autorun" }; + "tags" slist => { "autorun" }; reports: verbose_mode:: diff --git a/services/init.cf b/services/init.cf index 2e14f9c2f2..05039e4795 100644 --- a/services/init.cf +++ b/services/init.cf @@ -8,7 +8,6 @@ # This is loaded very early, only use hard classes or classes from def.json here. # ############################################################################### - # For example: # promise agent git # { diff --git a/services/main.cf b/services/main.cf index c36948c235..ef169336e2 100644 --- a/services/main.cf +++ b/services/main.cf @@ -4,11 +4,9 @@ # - User/Site policy entry # ############################################################################### - bundle agent mpf_main # User Defined Service Catalogue { methods: - # Activate your custom policies here - + # Activate your custom policies here } diff --git a/tests/acceptance/promises/autorun-D.cf b/tests/acceptance/promises/autorun-D.cf index 6d46727f68..c207c3d9d9 100644 --- a/tests/acceptance/promises/autorun-D.cf +++ b/tests/acceptance/promises/autorun-D.cf @@ -3,35 +3,35 @@ # Test autorun # ####################################################### - body common control { - inputs => { '../default.cf.sub' }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { '../default.cf.sub' }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { commands: - "$(G.make) install DESTDIR=$(G.testdir)" - contain => in_dir_shell("$(this.promise_dirname)/../../.."); + "$(G.make) install DESTDIR=$(G.testdir)" + contain => in_dir_shell("$(this.promise_dirname)/../../.."); + vars: - # If masterfiles are installed with --prefix=/other/prefix then we - # need to figure out where did "make install DESTDIR=..." has put - # the files. - "promises_cf_slist" slist => - findfiles("$(G.testdir)/**/promises.cf"); - "promises_cf_path" string => nth(promises_cf_slist, 0); + # If masterfiles are installed with --prefix=/other/prefix then we + # need to figure out where did "make install DESTDIR=..." has put + # the files. + "promises_cf_slist" slist => findfiles("$(G.testdir)/**/promises.cf"); + "promises_cf_path" string => nth(promises_cf_slist, 0); } - ####################################################### - bundle agent check { methods: - "" usebundle => dcs_passif_output(".*R: hello_world_autorun: Hello, this is an automatically loaded bundle.*", - "", - "$(sys.cf_agent) -Dservices_autorun -v -f $(init.promises_cf_path) | $(G.grep) Hello", - $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + ".*R: hello_world_autorun: Hello, this is an automatically loaded bundle.*", + "", + "$(sys.cf_agent) -Dservices_autorun -v -f $(init.promises_cf_path) | $(G.grep) Hello", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/promises/autorun-def_json.cf b/tests/acceptance/promises/autorun-def_json.cf index d9beaf3480..90afc216cf 100644 --- a/tests/acceptance/promises/autorun-def_json.cf +++ b/tests/acceptance/promises/autorun-def_json.cf @@ -3,56 +3,55 @@ # Test autorun # ####################################################### - body common control { - inputs => { '../default.cf.sub' }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { '../default.cf.sub' }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { commands: - "$(G.make) install DESTDIR=$(G.testdir)" - contain => in_dir_shell("$(this.promise_dirname)/../../.."); - vars: - # If masterfiles are installed with --prefix=/other/prefix then we - # need to figure out where did "make install DESTDIR=..." has put - # the files. - "promises_cf_slist" slist => - findfiles("$(G.testdir)/**/promises.cf"); - "promises_cf_path" string => nth(promises_cf_slist, 0); + "$(G.make) install DESTDIR=$(G.testdir)" + contain => in_dir_shell("$(this.promise_dirname)/../../.."); - "masterfiles_path" string => dirname("$(promises_cf_path)"); - "def_json_path" string => concat("$(masterfiles_path)", "/def.json"); + vars: + # If masterfiles are installed with --prefix=/other/prefix then we + # need to figure out where did "make install DESTDIR=..." has put + # the files. + "promises_cf_slist" slist => findfiles("$(G.testdir)/**/promises.cf"); + "promises_cf_path" string => nth(promises_cf_slist, 0); + "masterfiles_path" string => dirname("$(promises_cf_path)"); + "def_json_path" string => concat("$(masterfiles_path)", "/def.json"); } bundle agent test { meta: - "description" string => "Test that def.json can enable autorun as expected."; - + "description" + string => "Test that def.json can enable autorun as expected."; # We need to lay down the def.json that will enable autorun. files: - "$(init.def_json_path)" - create => "true", - edit_line => enable_autorun; + "$(init.def_json_path)" + create => "true", + edit_line => enable_autorun; } bundle edit_line enable_autorun { insert_lines: - '{ "classes": { "services_autorun": ["any"] } }'; + '{ "classes": { "services_autorun": ["any"] } }'; } - ####################################################### - bundle agent check { methods: - "" usebundle => dcs_passif_output(".*R: hello_world_autorun: Hello, this is an automatically loaded bundle.*", - "", - "$(sys.cf_agent) -v -f $(init.promises_cf_path) | $(G.grep) Hello", - $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + ".*R: hello_world_autorun: Hello, this is an automatically loaded bundle.*", + "", + "$(sys.cf_agent) -v -f $(init.promises_cf_path) | $(G.grep) Hello", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/promises/autorun.cf b/tests/acceptance/promises/autorun.cf index d5195a4392..4c05a9e619 100644 --- a/tests/acceptance/promises/autorun.cf +++ b/tests/acceptance/promises/autorun.cf @@ -3,38 +3,34 @@ # Test autorun # ####################################################### - body common control { - inputs => { '../default.cf.sub' }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { '../default.cf.sub' }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } bundle agent init { commands: - "$(G.make) install DESTDIR=$(G.testdir)" - contain => in_dir_shell("$(this.promise_dirname)/../../.."); - vars: - # If masterfiles are installed with --prefix=/other/prefix then we - # need to figure out where did "make install DESTDIR=..." has put - # the files. - "promises_cf_slist" slist => - findfiles("$(G.testdir)/**/promises.cf"); - "promises_cf_path" string => nth(promises_cf_slist, 0); + "$(G.make) install DESTDIR=$(G.testdir)" + contain => in_dir_shell("$(this.promise_dirname)/../../.."); - "masterfiles_path" string => dirname("$(promises_cf_path)"); - "def_cf_path" string => concat("$(masterfiles_path)", "/controls/def.cf"); + vars: + # If masterfiles are installed with --prefix=/other/prefix then we + # need to figure out where did "make install DESTDIR=..." has put + # the files. + "promises_cf_slist" slist => findfiles("$(G.testdir)/**/promises.cf"); + "promises_cf_path" string => nth(promises_cf_slist, 0); + "masterfiles_path" string => dirname("$(promises_cf_path)"); + "def_cf_path" string => concat("$(masterfiles_path)", "/controls/def.cf"); } bundle agent test { meta: - - - "description" - string => "Test that enabling autorun from policy is not sufficient for activation. + "description" + string => "Test that enabling autorun from policy is not sufficient for activation. In order to prevent the parsing of files unnecessarily we guard that with the definition of the services_autorun class. If that class is defined from @@ -44,27 +40,28 @@ behavior to change so that defining from policy worked as desired. This test is intended to track that specific case and if ever fixed, simply update this test to allow it to pass."; - "test_soft_fail" - string => "any", - meta => { "redmine7572", "jiraCFE2135"}; + "test_soft_fail" + string => "any", + meta => { "redmine7572", "jiraCFE2135" }; files: - "$(init.def_cf_path)" edit_line => enable_autorun; + "$(init.def_cf_path)" edit_line => enable_autorun; } bundle edit_line enable_autorun { insert_lines: - 'bundle common __autorun_enable { classes: "services_autorun" expression => "any"; }'; + 'bundle common __autorun_enable { classes: "services_autorun" expression => "any"; }'; } - ####################################################### - bundle agent check { methods: - "" usebundle => dcs_passif_output(".*R: hello_world_autorun: Hello, this is an automatically loaded bundle.*", - "", - "$(sys.cf_agent) -v -f $(init.promises_cf_path) | $(G.grep) Hello", - $(this.promise_filename)); + "" + usebundle => dcs_passif_output( + ".*R: hello_world_autorun: Hello, this is an automatically loaded bundle.*", + "", + "$(sys.cf_agent) -v -f $(init.promises_cf_path) | $(G.grep) Hello", + $(this.promise_filename) + ); } diff --git a/tests/acceptance/promises/promises.cf b/tests/acceptance/promises/promises.cf index ed0bf58cdf..60b79aca09 100644 --- a/tests/acceptance/promises/promises.cf +++ b/tests/acceptance/promises/promises.cf @@ -3,44 +3,38 @@ # Test promises.cf # ####################################################### - body common control { - inputs => { '../default.cf.sub' }; - bundlesequence => { default("$(this.promise_filename)") }; - version => "1.0"; + inputs => { '../default.cf.sub' }; + bundlesequence => { default("$(this.promise_filename)") }; + version => "1.0"; } - ####################################################### - bundle agent init { } - ####################################################### - bundle agent test { vars: - "rundir" string => dirname($(this.promise_filename)); + "rundir" string => dirname($(this.promise_filename)); commands: - "$(sys.cf_promises) -c --eval-functions -f $(this.promise_dirname)/../../../promises.cf" - classes => if_ok("agent_worked_all_right"); + "$(sys.cf_promises) -c --eval-functions -f $(this.promise_dirname)/../../../promises.cf" + classes => if_ok("agent_worked_all_right"); } - ####################################################### - bundle agent check { classes: - "ok" and => { "agent_worked_all_right" }; + "ok" and => { "agent_worked_all_right" }; reports: DEBUG:: ok:: "$(this.promise_filename) Pass"; + !ok:: "$(this.promise_filename) FAIL"; }