File: reports.cf

package info (click to toggle)
cfengine3 3.15.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 34,456 kB
  • sloc: ansic: 145,932; sh: 8,550; makefile: 1,558; yacc: 1,192; python: 1,056; lex: 758; perl: 211; pascal: 149; awk: 58; xml: 21; sed: 13
file content (51 lines) | stat: -rw-r--r-- 1,521 bytes parent folder | download | duplicates (6)
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
# Example policy showing features of reports type promises
bundle agent main
{
  reports:
      "It's recommended that you always guard reports"
        comment => "Remember by default output from cf-agent when run
                    from cf-execd will be emailed";

    DEBUG|DEBUG_main::
      "Run with --define DEBUG or --define DEBUG_main to display this report";

  methods:
      "Actuate bundle that reports with a return value"
        usebundle => bundle_with_return_value,
        useresult => "return_array",
        comment => "Reports can be used to return data into a parent bundle.
                    This is useful in some re-usable bundle patterns.";

  reports:
      "I got '$(return_array[key])' returned from bundle_with_return_value";

      "Reports can be redirected and appended to files"
        report_to_file => "$(sys.workdir)/report_output.txt",
        comment => "It's important to note that this will suppress the report
                   from stdout.";

      "Report content of a file:$(const.n)$(const.n)------------------------"
        printfile => cat( $(this.promise_filename) );
}

bundle agent bundle_with_return_value
{
  reports:
      "value from bundle_with_return_value"
        bundle_return_value_index => "key";
}

body printfile cat(file)
{
      file_to_print   => "$(file)";
      number_of_lines => "inf";
}

@if minimum_version(3.8)
body printfile head(file)
{
      inherit_from => "cat";
      # GNU head defaults to 10
      number_of_lines => "10";
}
@endif