1#######################################################
2#
3# Test that action => "warn" works correctly for touch
4# Redmine 3172
5#
6#######################################################
7
8body common control
9{
10      inputs => { "../../default.cf.sub" };
11      bundlesequence  => { default("$(this.promise_filename)") };
12      version => "1.0";
13}
14
15bundle agent init
16{
17  files:
18      "$(G.testfile)"
19      create => "true";
20}
21
22bundle agent test
23{
24  files:
25      "$(G.testfile)"
26      touch => "true",
27      action => warn_only,
28      classes => if_repaired("wrong_class_set");
29
30      "$(G.testfile)_not_there"
31      touch => "true",
32      action => warn_only;
33
34      "$(G.testfile)_there"
35      touch => "true";
36}
37
38bundle agent check
39{
40  vars:
41      "wrong_classes" slist => classesmatching("wrong_.*");
42  classes:
43      "wrong_file_there" expression => fileexists("$(G.testfile)_not_there");
44      "right_file_there" expression => fileexists("$(G.testfile)_there");
45
46      "ok" and => { "right_file_there", "!wrong_file_there", "!wrong_class_set" };
47
48  reports:
49    ok::
50      "$(this.promise_filename) Pass";
51    !ok::
52      "$(this.promise_filename) FAIL";
53
54    DEBUG.!ok::
55      "Unwanted class: $(wrong_classes)";
56}
57