1############################################################################## 2# 3# Redmine #3577: evaluation should respect ifvarclass 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 methods: 17 "rm" usebundle => dcs_fini("$(G.testfile).z"); 18 "rm" usebundle => dcs_fini("$(G.testfile).z2"); 19} 20 21 22bundle agent test 23{ 24 classes: 25 "zclass" expression => returnszero("$(G.echo) xyz > $(G.testfile).z", 26 "useshell"), 27 ifvarclass => not("any"); 28 "zclass" expression => returnszero("$(G.echo) xyz > $(G.testfile).z", 29 "useshell"), 30 depends_on => { "this_handle_does_not_exist" }; 31 32 33 !any:: 34 "z2class" expression => returnszero("$(G.echo) xyz > $(G.testfile).z2", 35 "useshell"); 36 37 vars: 38 "x" string => concat("a", "b"), 39 ifvarclass => "!any"; 40 41 "x_not" string => concat("a", "b"), 42 ifvarclass => not("any"); 43 44 !any:: 45 "y" string => concat("c", "d"); 46} 47 48 49bundle agent check 50{ 51 # If the output contains the string, we fail 52 classes: 53 "eval_x" expression => strcmp("ab", "$(test.x)"); 54 "eval_x_not" expression => strcmp("ab", "$(test.x_not)"); 55 "eval_y" expression => strcmp("cd", "$(test.y)"); 56 "eval_z" expression => "zclass"; 57 "zfile_created" expression => fileexists("$(G.testfile).z"); 58 "z2file_created" expression => fileexists("$(G.testfile).z2"); 59 60 methods: 61 "" usebundle => dcs_passif_expected("", 62 "eval_x,eval_x_not,eval_y,zclass,zfile_created,z2file_created", 63 $(this.promise_filename)), 64 inherit => "true"; 65 66 reports: 67 DEBUG:: 68 "x $(test.x)"; 69 "x_not $(test.x_not)"; 70 "y $(test.y)"; 71} 72