File: aix.cf

package info (click to toggle)
cfengine3 3.24.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 37,552 kB
  • sloc: ansic: 163,161; sh: 10,296; python: 2,950; makefile: 1,744; lex: 784; yacc: 633; perl: 211; pascal: 157; xml: 21; sed: 13
file content (78 lines) | stat: -rw-r--r-- 2,235 bytes parent folder | download | duplicates (5)
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
bundle agent inventory_aix
# @brief Red Hat inventory bundle
#
# This agent bundle is for AIX inventory work.
{
  methods:
    "oslevel"
      usebundle => inventory_aix_oslevel;
}

bundle agent inventory_aix_oslevel
# @brief Inventory oslevel
# @description This policy inventories oslevel on aix. It caches the information
# for up to 1 day before re-discovering.
{
  vars:

    "oslevel"
      string => ifelse( isvariable( "paths.oslevel" ), $(paths.oslevel),
                        "/usr/bin/oslevel" );

  commands:

    aix::

      "$(oslevel)"
        handle => "cache_aix_oslevel_s",
        args => "-s > $(sys.statedir)/aix-oslevel-s",
        if => not( fileexists( "$(sys.statedir)/aix-oslevel-s" ) ),
        contain => in_shell,
        comment => "We cache the highest service pack reached to avoid
                    unnecessary command executions.";

      "$(oslevel)"
        handle => "cache_aix_oslevel_r",
        args => "-r > $(sys.statedir)/aix-oslevel-r",
        if => not( fileexists( "$(sys.statedir)/aix-oslevel-r" ) ),
        contain => in_shell,
        comment => "We cache the highest technology level reached to avoid
                    unnecessary command executions.";

  files:

    aix::

      "$(sys.statedir)/aix-oslevel-r"
        handle => "cache_expire_aix_oslevel_r",
        delete => tidy,
        file_select => days_old( 1 ),
        comment => "We regularly clear the cache to avoid stale data";

      "$(sys.statedir)/aix-oslevel-s"
        handle => "cache_expire_aix_oslevel_s",
        delete => tidy,
        file_select => days_old( 1 ),
        comment => "We regularly clear the cache to avoid stale data";

 vars:

    aix::

     "oslevel_s"
       string => readfile("$(sys.statedir)/aix-oslevel-s", 1K ),
       if => fileexists("$(sys.statedir)/aix-oslevel-s"),
       meta => { "inventory", "attribute_name=Highest Service Pack" };

     "oslevel_r"
       string => readfile("$(sys.statedir)/aix-oslevel-r", 1K),
       if => fileexists("$(sys.statedir)/aix-oslevel-r"),
       meta => { "inventory", "attribute_name=Highest Technology Level" };

 reports:

   DEBUG::

     "Highest Service Pack: $(oslevel_s)";
     "Highest Technology Level: $(oslevel_r)";
}