1body common control 2{ 3 inputs => { "../../default.cf.sub" }; 4 bundlesequence => { default("$(this.promise_filename)") }; 5 version => "1.0"; 6} 7 8bundle agent init 9{ 10 vars: 11 "passwd_file" 12 string => "/tmp/custom_passwd"; 13} 14 15bundle agent test 16{ 17 meta: 18 "description" 19 string => "Test that ifelse can use the result of isvariable as a class identifer"; 20 21 vars: 22 # Since init.passwd_file is defined, I expect the value to be 23 # the value of init.passwd_file 24 "use_passwd_file" 25 string => ifelse( isvariable("init.passwd_file"), $(init.passwd_file), 26 "/etc/passwd"); 27 28 # Since init.shadow_file is not defined, I expect that the value 29 # will be "/etc/shadow" 30 "use_shadow_file" 31 string => ifelse( isvariable("init.shadow_file"), $(init.shadow_file), 32 "/etc/shadow"); 33} 34 35bundle agent check 36{ 37 methods: 38 "check" usebundle => dcs_check_state(test, 39 "$(this.promise_filename).expected.json", 40 $(this.promise_filename)); 41} 42