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