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
data/bin/puppetdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/bin/ruby
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
#
|
4
4
|
# = Synopsis
|
@@ -99,7 +99,12 @@ def scrub(text)
|
|
99
99
|
# indent from every line.
|
100
100
|
if text =~ /^(\s+)/
|
101
101
|
indent = $1
|
102
|
-
|
102
|
+
begin
|
103
|
+
return text.gsub(/^#{indent}/,'')
|
104
|
+
rescue => detail
|
105
|
+
puts detail.backtrace
|
106
|
+
puts detail
|
107
|
+
end
|
103
108
|
else
|
104
109
|
return text
|
105
110
|
end
|
@@ -111,12 +116,24 @@ def indent(text, tab)
|
|
111
116
|
return text.gsub(/(^|\A)/, tab).gsub(/^ +\.\./, "..")
|
112
117
|
end
|
113
118
|
|
119
|
+
def paramwrap(name, text, namevar = false)
|
120
|
+
if namevar
|
121
|
+
name = name.to_s + " (*namevar*)"
|
122
|
+
end
|
123
|
+
|
124
|
+
puts "#### %s" % name
|
125
|
+
puts text
|
126
|
+
|
127
|
+
puts ""
|
128
|
+
end
|
129
|
+
|
114
130
|
# Print the docs for arguments
|
115
131
|
def self.arguments
|
116
|
-
puts %{
|
117
|
-
|
118
|
-
|
119
|
-
|
132
|
+
puts %{---
|
133
|
+
inMenu: true
|
134
|
+
title: Configuration Reference
|
135
|
+
---
|
136
|
+
# Puppet Configuration Reference
|
120
137
|
|
121
138
|
Every Puppet executable (with the exception of ``puppetdoc``) accepts all of
|
122
139
|
these arguments, but not all of the arguments make sense for every executable.
|
@@ -129,6 +146,8 @@ This will not always be the case. I have tried to be as thorough as possible
|
|
129
146
|
in the descriptions of the arguments, so it should be obvious whether an
|
130
147
|
argument is approprite or not.
|
131
148
|
|
149
|
+
Any default values are in ``block type`` at the end of the description.
|
150
|
+
|
132
151
|
}
|
133
152
|
|
134
153
|
docs = {}
|
@@ -139,9 +158,20 @@ argument is approprite or not.
|
|
139
158
|
docs.sort { |a, b|
|
140
159
|
a[0].to_s <=> b[0].to_s
|
141
160
|
}.each do |name, object|
|
142
|
-
|
161
|
+
# Make each name an anchor
|
162
|
+
puts %{#### <a name="#{name.to_s}">#{name.to_s}</a> (<em>#{object.section.to_s}</em>)}
|
163
|
+
|
143
164
|
puts ""
|
144
|
-
|
165
|
+
default = ""
|
166
|
+
if val = object.value and val != ""
|
167
|
+
default = " ``%s``" % val
|
168
|
+
end
|
169
|
+
begin
|
170
|
+
puts object.desc.gsub(/\n/, " ") + default
|
171
|
+
rescue => detail
|
172
|
+
puts detail.backtrace
|
173
|
+
puts detail
|
174
|
+
end
|
145
175
|
puts ""
|
146
176
|
end
|
147
177
|
|
@@ -149,21 +179,31 @@ end
|
|
149
179
|
|
150
180
|
# Print the docs for types
|
151
181
|
def self.types
|
152
|
-
puts %{
|
153
|
-
|
154
|
-
Type Reference
|
155
|
-
|
182
|
+
puts %{---
|
183
|
+
inMenu: true
|
184
|
+
title: Type Reference
|
185
|
+
---
|
186
|
+
# Type Reference
|
187
|
+
|
156
188
|
|
157
189
|
}
|
158
190
|
|
159
191
|
types = {}
|
160
192
|
Puppet::Type.eachtype { |type|
|
193
|
+
next if type.name == :puppet
|
194
|
+
next if type.name == :component
|
161
195
|
types[type.name] = type
|
162
196
|
}
|
197
|
+
|
198
|
+
# Build a simple TOC
|
199
|
+
puts "## Table of Contents"
|
200
|
+
puts "1. <a href='#meta-parameters'>Meta-Parameters</a>"
|
201
|
+
types.sort { |a, b| a[0].to_s <=> b[0].to_s }.each do |name, type|
|
202
|
+
puts "1. <a href='#%s'>%s</a>" % [type.name, type.name.to_s.capitalize]
|
203
|
+
end
|
204
|
+
|
163
205
|
puts %{
|
164
|
-
|
165
|
-
Meta-Parameters
|
166
|
-
---------------
|
206
|
+
<h2><a name="meta-parameters">Meta-Parameters</a></h2>
|
167
207
|
|
168
208
|
Metaparameters are parameters that work with any element; they are part of the
|
169
209
|
Puppet framework itself rather than being part of the implementation of any
|
@@ -180,32 +220,37 @@ in your manifest, including defined components.
|
|
180
220
|
params.sort { |a,b|
|
181
221
|
a.to_s <=> b.to_s
|
182
222
|
}.each { |param|
|
183
|
-
|
223
|
+
paramwrap(param.to_s, scrub(Puppet::Type.metaparamdoc(param)))
|
224
|
+
#puts "<dt>" + param.to_s + "</dt>"
|
184
225
|
#puts tab(1) + Puppet::Type.metaparamdoc(param).scrub.indent($tab)gsub(/\n\s*/,' ')
|
185
|
-
puts
|
226
|
+
#puts "<dd>"
|
227
|
+
#puts indent(scrub(Puppet::Type.metaparamdoc(param)), $tab)
|
228
|
+
#puts scrub(Puppet::Type.metaparamdoc(param))
|
229
|
+
#puts "</dd>"
|
230
|
+
|
231
|
+
#puts ""
|
186
232
|
}
|
187
233
|
rescue => detail
|
234
|
+
puts detail.backtrace
|
188
235
|
puts "incorrect metaparams: %s" % detail
|
189
236
|
exit(1)
|
190
237
|
end
|
191
238
|
|
192
239
|
puts %{
|
193
|
-
|
194
|
-
Types
|
195
|
-
-----
|
240
|
+
## Types
|
196
241
|
|
197
242
|
- *namevar* is the parameter used to uniquely identify a type instance.
|
198
243
|
This is the parameter that gets assigned when a string is provided before
|
199
244
|
the colon in a type declaration. In general, only developers will need to
|
200
245
|
worry about which parameter is the ``namevar``.
|
201
246
|
|
202
|
-
In the following code
|
247
|
+
In the following code:
|
203
248
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
249
|
+
file { "/etc/passwd":
|
250
|
+
owner => root,
|
251
|
+
group => root,
|
252
|
+
mode => 644
|
253
|
+
}
|
209
254
|
|
210
255
|
"/etc/passwd" is considered the name of the file object (used for things like
|
211
256
|
dependency handling), and because ``path`` is the namevar for ``file``, that
|
@@ -221,8 +266,6 @@ Types
|
|
221
266
|
types.sort { |a,b|
|
222
267
|
a.to_s <=> b.to_s
|
223
268
|
}.each { |name,type|
|
224
|
-
next if name == :puppet
|
225
|
-
next if name == :component
|
226
269
|
|
227
270
|
puts "
|
228
271
|
|
@@ -231,15 +274,10 @@ Types
|
|
231
274
|
"
|
232
275
|
|
233
276
|
puts "
|
234
|
-
%s
|
235
|
-
%s" % [name, "=" * (name.to_s.length + 4)]
|
236
|
-
#String.new('n%s\n') % name.to_s
|
237
|
-
#puts "**" + type.doc.gsub(/\n\s*/, ' ') + "**\n\n"
|
277
|
+
<h2><a name='%s'>%s</a></h2>" % [name, name]
|
238
278
|
puts scrub(type.doc) + "\n\n"
|
239
279
|
|
240
|
-
#puts tab(1) + "* namevar: %s" % type.namevar
|
241
280
|
docs = {}
|
242
|
-
#puts "%s States\n'''''''''''''''''''''''''''''''" % name.to_s.capitalize
|
243
281
|
type.validstates.sort { |a,b|
|
244
282
|
a.to_s <=> b.to_s
|
245
283
|
}.reject { |sname|
|
@@ -260,46 +298,25 @@ Types
|
|
260
298
|
end
|
261
299
|
doc = doc.dup
|
262
300
|
str = doc
|
263
|
-
#puts "A---" + str + "---"
|
264
301
|
str = scrub(str)
|
265
|
-
#puts "B---" + str + "---"
|
266
|
-
#str = indent(str, $tab)
|
267
|
-
#puts "C---" + str + "---"
|
268
|
-
#str = indent($tab, scrub(doc))
|
269
|
-
|
270
|
-
# If the state has values, then add them:
|
271
|
-
|
272
|
-
#if values = state.values
|
273
|
-
# unless values.empty?
|
274
|
-
# extra = "Acceptable values are %s." % values.join(", ")
|
275
|
-
# str += "\n\n#{extra}"
|
276
|
-
# end
|
277
|
-
#end
|
278
302
|
|
279
|
-
str = indent(str, $tab)
|
280
|
-
#puts "---" + str + "---"
|
303
|
+
#str = indent(str, $tab)
|
281
304
|
docs[sname] = str
|
282
|
-
#puts "- **%s**" % sname
|
283
|
-
#puts tab(1) + state.doc.gsub(/\n\s*/,' ')
|
284
305
|
}
|
285
306
|
|
286
|
-
puts "\n%s Parameters\n
|
307
|
+
puts "\n### %s Parameters\n" % name.to_s.capitalize
|
287
308
|
type.parameters.sort { |a,b|
|
288
309
|
a.to_s <=> b.to_s
|
289
310
|
}.each { |name,param|
|
290
|
-
docs[name] = indent(scrub(type.paramdoc(name)), $tab)
|
311
|
+
#docs[name] = indent(scrub(type.paramdoc(name)), $tab)
|
312
|
+
docs[name] = scrub(type.paramdoc(name))
|
291
313
|
}
|
292
314
|
|
293
315
|
docs.sort { |a, b|
|
294
316
|
a[0].to_s <=> b[0].to_s
|
295
317
|
}.each { |name, doc|
|
296
|
-
|
297
|
-
|
298
|
-
puts " (*namevar*)"
|
299
|
-
else
|
300
|
-
puts ""
|
301
|
-
end
|
302
|
-
puts doc
|
318
|
+
namevar = type.namevar == name and name != :name
|
319
|
+
paramwrap(name, doc, namevar)
|
303
320
|
}
|
304
321
|
puts "\n"
|
305
322
|
}
|
@@ -314,4 +331,4 @@ puts "
|
|
314
331
|
"
|
315
332
|
puts "\n*This page autogenerated on %s*" % Time.now
|
316
333
|
|
317
|
-
# $Id: puppetdoc
|
334
|
+
# $Id: puppetdoc 1410 2006-07-21 15:10:11Z luke $
|
data/bin/puppetmasterd
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/bin/ruby
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
#
|
4
4
|
# = Synopsis
|
@@ -7,8 +7,9 @@
|
|
7
7
|
#
|
8
8
|
# = Usage
|
9
9
|
#
|
10
|
-
# puppetmasterd [-
|
11
|
-
#
|
10
|
+
# puppetmasterd [-D|--daemonize] [-d|--debug] [-h|--help]
|
11
|
+
# [-l|--logdest <file>|console|syslog] [--noca] [--nobucket] [--nonodes]
|
12
|
+
# [-v|--verbose] [-V|--version]
|
12
13
|
#
|
13
14
|
# = Description
|
14
15
|
#
|
@@ -20,7 +21,13 @@
|
|
20
21
|
# is also a valid long argument. For example, 'ssldir' is a valid configuration
|
21
22
|
# parameter, so you can specify '--ssldir <directory>' as an argument.
|
22
23
|
#
|
23
|
-
# See the configuration file
|
24
|
+
# See the configuration file documentation at
|
25
|
+
# http://reductivelabs.com/projects/puppet/documentation/puppet-executable-reference
|
26
|
+
# for the full list of acceptable parameters.
|
27
|
+
#
|
28
|
+
# daemonize::
|
29
|
+
# Send the process into the background. This is the default unless
|
30
|
+
# +verbose+ or +debug+ is enabled.
|
24
31
|
#
|
25
32
|
# debug::
|
26
33
|
# Enable full debugging. Causes the daemon not to go into the background.
|
@@ -42,6 +49,10 @@
|
|
42
49
|
# nonodes::
|
43
50
|
# Do not use individual node designations; each node will receive the result
|
44
51
|
# of evaluating the entire configuration.
|
52
|
+
#
|
53
|
+
# noreports::
|
54
|
+
# Do not start the reports server.
|
55
|
+
#
|
45
56
|
# verbose::
|
46
57
|
# Enable verbosity. Causes the daemon not to go into the background.
|
47
58
|
#
|
@@ -61,16 +72,24 @@
|
|
61
72
|
# Copyright (c) 2005 Reductive Labs, LLC
|
62
73
|
# Licensed under the GNU Public License
|
63
74
|
|
75
|
+
# Do an initial trap, so that cancels don't get a stack trace.
|
76
|
+
trap(:INT) do
|
77
|
+
$stderr.puts "Cancelling startup"
|
78
|
+
exit(0)
|
79
|
+
end
|
80
|
+
|
64
81
|
require 'getoptlong'
|
65
82
|
require 'puppet'
|
66
83
|
require 'puppet/server'
|
67
84
|
|
68
85
|
options = [
|
86
|
+
[ "--daemonize", "-D", GetoptLong::NO_ARGUMENT ],
|
69
87
|
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
|
70
88
|
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
|
71
89
|
[ "--logdest", "-l", GetoptLong::REQUIRED_ARGUMENT ],
|
72
90
|
[ "--noca", GetoptLong::NO_ARGUMENT ],
|
73
91
|
[ "--nobucket", GetoptLong::NO_ARGUMENT ],
|
92
|
+
[ "--noreports", GetoptLong::NO_ARGUMENT ],
|
74
93
|
[ "--nonodes", GetoptLong::NO_ARGUMENT ],
|
75
94
|
[ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
|
76
95
|
[ "--version", "-V", GetoptLong::NO_ARGUMENT ]
|
@@ -90,29 +109,30 @@ rescue LoadError
|
|
90
109
|
$haveusage = false
|
91
110
|
end
|
92
111
|
|
93
|
-
haveca = true
|
94
112
|
master = {}
|
95
113
|
ca = {}
|
114
|
+
report = {}
|
96
115
|
fs = {}
|
97
116
|
bucket = {}
|
98
117
|
args = {}
|
99
|
-
#user = Puppet[:user]
|
100
|
-
#group = Puppet[:group]
|
101
|
-
user = nil
|
102
|
-
group = nil
|
103
|
-
|
104
|
-
havebucket = true
|
105
118
|
|
106
|
-
|
107
|
-
|
108
|
-
|
119
|
+
options = {
|
120
|
+
:haveca => true,
|
121
|
+
:havereport => true,
|
122
|
+
:havebucket => true,
|
123
|
+
:havemaster => true,
|
124
|
+
:setdest => false,
|
125
|
+
:verbose => false,
|
126
|
+
:debug => false
|
127
|
+
}
|
109
128
|
|
110
129
|
begin
|
111
130
|
result.each { |opt,arg|
|
112
131
|
case opt
|
132
|
+
when "--daemonize"
|
133
|
+
options[:daemonize] = true
|
113
134
|
when "--debug"
|
114
|
-
|
115
|
-
Puppet::Log.newdestination(:console)
|
135
|
+
options[:debug] = true
|
116
136
|
when "--help"
|
117
137
|
if $haveusage
|
118
138
|
RDoc::usage && exit
|
@@ -120,25 +140,31 @@ begin
|
|
120
140
|
puts "No help available unless you have RDoc::usage installed"
|
121
141
|
exit
|
122
142
|
end
|
143
|
+
when "--noreports"
|
144
|
+
options[:havereport] = false
|
123
145
|
when "--noca"
|
124
|
-
haveca = false
|
146
|
+
options[:haveca] = false
|
147
|
+
when "--nomaster"
|
148
|
+
options[:havemaster] = false
|
125
149
|
when "--nobucket"
|
126
|
-
havebucket = false
|
150
|
+
options[:havebucket] = false
|
127
151
|
when "--nonodes"
|
128
152
|
master[:UseNodes] = false
|
129
153
|
when "--logdest"
|
130
154
|
begin
|
131
155
|
Puppet::Log.newdestination(arg)
|
132
|
-
setdest = true
|
156
|
+
options[:setdest] = true
|
133
157
|
rescue => detail
|
158
|
+
if Puppet[:debug]
|
159
|
+
puts detail.backtrace
|
160
|
+
end
|
134
161
|
$stderr.puts detail.to_s
|
135
162
|
end
|
136
163
|
when "--version"
|
137
164
|
puts "%s" % Puppet.version
|
138
165
|
exit
|
139
166
|
when "--verbose"
|
140
|
-
|
141
|
-
Puppet::Log.newdestination :console
|
167
|
+
options[:verbose] = true
|
142
168
|
else
|
143
169
|
Puppet.config.handlearg(opt, arg)
|
144
170
|
end
|
@@ -152,7 +178,24 @@ rescue GetoptLong::InvalidOption => detail
|
|
152
178
|
#end
|
153
179
|
exit(1)
|
154
180
|
end
|
155
|
-
|
181
|
+
|
182
|
+
# Handle the logging settings.
|
183
|
+
if options[:debug] or options[:verbose]
|
184
|
+
if options[:debug]
|
185
|
+
Puppet::Log.level = :debug
|
186
|
+
else
|
187
|
+
Puppet::Log.level = :info
|
188
|
+
end
|
189
|
+
|
190
|
+
unless options[:daemonize]
|
191
|
+
Puppet::Log.newdestination(:console)
|
192
|
+
options[:setdest] = true
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
unless options[:setdest]
|
197
|
+
Puppet::Log.newdestination(:syslog)
|
198
|
+
end
|
156
199
|
|
157
200
|
# Now parse the config
|
158
201
|
if Puppet[:config] and File.exists? Puppet[:config]
|
@@ -164,27 +207,33 @@ Puppet.genmanifest
|
|
164
207
|
|
165
208
|
require 'etc'
|
166
209
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
210
|
+
# Default to daemonizing, but if verbose or debug is specified,
|
211
|
+
# default to staying in the foreground.
|
212
|
+
unless options.include?(:daemonize)
|
213
|
+
if Puppet::Log.level == :debug or Puppet::Log.level == :info
|
214
|
+
options[:daemonize] = false
|
215
|
+
else
|
216
|
+
options[:daemonize] = true
|
217
|
+
end
|
171
218
|
end
|
172
219
|
|
173
220
|
handlers = {
|
174
|
-
:Master => master,
|
175
221
|
:Status => {},
|
176
|
-
:Logger => {}
|
177
222
|
}
|
178
223
|
|
179
|
-
|
180
|
-
|
224
|
+
if options[:havemaster]
|
225
|
+
handlers[:Master] = master
|
226
|
+
end
|
227
|
+
|
228
|
+
if options[:havereport]
|
229
|
+
handlers[:Report] = report
|
181
230
|
end
|
182
231
|
|
183
|
-
if haveca
|
232
|
+
if options[:haveca]
|
184
233
|
handlers[:CA] = ca
|
185
234
|
end
|
186
235
|
|
187
|
-
if havebucket
|
236
|
+
if options[:havebucket]
|
188
237
|
handlers[:FileBucket] = bucket
|
189
238
|
end
|
190
239
|
|
@@ -206,6 +255,9 @@ begin
|
|
206
255
|
#server = Puppet::Server.new(:CA => ca)
|
207
256
|
server = Puppet::Server.new(args)
|
208
257
|
rescue => detail
|
258
|
+
if Puppet[:debug]
|
259
|
+
puts detail.backtrace
|
260
|
+
end
|
209
261
|
$stderr.puts detail
|
210
262
|
exit(1)
|
211
263
|
end
|
@@ -214,6 +266,9 @@ if Process.uid == 0
|
|
214
266
|
begin
|
215
267
|
Puppet::Util.chuser
|
216
268
|
rescue => detail
|
269
|
+
if Puppet[:debug]
|
270
|
+
puts detail.backtrace
|
271
|
+
end
|
217
272
|
$stderr.puts "Could not change user to %s: %s" % [Puppet[:user], detail]
|
218
273
|
exit(39)
|
219
274
|
end
|
@@ -224,25 +279,14 @@ if Puppet[:parseonly]
|
|
224
279
|
exit(0)
|
225
280
|
end
|
226
281
|
|
227
|
-
|
228
|
-
|
229
|
-
end
|
230
|
-
|
282
|
+
Puppet.newservice(server)
|
283
|
+
Puppet.settraps
|
231
284
|
|
232
|
-
[:
|
233
|
-
|
234
|
-
Puppet.notice "Caught #{signal}; shutting down"
|
235
|
-
server.shutdown
|
236
|
-
end
|
285
|
+
if options[:daemonize]
|
286
|
+
server.daemonize
|
237
287
|
end
|
238
288
|
|
239
289
|
Puppet.notice "Starting Puppet server version %s" % [Puppet.version]
|
290
|
+
Puppet.start
|
240
291
|
|
241
|
-
|
242
|
-
server.start
|
243
|
-
rescue => detail
|
244
|
-
Puppet.err "Could not start puppetmaster: %s" % detail
|
245
|
-
exit(1)
|
246
|
-
end
|
247
|
-
|
248
|
-
# $Id: puppetmasterd 1012 2006-03-12 02:56:23Z luke $
|
292
|
+
# $Id: puppetmasterd 1351 2006-07-01 17:27:54Z luke $
|