File: mod_common.cf

package info (click to toggle)
cfengine3 3.0.5%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 10,452 kB
  • ctags: 6,615
  • sloc: ansic: 62,933; sh: 9,712; yacc: 347; makefile: 287; sql: 23
file content (203 lines) | stat: -rw-r--r-- 5,086 bytes parent folder | download | duplicates (2)
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#  Copyright (C) Cfengine AS

#  This file is part of Cfengine 3 - written and maintained by Cfengine AS.

#  This program is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by the
#  Free Software Foundation; version 3.

#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA

# To the extent this program is licensed as part of the Enterprise
# versions of Cfengine, the applicable Commerical Open Source License
# (COSL) may apply to this file if you as a licensee so wish it. See
# included file COSL.txt.



# A bundle is a collection of promises, i.e. objects, types and body labels
# A body is a convenient collection of attribute constraints for a type of promise
# Since bundles pertain to specific types of promises, the have types themselves


# Each component has its own Body called control()

#     body cfagent control()
#     body cfservd control
#     body cfenvd  control
#     body cfrun   control

# In addition there is a control section for all the components

#     body common control

#
# This parser should be able to construct the promise graph in
# matrix form and make unique identifiers for each promise so that
# they can be instrumented. Dependency chains should be identified
#
# Conflicts should be analysed automatically. Loops should be
# expanded
#

#####################################################################

body common control
   {
   any::

      bundlesequence  => { 
                         update, 
                         myPromises("2","3"), 
                         myPromises("fish","rabbit"), 
                         Services,
                         testcopy
                         };

      inputs          => {
                         "../tests/mod_execd.cf", 
                         "../tests/mod_files.cf", 
                         "../tests/mod_files_copy.cf", 
                         "../tests/mod_exec.cf",
                         "../tests/mod_process.cf",
                         "../tests/mod_storage.cf",
                         "../tests/mod_access.cf" 
                         };

      version =>  "123";

    solaris::

      bundlesequence  => { additions };
      inputs => { "update.cf", "main.cf" , "linux.cf" };


   any::

     lastseenexpireafter => "240";
   }

###################################################################

body agent control

{
agentaccess => { "mark", "root" };
}

###################################################################

 # Bundles that are common go to everyone.

bundle common globals
{
vars:

 "globalvar" string => "this is a global variable";

  "hostlist"  slist => { "288.39.89.1/24", "178.36.148.1/24", "2001:700:700:11" };

mytype:
}

###################################################################

bundle agent myPromises(s1,s2)   # policy version 1.0
   {
   classes:

     "alias0"    or => { "solaris" , userexists("felix") , "xyz" };

     "allok  "   and => { userexists("$(users)") };

     "Strategy"  dist => { "0.1", "0.2", "0.1" };

   vars:

     "myname"  string => "value in quotes" ,
               policy => "free";

     "myname"  string => "value in quotes 2" ,
               policy => "free";

     "derived" string => "includes $(name) previously defined $(s1) and $(s2)" ,
               policy=>  "free";

     # Vectors and lists

     "list2"   ilist => { "1","2", getuid("mark") };

     "users"   slist => { "mark", 
                          "aeleen", 
                          "kyrre", 
                          "matt" 
                        } ,

                policy => constant;


     
      "xxx" string => readfile( "/home/mark/tmp/testfile" , 4000 );

      "readarray" slist => { readstringlist("/home/mark/tmp/testlist","#.*","[\n]",5,4000) };

     # Associative arrays

     # "array1"   string => readassocarray("/filename");

     # Graph

     "Neighbour[fromhost]" string => "tohost";
     "Adj[tohost]"         string => "nexthost";

    ###

   files:

     "/param/$(s1)/$(s2)" -> "no one special";

   }


##############################################################################

bundle agent main()
   {
   classes:

     "alias1"  or  =>  { "class1", "class2", "class3" };
     "alias2"  or  =>  { class1, class2, class3 };
     "alias3"  and =>  { class1, class2, class3 };

     "alias4"   expression =>  "solaris&x86|linux|mac";

   vars:

      "x" string => "1,2,3";

      "y" real => "3.22";

   reports:

     "Alert Message X" -> { "email", "html" }

         transaction=>filters;     

   }

#########################################################

bundle agent update()

{
vars:

}