1####################################################### 2# 3# Test logical functions in 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 14####################################################### 15 16bundle agent init 17{ 18 vars: 19 "dummy" string => "dummy"; 20} 21 22####################################################### 23 24bundle agent test 25{ 26 vars: 27 "dummy" string => "dummy"; 28} 29 30####################################################### 31 32bundle agent check 33{ 34 classes: 35 36 "and_yes_both" 37 expression => "any", 38 ifvarclass => and("any", "any"); 39 "and_no_left" 40 expression => "any", 41 ifvarclass => and("any", "none"); 42 "and_no_right" 43 expression => "any", 44 ifvarclass => and("none", "any"); 45 "and_no_none" 46 expression => "any", 47 ifvarclass => and("none", "none"); 48 49 "and_arg_fun" 50 expression => "any", 51 ifvarclass => and(isdir("/")); 52 "and_no_arg_fun" 53 expression => "any", 54 ifvarclass => and(isdir("/bin/sh")); 55 "and_two_args_fun" 56 expression => "any", 57 ifvarclass => and(isdir("/"), isdir("/")); 58 59 "and_long" 60 expression => "any", 61 ifvarclass => and("any", "any", "any", "any", "any", "any", "any", "any"); 62 63 "and_ok" and => { "and_yes_both", "!and_no_left", "!and_no_right", "!and_no_none", 64 "and_arg_fun", "!and_no_arg_fun", "and_two_args_fun", "and_long" }; 65 66 67 # 68 69 "or_yes_both" 70 expression => "any", 71 ifvarclass => or("any", "any"); 72 "or_yes_left" 73 expression => "any", 74 ifvarclass => or("any", "none"); 75 "or_yes_right" 76 expression => "any", 77 ifvarclass => or("none", "any"); 78 "or_no_none" 79 expression => "any", 80 ifvarclass => or("none", "none"); 81 82 "or_arg_fun" 83 expression => "any", 84 ifvarclass => or(isdir("/")); 85 "or_no_arg_fun" 86 expression => "any", 87 ifvarclass => or(isdir("/bin/sh")); 88 "or_two_args_fun" 89 expression => "any", 90 ifvarclass => or(isdir("/"), isexecutable("/")); 91 92 "or_long" 93 expression => "any", 94 ifvarclass => or("any", "any", "any", "any", "any", "any", "any", "any"); 95 96 "or_ok" and => { "or_yes_both", "or_yes_left", "or_yes_right", "!or_no_none", 97 "or_arg_fun", "!or_no_arg_fun", "or_two_args_fun", "or_long" }; 98 99 # 100 101 "not_yes_no" 102 expression => "any", 103 ifvarclass => not("none"); 104 "not_no_yes" 105 expression => "any", 106 ifvarclass => not("any"); 107 "not_arg_fun" 108 expression => "any", 109 ifvarclass => not(islink("/")); 110 111 "not_ok" and => { "not_yes_no", "!not_no_yes", "not_arg_fun" }; 112 113 "ok" and => { "and_ok", "or_ok", "not_ok" }; 114 115 reports: 116 ok:: 117 "$(this.promise_filename) Pass"; 118 !ok:: 119 "$(this.promise_filename) FAIL"; 120} 121 122