1body common control 2{ 3 inputs => { "../../default.cf.sub", "user_queries.cf.sub" }; 4 bundlesequence => { default("$(this.promise_filename)") }; 5} 6 7bundle agent init 8{ 9 commands: 10 "$(G.sudo) $(user_tests.pw_path) $(G.userdel) testu"; 11 "$(G.sudo) $(user_tests.pw_path) $(G.groupdel) testu"; 12 "$(G.sudo) $(user_tests.pw_path) $(G.groupdel) testg1"; 13 "$(G.sudo) $(user_tests.pw_path) $(G.groupdel) testg2"; 14 "$(G.sudo) $(user_tests.pw_path) $(G.groupadd) testg1"; 15 "$(G.sudo) $(user_tests.pw_path) $(G.useradd) testu"; 16 freebsd:: 17 "$(G.sudo) $(user_tests.pw_path) $(G.usermod) testu -G testg1"; 18 !freebsd:: 19 "$(G.sudo) $(user_tests.pw_path) $(G.usermod) -G testg1 testu"; 20} 21 22bundle agent test 23{ 24 meta: 25 "description" -> { "ENT-3710" } 26 string => "Managing a user without specifying any secondary groups attribute 27 should result in no changes to existing secondary groups."; 28 29 users: 30 "testu" 31 policy => "present"; 32} 33 34bundle agent check 35{ 36 methods: 37 "any" usebundle => user_is_in_secondary_group("testu", "testg1", "testg1_success", "testg1_failure"), 38 classes => always("testg1_method_run"); 39 40 "any" usebundle => user_is_in_secondary_group("testu", "testg2", "testg2_success", "testg2_failure"), 41 classes => always("testg2_method_run"); 42 43 "any" usebundle => user_exists("testu", "testu_success", "testu_failure"), 44 classes => always("testu_method_run"); 45 46 classes: 47 "ready" and => { "testg1_method_run", "testg2_method_run", "testu_method_run" }; 48 "ok" and => { "testg1_success", "!testg1_failure", 49 "!testg2_success", "testg2_failure", 50 "testu_success", "!testu_failure" }; 51 52 reports: 53 ok.ready:: 54 "$(this.promise_filename) Pass"; 55 !ok.ready:: 56 "$(this.promise_filename) FAIL"; 57} 58