1####################################################### 2# 3# Test getusers(), arg0 only 4# 5####################################################### 6 7body common control 8{ 9 inputs => { "../../default.cf.sub" }; 10 bundlesequence => { default("$(this.promise_filename)") }; 11 version => "1.0"; 12} 13 14bundle agent init 15{ 16 vars: 17 # All users except root, bin, and daemon 18 "users" slist => getusers("root,daemon,bin",""); 19 20 files: 21 "$(G.testfile)" 22 delete => init_delete; 23 24 reports: 25 cfengine_3:: 26 "$(users)" 27 report_to_file => "$(G.testfile)"; 28} 29 30body delete init_delete 31{ 32 dirlinks => "delete"; 33 rmdirs => "true"; 34} 35 36####################################################### 37 38bundle agent test 39{ 40 meta: 41 "test_skip_unsupported" string => "windows"; 42 43 files: 44 # Try to delete the lines that shouldn't be there anyway 45 "$(G.testfile)" 46 edit_line => test_delete, 47 classes => full_set; 48} 49 50bundle edit_line test_delete 51{ 52 delete_lines: 53 "root"; 54 "daemon"; 55 "bin"; 56} 57 58body classes full_set 59{ 60 promise_kept => { "pass" }; 61 promise_repaired => { "fail" }; 62 repair_failed => { "fail" }; 63 repair_denied => { "fail" }; 64 repair_timeout => { "fail" }; 65} 66 67 68####################################################### 69 70bundle agent check 71{ 72 classes: 73 "ok" expression => "pass&!fail"; 74 75 reports: 76 ok:: 77 "$(this.promise_filename) Pass"; 78 79 !ok:: 80 "$(this.promise_filename) FAIL"; 81} 82