puppet 0.16.0 → 0.18.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +98 -0
- data/Rakefile +5 -1
- data/bin/puppet +1 -1
- data/bin/puppetca +25 -11
- data/bin/puppetd +189 -66
- data/bin/puppetdoc +79 -62
- data/bin/puppetmasterd +93 -49
- data/bin/puppetrun +385 -0
- data/conf/redhat/client.init +5 -2
- data/conf/redhat/fileserver.conf +1 -1
- data/conf/redhat/lsb-config.patch +51 -0
- data/conf/redhat/puppet.spec +45 -18
- data/conf/redhat/puppetd.conf +32 -4
- data/conf/redhat/server.init +5 -2
- data/conf/solaris/pkginfo +7 -0
- data/conf/solaris/smf/puppetd.xml +77 -0
- data/conf/solaris/smf/puppetmasterd.xml +77 -0
- data/conf/solaris/smf/svc-puppetd +66 -0
- data/conf/solaris/smf/svc-puppetmasterd +62 -0
- data/examples/code/failers/noobjectrvalue +1 -0
- data/examples/code/snippets/deepclassheirarchy.pp +23 -0
- data/examples/code/snippets/defineoverrides.pp +17 -0
- data/examples/code/snippets/emptyexec.pp +3 -0
- data/examples/code/snippets/selectorvalues.pp +6 -1
- data/examples/code/snippets/tagged.pp +35 -0
- data/ext/ldap/puppet.schema +2 -2
- data/install.rb +4 -2
- data/lib/puppet.rb +206 -15
- data/lib/puppet/client.rb +30 -20
- data/lib/puppet/client/ca.rb +2 -2
- data/lib/puppet/client/dipper.rb +5 -9
- data/lib/puppet/client/master.rb +224 -44
- data/lib/puppet/client/pelement.rb +54 -9
- data/lib/puppet/client/proxy.rb +3 -2
- data/lib/puppet/client/reporter.rb +34 -0
- data/lib/puppet/client/runner.rb +17 -0
- data/lib/puppet/config.rb +136 -55
- data/lib/puppet/daemon.rb +59 -37
- data/lib/puppet/element.rb +2 -1
- data/lib/puppet/event.rb +14 -3
- data/lib/puppet/filetype.rb +28 -19
- data/lib/puppet/log.rb +297 -132
- data/lib/puppet/metric.rb +31 -131
- data/lib/puppet/networkclient.rb +73 -46
- data/lib/puppet/parameter.rb +49 -1
- data/lib/puppet/parsedfile.rb +32 -12
- data/lib/puppet/parser/ast.rb +6 -1
- data/lib/puppet/parser/ast/astarray.rb +32 -6
- data/lib/puppet/parser/ast/collection.rb +91 -0
- data/lib/puppet/parser/ast/compdef.rb +2 -2
- data/lib/puppet/parser/ast/component.rb +24 -11
- data/lib/puppet/parser/ast/function.rb +50 -0
- data/lib/puppet/parser/ast/hostclass.rb +70 -22
- data/lib/puppet/parser/ast/node.rb +17 -8
- data/lib/puppet/parser/ast/nodedef.rb +1 -1
- data/lib/puppet/parser/ast/objectdef.rb +28 -10
- data/lib/puppet/parser/ast/selector.rb +4 -1
- data/lib/puppet/parser/functions.rb +145 -0
- data/lib/puppet/parser/interpreter.rb +243 -86
- data/lib/puppet/parser/lexer.rb +5 -4
- data/lib/puppet/parser/parser.rb +586 -505
- data/lib/puppet/parser/scope.rb +337 -187
- data/lib/puppet/rails.rb +115 -0
- data/lib/puppet/rails/database.rb +40 -0
- data/lib/puppet/rails/host.rb +83 -0
- data/lib/puppet/rails/rails_object.rb +42 -0
- data/lib/puppet/rails/rails_parameter.rb +5 -0
- data/lib/puppet/reports/rrdgraph.rb +20 -0
- data/lib/puppet/reports/tagmail.rb +94 -0
- data/lib/puppet/server.rb +20 -4
- data/lib/puppet/server/authconfig.rb +14 -3
- data/lib/puppet/server/authstore.rb +2 -2
- data/lib/puppet/server/ca.rb +23 -11
- data/lib/puppet/server/filebucket.rb +10 -10
- data/lib/puppet/server/fileserver.rb +4 -8
- data/lib/puppet/server/master.rb +19 -22
- data/lib/puppet/server/pelement.rb +28 -16
- data/lib/puppet/server/report.rb +184 -0
- data/lib/puppet/server/runner.rb +62 -0
- data/lib/puppet/server/servlet.rb +23 -9
- data/lib/puppet/sslcertificates/ca.rb +25 -1
- data/lib/puppet/statechange.rb +34 -53
- data/lib/puppet/storage.rb +1 -2
- data/lib/puppet/transaction.rb +305 -133
- data/lib/puppet/transaction/report.rb +42 -0
- data/lib/puppet/transportable.rb +57 -33
- data/lib/puppet/type.rb +260 -127
- data/lib/puppet/type/component.rb +9 -21
- data/lib/puppet/type/cron.rb +367 -116
- data/lib/puppet/type/exec.rb +15 -16
- data/lib/puppet/type/group.rb +9 -1
- data/lib/puppet/type/nameservice.rb +2 -5
- data/lib/puppet/type/nameservice/netinfo.rb +3 -0
- data/lib/puppet/type/nameservice/objectadd.rb +23 -10
- data/lib/puppet/type/nameservice/pw.rb +16 -3
- data/lib/puppet/type/package.rb +25 -75
- data/lib/puppet/type/package/apple.rb +15 -1
- data/lib/puppet/type/package/apt.rb +37 -2
- data/lib/puppet/type/package/blastwave.rb +136 -0
- data/lib/puppet/type/package/dpkg.rb +4 -4
- data/lib/puppet/type/package/gem.rb +119 -0
- data/lib/puppet/type/package/openbsd.rb +7 -6
- data/lib/puppet/type/package/ports.rb +7 -2
- data/lib/puppet/type/package/rpm.rb +1 -1
- data/lib/puppet/type/package/sun.rb +23 -9
- data/lib/puppet/type/package/sunfreeware.rb +7 -0
- data/lib/puppet/type/package/yum.rb +16 -9
- data/lib/puppet/type/parsedtype.rb +7 -5
- data/lib/puppet/type/parsedtype/mount.rb +55 -34
- data/lib/puppet/type/parsedtype/port.rb +7 -1
- data/lib/puppet/type/parsedtype/sshkey.rb +6 -16
- data/lib/puppet/type/pfile.rb +115 -23
- data/lib/puppet/type/pfile/checksum.rb +18 -5
- data/lib/puppet/type/pfile/content.rb +2 -2
- data/lib/puppet/type/pfile/ensure.rb +3 -3
- data/lib/puppet/type/pfile/group.rb +2 -2
- data/lib/puppet/type/pfile/source.rb +28 -17
- data/lib/puppet/type/pfile/target.rb +25 -17
- data/lib/puppet/type/pfilebucket.rb +25 -6
- data/lib/puppet/type/schedule.rb +6 -6
- data/lib/puppet/type/service.rb +24 -14
- data/lib/puppet/type/service/debian.rb +1 -1
- data/lib/puppet/type/service/redhat.rb +13 -10
- data/lib/puppet/type/service/smf.rb +3 -3
- data/lib/puppet/type/state.rb +1 -2
- data/lib/puppet/type/symlink.rb +3 -4
- data/lib/puppet/type/user.rb +22 -10
- data/lib/puppet/type/yumrepo.rb +6 -1
- data/lib/puppet/type/zone.rb +595 -0
- data/lib/puppet/util.rb +58 -12
- data/test/client/client.rb +2 -2
- data/test/client/master.rb +92 -3
- data/test/client/pelement.rb +99 -0
- data/test/executables/puppetbin.rb +3 -4
- data/test/executables/puppetca.rb +3 -3
- data/test/executables/puppetd.rb +3 -3
- data/test/executables/puppetmasterd.rb +1 -5
- data/test/executables/puppetmodule.rb +2 -2
- data/test/language/ast.rb +200 -11
- data/test/language/functions.rb +245 -0
- data/test/language/interpreter.rb +155 -6
- data/test/language/lexer.rb +35 -2
- data/test/language/node.rb +48 -1
- data/test/language/parser.rb +250 -1
- data/test/language/rails.rb +105 -0
- data/test/language/scope.rb +304 -10
- data/test/language/snippets.rb +54 -5
- data/test/language/transportable.rb +60 -28
- data/test/other/config.rb +214 -1
- data/test/other/events.rb +67 -9
- data/test/other/log.rb +31 -5
- data/test/other/metrics.rb +23 -21
- data/test/other/parsedfile.rb +29 -2
- data/test/other/puppet.rb +79 -0
- data/test/other/report.rb +106 -0
- data/test/other/storage.rb +2 -2
- data/test/other/transactions.rb +128 -2
- data/test/puppet/utiltest.rb +10 -5
- data/test/puppettest.rb +193 -21
- data/test/server/authstore.rb +13 -4
- data/test/server/bucket.rb +33 -8
- data/test/server/ca.rb +44 -6
- data/test/server/master.rb +6 -7
- data/test/server/pelement.rb +15 -5
- data/test/server/report.rb +93 -0
- data/test/server/runner.rb +107 -0
- data/test/server/server.rb +28 -1
- data/test/types/cron.rb +339 -31
- data/test/types/file.rb +256 -24
- data/test/types/filebucket.rb +6 -2
- data/test/types/filesources.rb +41 -92
- data/test/types/group.rb +31 -1
- data/test/types/host.rb +2 -1
- data/test/types/mount.rb +18 -1
- data/test/types/package.rb +200 -18
- data/test/types/service.rb +5 -1
- data/test/types/sshkey.rb +2 -1
- data/test/types/symlink.rb +3 -2
- data/test/types/type.rb +180 -1
- data/test/types/user.rb +65 -27
- data/test/types/yumrepo.rb +15 -0
- data/test/types/zone.rb +437 -0
- metadata +43 -4
- data/bin/cf2puppet +0 -186
- data/conf/redhat/puppetmasterd.conf +0 -5
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: puppet
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2006-
|
6
|
+
version: 0.18.4
|
7
|
+
date: 2006-07-22 00:00:00 -05:00
|
8
8
|
summary: System Automation and Configuration Management Software
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- lib/puppet/transaction.rb
|
46
46
|
- lib/puppet/lock.rb
|
47
47
|
- lib/puppet/inifile.rb
|
48
|
+
- lib/puppet/rails.rb
|
48
49
|
- lib/puppet/filetype.rb
|
49
50
|
- lib/puppet/event-loop.rb
|
50
51
|
- lib/puppet/log.rb
|
@@ -65,6 +66,7 @@ files:
|
|
65
66
|
- lib/puppet/type/component.rb
|
66
67
|
- lib/puppet/type/pfilebucket.rb
|
67
68
|
- lib/puppet/type/group.rb
|
69
|
+
- lib/puppet/type/zone.rb
|
68
70
|
- lib/puppet/type/tidy.rb
|
69
71
|
- lib/puppet/type/exec.rb
|
70
72
|
- lib/puppet/type/symlink.rb
|
@@ -99,25 +101,37 @@ files:
|
|
99
101
|
- lib/puppet/type/nameservice/netinfo.rb
|
100
102
|
- lib/puppet/type/package/dpkg.rb
|
101
103
|
- lib/puppet/type/package/freebsd.rb
|
104
|
+
- lib/puppet/type/package/sunfreeware.rb
|
102
105
|
- lib/puppet/type/package/ports.rb
|
103
106
|
- lib/puppet/type/package/apt.rb
|
104
107
|
- lib/puppet/type/package/apple.rb
|
108
|
+
- lib/puppet/type/package/gem.rb
|
105
109
|
- lib/puppet/type/package/rpm.rb
|
106
110
|
- lib/puppet/type/package/darwinport.rb
|
107
111
|
- lib/puppet/type/package/sun.rb
|
108
112
|
- lib/puppet/type/package/yum.rb
|
109
113
|
- lib/puppet/type/package/openbsd.rb
|
114
|
+
- lib/puppet/type/package/blastwave.rb
|
115
|
+
- lib/puppet/reports/tagmail.rb
|
116
|
+
- lib/puppet/reports/rrdgraph.rb
|
117
|
+
- lib/puppet/rails/rails_object.rb
|
118
|
+
- lib/puppet/rails/rails_parameter.rb
|
119
|
+
- lib/puppet/rails/database.rb
|
120
|
+
- lib/puppet/rails/host.rb
|
110
121
|
- lib/puppet/client/ca.rb
|
122
|
+
- lib/puppet/client/reporter.rb
|
111
123
|
- lib/puppet/client/file.rb
|
112
124
|
- lib/puppet/client/pelement.rb
|
113
125
|
- lib/puppet/client/master.rb
|
114
126
|
- lib/puppet/client/log.rb
|
127
|
+
- lib/puppet/client/runner.rb
|
115
128
|
- lib/puppet/client/dipper.rb
|
116
129
|
- lib/puppet/client/status.rb
|
117
130
|
- lib/puppet/client/proxy.rb
|
118
131
|
- lib/puppet/sslcertificates/ca.rb
|
119
132
|
- lib/puppet/sslcertificates/certificate.rb
|
120
133
|
- lib/puppet/parser/parser.rb
|
134
|
+
- lib/puppet/parser/functions.rb
|
121
135
|
- lib/puppet/parser/scope.rb
|
122
136
|
- lib/puppet/parser/ast.rb
|
123
137
|
- lib/puppet/parser/lexer.rb
|
@@ -127,10 +141,12 @@ files:
|
|
127
141
|
- lib/puppet/parser/ast/compdef.rb
|
128
142
|
- lib/puppet/parser/ast/astarray.rb
|
129
143
|
- lib/puppet/parser/ast/component.rb
|
144
|
+
- lib/puppet/parser/ast/function.rb
|
130
145
|
- lib/puppet/parser/ast/objectparam.rb
|
131
146
|
- lib/puppet/parser/ast/vardef.rb
|
132
147
|
- lib/puppet/parser/ast/selector.rb
|
133
148
|
- lib/puppet/parser/ast/caseopt.rb
|
149
|
+
- lib/puppet/parser/ast/collection.rb
|
134
150
|
- lib/puppet/parser/ast/casestatement.rb
|
135
151
|
- lib/puppet/parser/ast/objectdef.rb
|
136
152
|
- lib/puppet/parser/ast/node.rb
|
@@ -140,14 +156,17 @@ files:
|
|
140
156
|
- lib/puppet/parser/ast/objectref.rb
|
141
157
|
- lib/puppet/parser/ast/classdef.rb
|
142
158
|
- lib/puppet/parser/ast/nodedef.rb
|
159
|
+
- lib/puppet/transaction/report.rb
|
143
160
|
- lib/puppet/server/fileserver.rb
|
144
161
|
- lib/puppet/server/authconfig.rb
|
145
162
|
- lib/puppet/server/ca.rb
|
146
163
|
- lib/puppet/server/rights.rb
|
164
|
+
- lib/puppet/server/report.rb
|
147
165
|
- lib/puppet/server/logger.rb
|
148
166
|
- lib/puppet/server/pelement.rb
|
149
167
|
- lib/puppet/server/master.rb
|
150
168
|
- lib/puppet/server/filebucket.rb
|
169
|
+
- lib/puppet/server/runner.rb
|
151
170
|
- lib/puppet/server/servlet.rb
|
152
171
|
- lib/puppet/server/authstore.rb
|
153
172
|
- lib/puppet/event-loop/better-definers.rb
|
@@ -155,6 +174,7 @@ files:
|
|
155
174
|
- lib/puppet/event-loop/signal-system.rb
|
156
175
|
- test/puppettest.rb
|
157
176
|
- test/other/config.rb
|
177
|
+
- test/other/report.rb
|
158
178
|
- test/other/inifile.rb
|
159
179
|
- test/other/events.rb
|
160
180
|
- test/other/filetype.rb
|
@@ -163,6 +183,7 @@ files:
|
|
163
183
|
- test/other/storage.rb
|
164
184
|
- test/other/parsedfile.rb
|
165
185
|
- test/other/transactions.rb
|
186
|
+
- test/other/puppet.rb
|
166
187
|
- test/other/relationships.rb
|
167
188
|
- test/other/overrides.rb
|
168
189
|
- test/types/cron.rb
|
@@ -170,6 +191,7 @@ files:
|
|
170
191
|
- test/types/parameter.rb
|
171
192
|
- test/types/component.rb
|
172
193
|
- test/types/group.rb
|
194
|
+
- test/types/zone.rb
|
173
195
|
- test/types/file.rb
|
174
196
|
- test/types/tidy.rb
|
175
197
|
- test/types/exec.rb
|
@@ -195,6 +217,7 @@ files:
|
|
195
217
|
- test/executables/puppetca.rb
|
196
218
|
- test/executables/puppetmasterd.rb
|
197
219
|
- test/executables/puppetd.rb
|
220
|
+
- test/client/pelement.rb
|
198
221
|
- test/client/master.rb
|
199
222
|
- test/client/client.rb
|
200
223
|
- test/puppet/error.rb
|
@@ -206,25 +229,29 @@ files:
|
|
206
229
|
- test/server/ca.rb
|
207
230
|
- test/server/server.rb
|
208
231
|
- test/server/rights.rb
|
232
|
+
- test/server/report.rb
|
209
233
|
- test/server/logger.rb
|
210
234
|
- test/server/pelement.rb
|
211
235
|
- test/server/master.rb
|
236
|
+
- test/server/runner.rb
|
212
237
|
- test/server/bucket.rb
|
213
238
|
- test/server/authstore.rb
|
214
239
|
- test/language/transportable.rb
|
215
240
|
- test/language/parser.rb
|
241
|
+
- test/language/functions.rb
|
216
242
|
- test/language/snippets.rb
|
217
243
|
- test/language/scope.rb
|
218
244
|
- test/language/ast.rb
|
245
|
+
- test/language/rails.rb
|
219
246
|
- test/language/lexer.rb
|
220
247
|
- test/language/node.rb
|
221
248
|
- test/language/interpreter.rb
|
222
249
|
- test/certmgr/certmgr.rb
|
223
250
|
- bin/puppetd
|
224
251
|
- bin/puppetca
|
225
|
-
- bin/cf2puppet
|
226
252
|
- bin/puppet
|
227
253
|
- bin/puppetdoc
|
254
|
+
- bin/puppetrun
|
228
255
|
- bin/puppetmasterd
|
229
256
|
- ext/vim
|
230
257
|
- ext/ldap
|
@@ -262,21 +289,26 @@ files:
|
|
262
289
|
- examples/code/allatonce
|
263
290
|
- examples/code/failers/badcompnoparam
|
264
291
|
- examples/code/failers/badcompparam
|
292
|
+
- examples/code/failers/noobjectrvalue
|
265
293
|
- examples/code/failers/badtypeparam
|
266
294
|
- examples/code/failers/badclassparam
|
267
295
|
- examples/code/failers/badclassnoparam
|
268
296
|
- examples/code/snippets/simpleselector
|
297
|
+
- examples/code/snippets/emptyexec.pp
|
298
|
+
- examples/code/snippets/defineoverrides.pp
|
269
299
|
- examples/code/snippets/argumentdefaults
|
270
300
|
- examples/code/snippets/selectorvalues.pp
|
271
301
|
- examples/code/snippets/failmissingexecpath.pp
|
272
302
|
- examples/code/snippets/classpathtest
|
273
303
|
- examples/code/snippets/dirchmod
|
304
|
+
- examples/code/snippets/deepclassheirarchy.pp
|
274
305
|
- examples/code/snippets/filecreate
|
275
306
|
- examples/code/snippets/classincludes.pp
|
276
307
|
- examples/code/snippets/scopetest
|
277
308
|
- examples/code/snippets/multipleinstances
|
278
309
|
- examples/code/snippets/aliastest.pp
|
279
310
|
- examples/code/snippets/casestatement.pp
|
311
|
+
- examples/code/snippets/tagged.pp
|
280
312
|
- examples/code/snippets/tag.pp
|
281
313
|
- examples/code/snippets/classheirarchy.pp
|
282
314
|
- examples/code/snippets/singlequote.pp
|
@@ -300,16 +332,23 @@ files:
|
|
300
332
|
- examples/root/etc/init.d/sleeper
|
301
333
|
- examples/root/etc/puppet/fileserver.conf
|
302
334
|
- examples/root/etc/puppet/puppetmasterd.conf
|
335
|
+
- conf/solaris
|
303
336
|
- conf/redhat
|
304
337
|
- conf/epm.list
|
338
|
+
- conf/solaris/smf
|
339
|
+
- conf/solaris/pkginfo
|
340
|
+
- conf/solaris/smf/svc-puppetmasterd
|
341
|
+
- conf/solaris/smf/puppetmasterd.xml
|
342
|
+
- conf/solaris/smf/puppetd.xml
|
343
|
+
- conf/solaris/smf/svc-puppetd
|
305
344
|
- conf/redhat/puppetd.conf
|
306
345
|
- conf/redhat/fileserver.conf
|
346
|
+
- conf/redhat/lsb-config.patch
|
307
347
|
- conf/redhat/client.init
|
308
348
|
- conf/redhat/server.init
|
309
349
|
- conf/redhat/client.sysconfig
|
310
350
|
- conf/redhat/logrotate
|
311
351
|
- conf/redhat/puppet.spec
|
312
|
-
- conf/redhat/puppetmasterd.conf
|
313
352
|
- conf/redhat/no-chuser-0.15.1.patch
|
314
353
|
- conf/redhat/server.sysconfig
|
315
354
|
test_files:
|
data/bin/cf2puppet
DELETED
@@ -1,186 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
|
3
|
-
#
|
4
|
-
# = Synopsis
|
5
|
-
#
|
6
|
-
# Convert cfengine code to puppet code.
|
7
|
-
#
|
8
|
-
# = Usage
|
9
|
-
#
|
10
|
-
# cf2puppet [-h|--help] -o|--out <dir> <cfengine file>
|
11
|
-
#
|
12
|
-
# = Description
|
13
|
-
#
|
14
|
-
# This script reads in an entire cfengine configuration set, including
|
15
|
-
# importing necessary files, and converts it to a puppet configuration.
|
16
|
-
#
|
17
|
-
# = Options
|
18
|
-
#
|
19
|
-
# help::
|
20
|
-
# Print this help message
|
21
|
-
#
|
22
|
-
# out::
|
23
|
-
# Print this help message
|
24
|
-
#
|
25
|
-
# = Example
|
26
|
-
#
|
27
|
-
# $ puppetdoc > /tmp/reference.rst
|
28
|
-
#
|
29
|
-
# = Author
|
30
|
-
#
|
31
|
-
# Luke Kanies
|
32
|
-
#
|
33
|
-
# = Copyright
|
34
|
-
#
|
35
|
-
# Copyright (c) 2005 Reductive Labs, LLC
|
36
|
-
# Licensed under the GNU Public License
|
37
|
-
|
38
|
-
require 'puppet'
|
39
|
-
require 'getoptlong'
|
40
|
-
|
41
|
-
|
42
|
-
module Cf2Puppet
|
43
|
-
class CfClass < Array
|
44
|
-
attr_accessor :name
|
45
|
-
end
|
46
|
-
|
47
|
-
class CfAction
|
48
|
-
attr_accessor :name, :type
|
49
|
-
|
50
|
-
def []=(param, value)
|
51
|
-
@params[param] = value
|
52
|
-
end
|
53
|
-
|
54
|
-
def initialize
|
55
|
-
@params = {}
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
class Parser
|
60
|
-
def initialize(file)
|
61
|
-
@file = file
|
62
|
-
@dir = File.dirname(file)
|
63
|
-
|
64
|
-
unless FileTest.exists?(file)
|
65
|
-
$stderr.puts "%s does not exist" % file
|
66
|
-
exit(18)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def parse
|
71
|
-
begin
|
72
|
-
File.open(@file) { |f|
|
73
|
-
str = f.read
|
74
|
-
|
75
|
-
# get rid of comments
|
76
|
-
str.gsub(/#.+\n/)
|
77
|
-
str.gsub(/^\s*$/, '') # and blank lines
|
78
|
-
|
79
|
-
while str do
|
80
|
-
case str
|
81
|
-
when /\A(\w+):[^:]/n:
|
82
|
-
action = $1
|
83
|
-
end
|
84
|
-
end
|
85
|
-
f.foreach { |line|
|
86
|
-
case line.chomp
|
87
|
-
when /(\w+):\s*\n/:
|
88
|
-
$action = $1
|
89
|
-
when /(\w+):\s*\n/:
|
90
|
-
$action = $1
|
91
|
-
end
|
92
|
-
}
|
93
|
-
}
|
94
|
-
rescue Errno::ENOENT => detail
|
95
|
-
$stderr.puts "File %s not found" % file
|
96
|
-
return
|
97
|
-
rescue Errno::EACCES => detail
|
98
|
-
$stderr.puts "Could not open file %s" % file
|
99
|
-
return
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
module Actions
|
104
|
-
def import
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
$haveusage = true
|
111
|
-
|
112
|
-
begin
|
113
|
-
require 'rdoc/usage'
|
114
|
-
rescue LoadError
|
115
|
-
$haveusage = false
|
116
|
-
end
|
117
|
-
|
118
|
-
result = GetoptLong.new(
|
119
|
-
[ "--help", "-h", GetoptLong::NO_ARGUMENT ]
|
120
|
-
)
|
121
|
-
|
122
|
-
out = nil
|
123
|
-
|
124
|
-
begin
|
125
|
-
result.each { |opt,arg|
|
126
|
-
case opt
|
127
|
-
when "--out"
|
128
|
-
out = arg
|
129
|
-
when "--help"
|
130
|
-
if $haveusage
|
131
|
-
RDoc::usage && exit
|
132
|
-
else
|
133
|
-
puts "No help available unless you have RDoc::usage installed"
|
134
|
-
exit
|
135
|
-
end
|
136
|
-
end
|
137
|
-
}
|
138
|
-
rescue GetoptLong::InvalidOption => detail
|
139
|
-
$stderr.puts "Try '#{$0} --help'"
|
140
|
-
#if $haveusage
|
141
|
-
# RDoc::usage_no_exit('usage')
|
142
|
-
#end
|
143
|
-
exit(1)
|
144
|
-
end
|
145
|
-
|
146
|
-
unless out
|
147
|
-
puts "You must specify an output directory using '-o'."
|
148
|
-
exit(12)
|
149
|
-
end
|
150
|
-
|
151
|
-
if FileTest.exists?(out)
|
152
|
-
unless FileTest.directory?(out)
|
153
|
-
puts "%s is not a directory" % out
|
154
|
-
exit(14)
|
155
|
-
end
|
156
|
-
else
|
157
|
-
basedir = File.dirname(out)
|
158
|
-
|
159
|
-
unless FileTest.directory?(basedir)
|
160
|
-
puts "Parent directory %s does not exist" % basedir
|
161
|
-
exit(16)
|
162
|
-
end
|
163
|
-
|
164
|
-
Dir.mkdir(out)
|
165
|
-
end
|
166
|
-
|
167
|
-
files = []
|
168
|
-
if ARGV.length > 0
|
169
|
-
files += ARGV
|
170
|
-
else
|
171
|
-
$stderr.puts "Defaulting to cfagent.conf"
|
172
|
-
files << "/var/cfengine/inputs/cfagent.conf"
|
173
|
-
end
|
174
|
-
|
175
|
-
$stderr.puts "****WARNING****
|
176
|
-
I can absolutely guarantee you that this script will not yet produce
|
177
|
-
an exact copy of your cfengine configuration. You _must_not_ just run
|
178
|
-
the generated configuration; check the entire configuration before
|
179
|
-
executing. This is meant as a tool for simplifying migration, not
|
180
|
-
entirely performing it.
|
181
|
-
****WARNING****"
|
182
|
-
|
183
|
-
files.each { |file|
|
184
|
-
handle(file)
|
185
|
-
}
|
186
|
-
# $Id: cf2puppet 643 2005-09-10 18:47:44Z luke $
|