puppet 0.9.2 → 0.13.0
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 +58 -0
- data/README +21 -18
- data/Rakefile +176 -36
- data/bin/puppet +34 -48
- data/bin/puppetca +41 -28
- data/bin/puppetd +87 -65
- data/bin/puppetdoc +99 -23
- data/bin/puppetmasterd +72 -91
- data/conf/redhat/client.init +80 -0
- data/conf/redhat/client.sysconfig +11 -0
- data/conf/redhat/fileserver.conf +12 -0
- data/conf/redhat/puppet.spec +130 -0
- data/conf/redhat/server.init +89 -0
- data/conf/redhat/server.sysconfig +9 -0
- data/examples/code/allatonce +2 -2
- data/examples/code/assignments +1 -1
- data/examples/code/classing +2 -2
- data/examples/code/components +2 -2
- data/examples/code/file.bl +5 -5
- data/examples/code/filedefaults +2 -2
- data/examples/code/fileparsing +1 -1
- data/examples/code/filerecursion +1 -1
- data/examples/code/functions +1 -1
- data/examples/code/groups +1 -1
- data/examples/code/importing +1 -1
- data/examples/code/nodes +1 -1
- data/examples/code/one +1 -1
- data/examples/code/relationships +2 -2
- data/examples/code/simpletests +5 -5
- data/examples/code/snippets/argumentdefaults +2 -2
- data/examples/code/snippets/casestatement +16 -8
- data/examples/code/snippets/classheirarchy.pp +4 -4
- data/examples/code/snippets/classincludes.pp +4 -4
- data/examples/code/snippets/classpathtest +2 -2
- data/examples/code/snippets/componentmetaparams.pp +11 -0
- data/examples/code/snippets/dirchmod +5 -5
- data/examples/code/snippets/emptyclass.pp +9 -0
- data/examples/code/snippets/failmissingexecpath.pp +1 -1
- data/examples/code/snippets/falsevalues.pp +1 -1
- data/examples/code/snippets/filecreate +5 -5
- data/examples/code/snippets/implicititeration +5 -5
- data/examples/code/snippets/multipleinstances +4 -4
- data/examples/code/snippets/namevartest +3 -3
- data/examples/code/snippets/scopetest +1 -1
- data/examples/code/snippets/selectorvalues.pp +3 -3
- data/examples/code/snippets/simpledefaults +2 -2
- data/examples/code/snippets/simpleselector +5 -5
- data/examples/code/snippets/singleary.pp +19 -0
- data/examples/root/etc/init.d/sleeper +3 -2
- data/ext/emacs/puppet-mode-init.el +6 -0
- data/ext/emacs/puppet-mode.el +189 -0
- data/ext/ldap/puppet.schema +17 -0
- data/ext/{module:puppet → module_puppet} +30 -31
- data/ext/vim/filetype.vim +9 -0
- data/ext/vim/puppet.vim +87 -0
- data/install.rb +63 -30
- data/lib/puppet.rb +216 -122
- data/lib/puppet/client.rb +51 -416
- data/lib/puppet/client/ca.rb +17 -0
- data/lib/puppet/client/dipper.rb +78 -0
- data/lib/puppet/client/file.rb +20 -0
- data/lib/puppet/client/log.rb +17 -0
- data/lib/puppet/client/master.rb +246 -0
- data/lib/puppet/client/proxy.rb +27 -0
- data/lib/puppet/client/status.rb +7 -0
- data/lib/puppet/config.rb +563 -13
- data/lib/puppet/daemon.rb +50 -22
- data/lib/puppet/element.rb +4 -4
- data/lib/puppet/event-loop.rb +1 -0
- data/lib/puppet/event-loop/better-definers.rb +367 -0
- data/lib/puppet/event-loop/event-loop.rb +355 -0
- data/lib/puppet/event-loop/signal-system.rb +220 -0
- data/lib/puppet/event.rb +9 -11
- data/lib/puppet/filetype.rb +195 -0
- data/lib/puppet/log.rb +35 -12
- data/lib/puppet/metric.rb +2 -2
- data/lib/puppet/networkclient.rb +145 -0
- data/lib/puppet/parameter.rb +335 -0
- data/lib/puppet/parser/ast.rb +42 -1453
- data/lib/puppet/parser/ast/astarray.rb +88 -0
- data/lib/puppet/parser/ast/branch.rb +47 -0
- data/lib/puppet/parser/ast/caseopt.rb +66 -0
- data/lib/puppet/parser/ast/casestatement.rb +78 -0
- data/lib/puppet/parser/ast/classdef.rb +78 -0
- data/lib/puppet/parser/ast/compdef.rb +111 -0
- data/lib/puppet/parser/ast/component.rb +105 -0
- data/lib/puppet/parser/ast/hostclass.rb +82 -0
- data/lib/puppet/parser/ast/leaf.rb +86 -0
- data/lib/puppet/parser/ast/node.rb +103 -0
- data/lib/puppet/parser/ast/nodedef.rb +68 -0
- data/lib/puppet/parser/ast/objectdef.rb +336 -0
- data/lib/puppet/parser/ast/objectparam.rb +30 -0
- data/lib/puppet/parser/ast/objectref.rb +76 -0
- data/lib/puppet/parser/ast/selector.rb +60 -0
- data/lib/puppet/parser/ast/typedefaults.rb +45 -0
- data/lib/puppet/parser/ast/vardef.rb +44 -0
- data/lib/puppet/parser/interpreter.rb +31 -14
- data/lib/puppet/parser/lexer.rb +2 -4
- data/lib/puppet/parser/parser.rb +332 -242
- data/lib/puppet/parser/scope.rb +55 -38
- data/lib/puppet/server.rb +43 -44
- data/lib/puppet/server/authstore.rb +3 -6
- data/lib/puppet/server/ca.rb +5 -2
- data/lib/puppet/server/filebucket.rb +2 -4
- data/lib/puppet/server/fileserver.rb +28 -12
- data/lib/puppet/server/logger.rb +15 -4
- data/lib/puppet/server/master.rb +62 -7
- data/lib/puppet/sslcertificates.rb +41 -607
- data/lib/puppet/sslcertificates/ca.rb +291 -0
- data/lib/puppet/sslcertificates/certificate.rb +283 -0
- data/lib/puppet/statechange.rb +6 -1
- data/lib/puppet/storage.rb +67 -56
- data/lib/puppet/transaction.rb +25 -9
- data/lib/puppet/transportable.rb +102 -22
- data/lib/puppet/type.rb +1096 -315
- data/lib/puppet/type/component.rb +30 -21
- data/lib/puppet/type/cron.rb +409 -448
- data/lib/puppet/type/exec.rb +234 -174
- data/lib/puppet/type/group.rb +65 -82
- data/lib/puppet/type/nameservice.rb +247 -3
- data/lib/puppet/type/nameservice/netinfo.rb +29 -40
- data/lib/puppet/type/nameservice/objectadd.rb +52 -66
- data/lib/puppet/type/nameservice/posix.rb +6 -194
- data/lib/puppet/type/package.rb +447 -295
- data/lib/puppet/type/package/apt.rb +51 -50
- data/lib/puppet/type/package/bsd.rb +82 -0
- data/lib/puppet/type/package/dpkg.rb +85 -88
- data/lib/puppet/type/package/rpm.rb +67 -63
- data/lib/puppet/type/package/sun.rb +119 -98
- data/lib/puppet/type/package/yum.rb +41 -37
- data/lib/puppet/type/parsedtype.rb +295 -0
- data/lib/puppet/type/parsedtype/host.rb +143 -0
- data/lib/puppet/type/parsedtype/port.rb +232 -0
- data/lib/puppet/type/parsedtype/sshkey.rb +129 -0
- data/lib/puppet/type/pfile.rb +484 -460
- data/lib/puppet/type/pfile/checksum.rb +237 -181
- data/lib/puppet/type/pfile/content.rb +67 -0
- data/lib/puppet/type/pfile/ensure.rb +212 -0
- data/lib/puppet/type/pfile/group.rb +106 -105
- data/lib/puppet/type/pfile/mode.rb +98 -101
- data/lib/puppet/type/pfile/source.rb +228 -209
- data/lib/puppet/type/pfile/type.rb +18 -21
- data/lib/puppet/type/pfile/uid.rb +127 -130
- data/lib/puppet/type/pfilebucket.rb +68 -63
- data/lib/puppet/type/schedule.rb +341 -0
- data/lib/puppet/type/service.rb +351 -255
- data/lib/puppet/type/service/base.rb +9 -14
- data/lib/puppet/type/service/debian.rb +32 -38
- data/lib/puppet/type/service/init.rb +130 -130
- data/lib/puppet/type/service/smf.rb +48 -20
- data/lib/puppet/type/state.rb +229 -16
- data/lib/puppet/type/symlink.rb +51 -63
- data/lib/puppet/type/tidy.rb +105 -102
- data/lib/puppet/type/user.rb +118 -180
- data/lib/puppet/util.rb +100 -6
- data/test/certmgr/certmgr.rb +0 -1
- data/test/client/client.rb +4 -4
- data/test/executables/puppetbin.rb +7 -14
- data/test/executables/puppetca.rb +18 -24
- data/test/executables/puppetd.rb +7 -16
- data/test/executables/puppetmasterd.rb +7 -9
- data/test/executables/puppetmodule.rb +11 -16
- data/test/language/ast.rb +11 -7
- data/test/language/interpreter.rb +1 -1
- data/test/language/scope.rb +2 -0
- data/test/language/snippets.rb +30 -5
- data/test/language/transportable.rb +77 -0
- data/test/other/config.rb +316 -0
- data/test/other/events.rb +22 -21
- data/test/other/log.rb +14 -14
- data/test/other/metrics.rb +4 -8
- data/test/other/overrides.rb +5 -5
- data/test/other/relationships.rb +4 -2
- data/test/other/storage.rb +64 -3
- data/test/other/transactions.rb +20 -20
- data/test/parser/parser.rb +7 -4
- data/test/puppet/conffiles.rb +12 -12
- data/test/puppet/defaults.rb +13 -11
- data/test/puppet/utiltest.rb +14 -11
- data/test/puppettest.rb +156 -48
- data/test/server/bucket.rb +2 -2
- data/test/server/fileserver.rb +6 -6
- data/test/server/logger.rb +19 -11
- data/test/server/master.rb +33 -4
- data/test/server/server.rb +2 -7
- data/test/types/basic.rb +5 -7
- data/test/types/component.rb +22 -18
- data/test/types/cron.rb +111 -44
- data/test/types/exec.rb +116 -59
- data/test/types/file.rb +262 -137
- data/test/types/filebucket.rb +13 -15
- data/test/types/fileignoresource.rb +12 -16
- data/test/types/filesources.rb +73 -48
- data/test/types/filetype.rb +13 -15
- data/test/types/group.rb +15 -13
- data/test/types/host.rb +146 -0
- data/test/types/package.rb +74 -63
- data/test/types/port.rb +139 -0
- data/test/types/query.rb +8 -8
- data/test/types/schedule.rb +335 -0
- data/test/types/service.rb +137 -21
- data/test/types/sshkey.rb +140 -0
- data/test/types/symlink.rb +3 -5
- data/test/types/tidy.rb +5 -14
- data/test/types/type.rb +67 -11
- data/test/types/user.rb +25 -23
- metadata +186 -122
- data/lib/puppet/type/pfile/create.rb +0 -108
- data/lib/puppet/type/pprocess.rb +0 -97
- data/lib/puppet/type/typegen.rb +0 -149
- data/lib/puppet/type/typegen/filerecord.rb +0 -243
- data/lib/puppet/type/typegen/filetype.rb +0 -316
- data/test/other/state.rb +0 -106
data/bin/puppetca
CHANGED
@@ -9,9 +9,7 @@
|
|
9
9
|
# = Usage
|
10
10
|
#
|
11
11
|
# puppetca [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose]
|
12
|
-
# [
|
13
|
-
# [-s|--sign] [--ssldir <cert directory>]
|
14
|
-
# [-c|--confdir <configuration directory>]
|
12
|
+
# [-g|--generate] [-l|--list] [-s|--sign]
|
15
13
|
#
|
16
14
|
# = Description
|
17
15
|
#
|
@@ -22,15 +20,14 @@
|
|
22
20
|
#
|
23
21
|
# = Options
|
24
22
|
#
|
25
|
-
#
|
26
|
-
#
|
23
|
+
# Note that any configuration parameter that's valid in the configuration file
|
24
|
+
# is also a valid long argument. For example, 'ssldir' is a valid configuration
|
25
|
+
# parameter, so you can specify '--ssldir <directory>' as an argument.
|
27
26
|
#
|
28
|
-
#
|
29
|
-
# Where to look for the ca directory. Defaults to /etc/puppet/ssl/ca.
|
27
|
+
# See the configuration file for the full list of acceptable parameters.
|
30
28
|
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
# for all of its configuration files. Defaults to +/etc/puppet+.
|
29
|
+
# all::
|
30
|
+
# Operate on all outstanding requests. Only makes sense with '--sign'.
|
34
31
|
#
|
35
32
|
# debug::
|
36
33
|
# Enable full debugging.
|
@@ -49,9 +46,6 @@
|
|
49
46
|
# Sign an outstanding certificate request. Unless '--all' is specified,
|
50
47
|
# hosts must be listed after all flags.
|
51
48
|
#
|
52
|
-
# ssldir::
|
53
|
-
# The directory in which to store certificates. Defaults to /etc/puppet/ssl.
|
54
|
-
#
|
55
49
|
# verbose::
|
56
50
|
# Enable verbosity.
|
57
51
|
#
|
@@ -82,18 +76,20 @@ rescue LoadError
|
|
82
76
|
$haveusage = false
|
83
77
|
end
|
84
78
|
|
85
|
-
|
79
|
+
options = [
|
86
80
|
[ "--all", "-a", GetoptLong::NO_ARGUMENT ],
|
87
|
-
[ "--cadir", GetoptLong::REQUIRED_ARGUMENT ],
|
88
|
-
[ "--confdir", "-c", GetoptLong::REQUIRED_ARGUMENT ],
|
89
81
|
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
|
90
82
|
[ "--generate", "-g", GetoptLong::NO_ARGUMENT ],
|
91
83
|
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
|
92
84
|
[ "--list", "-l", GetoptLong::NO_ARGUMENT ],
|
93
85
|
[ "--sign", "-s", GetoptLong::NO_ARGUMENT ],
|
94
|
-
[ "--ssldir", GetoptLong::REQUIRED_ARGUMENT ],
|
95
86
|
[ "--verbose", "-v", GetoptLong::NO_ARGUMENT ]
|
96
|
-
|
87
|
+
]
|
88
|
+
|
89
|
+
# Add all of the config parameters as valid options.
|
90
|
+
Puppet.config.addargs(options)
|
91
|
+
|
92
|
+
result = GetoptLong.new(*options)
|
97
93
|
|
98
94
|
mode = nil
|
99
95
|
all = false
|
@@ -104,12 +100,8 @@ begin
|
|
104
100
|
case opt
|
105
101
|
when "--all"
|
106
102
|
all = true
|
107
|
-
when "--cadir"
|
108
|
-
Puppet[:cadir] = arg
|
109
|
-
when "--confdir"
|
110
|
-
Puppet[:puppetconf] = arg
|
111
103
|
when "--debug"
|
112
|
-
Puppet
|
104
|
+
Puppet::Log.level = :debug
|
113
105
|
when "--generate"
|
114
106
|
generate = arg
|
115
107
|
mode = :generate
|
@@ -124,10 +116,10 @@ begin
|
|
124
116
|
mode = :list
|
125
117
|
when "--sign"
|
126
118
|
mode = :sign
|
127
|
-
when "--ssldir"
|
128
|
-
Puppet[:ssldir] = arg
|
129
119
|
when "--verbose"
|
130
|
-
Puppet
|
120
|
+
Puppet::Log.level = :info
|
121
|
+
else
|
122
|
+
Puppet.config.handlearg(opt, arg)
|
131
123
|
end
|
132
124
|
}
|
133
125
|
rescue GetoptLong::InvalidOption => detail
|
@@ -138,7 +130,22 @@ rescue GetoptLong::InvalidOption => detail
|
|
138
130
|
exit(1)
|
139
131
|
end
|
140
132
|
|
141
|
-
|
133
|
+
# Now parse the config
|
134
|
+
if Puppet[:config] and File.exists? Puppet[:config]
|
135
|
+
Puppet.config.parse(Puppet[:config])
|
136
|
+
end
|
137
|
+
|
138
|
+
Puppet.genconfig
|
139
|
+
Puppet.genmanifest
|
140
|
+
|
141
|
+
Puppet::Util.chuser
|
142
|
+
|
143
|
+
begin
|
144
|
+
ca = Puppet::SSLCertificates::CA.new()
|
145
|
+
rescue => detail
|
146
|
+
puts detail.to_s
|
147
|
+
exit(23)
|
148
|
+
end
|
142
149
|
|
143
150
|
unless mode
|
144
151
|
$stderr.puts "You must specify --list or --sign"
|
@@ -163,6 +170,11 @@ when :sign
|
|
163
170
|
end
|
164
171
|
|
165
172
|
unless all
|
173
|
+
ARGV.each { |host|
|
174
|
+
unless hosts.include?(host)
|
175
|
+
$stderr.puts "No waiting request for %s" % host
|
176
|
+
end
|
177
|
+
}
|
166
178
|
hosts = hosts.find_all { |host|
|
167
179
|
ARGV.include?(host)
|
168
180
|
}
|
@@ -177,6 +189,7 @@ when :sign
|
|
177
189
|
|
178
190
|
begin
|
179
191
|
ca.sign(csr)
|
192
|
+
$stderr.puts "Signed %s" % host
|
180
193
|
rescue => detail
|
181
194
|
$stderr.puts "Could not sign request for %s: %s" % [host, detail]
|
182
195
|
end
|
@@ -210,4 +223,4 @@ else
|
|
210
223
|
exit(42)
|
211
224
|
end
|
212
225
|
|
213
|
-
# $Id: puppetca
|
226
|
+
# $Id: puppetca 873 2006-02-07 23:12:33Z luke $
|
data/bin/puppetd
CHANGED
@@ -9,10 +9,8 @@
|
|
9
9
|
# = Usage
|
10
10
|
#
|
11
11
|
# puppetd [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose]
|
12
|
-
# [
|
13
|
-
# [
|
14
|
-
# [-w|--waitforcert <seconds>] [-c|--confdir <configuration directory>]
|
15
|
-
# [--vardir <var directory>] [--centrallogging]
|
12
|
+
# [-l|--logdest <syslog|<file>|console>] [--fqdn <host name>]
|
13
|
+
# [-o|--onetime] [-w|--waitforcert <seconds>] [--centrallogging]
|
16
14
|
#
|
17
15
|
# = Description
|
18
16
|
#
|
@@ -29,14 +27,16 @@
|
|
29
27
|
#
|
30
28
|
# = Options
|
31
29
|
#
|
30
|
+
# Note that any configuration parameter that's valid in the configuration file
|
31
|
+
# is also a valid long argument. For example, 'server' is a valid configuration
|
32
|
+
# parameter, so you can specify '--server <servername>' as an argument.
|
33
|
+
#
|
34
|
+
# See the configuration file for the full list of acceptable parameters.
|
35
|
+
#
|
32
36
|
# centrallogging::
|
33
37
|
# Send all produced logs to the central puppetmasterd system. This currently
|
34
38
|
# results in a significant slowdown, so it is not recommended.
|
35
39
|
#
|
36
|
-
# confdir::
|
37
|
-
# The configuration root directory, where +puppetmasterd+ defaults to looking
|
38
|
-
# for all of its configuration files. Defaults to +/etc/puppet+.
|
39
|
-
#
|
40
40
|
# debug::
|
41
41
|
# Enable full debugging.
|
42
42
|
#
|
@@ -50,22 +50,12 @@
|
|
50
50
|
#
|
51
51
|
# logdest::
|
52
52
|
# Where to send messages. Choose between syslog, the console, and a log file.
|
53
|
-
# Defaults to sending messages to
|
54
|
-
#
|
55
|
-
#
|
56
|
-
# port::
|
57
|
-
# The port to which to connect on the remote server. Currently defaults to 8139.
|
53
|
+
# Defaults to sending messages to syslog, or the console if debugging or
|
54
|
+
# verbosity is enabled.
|
58
55
|
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
# ssldir::
|
64
|
-
# Where to store and find certificates. Defaults to /etc/puppet/ssl.
|
65
|
-
#
|
66
|
-
# vardir::
|
67
|
-
# The variable-size directory, used for storing state. Defaults to
|
68
|
-
# /var/puppet.
|
56
|
+
# onetime::
|
57
|
+
# Run the configuration once, rather than as a long-running daemon. This is
|
58
|
+
# useful for interactively running puppetd.
|
69
59
|
#
|
70
60
|
# verbose::
|
71
61
|
# Turn on verbose reporting.
|
@@ -79,7 +69,7 @@
|
|
79
69
|
#
|
80
70
|
# = Example
|
81
71
|
#
|
82
|
-
#
|
72
|
+
# puppetd --server puppet.domain.com
|
83
73
|
#
|
84
74
|
# = Author
|
85
75
|
#
|
@@ -87,7 +77,7 @@
|
|
87
77
|
#
|
88
78
|
# = Copyright
|
89
79
|
#
|
90
|
-
# Copyright (c) 2005 Reductive Labs, LLC
|
80
|
+
# Copyright (c) 2005, 2006 Reductive Labs, LLC
|
91
81
|
# Licensed under the GNU Public License
|
92
82
|
|
93
83
|
|
@@ -103,22 +93,22 @@ rescue LoadError
|
|
103
93
|
$haveusage = false
|
104
94
|
end
|
105
95
|
|
106
|
-
|
96
|
+
options = [
|
107
97
|
[ "--centrallogging", GetoptLong::NO_ARGUMENT ],
|
108
|
-
[ "--confdir", "-c", GetoptLong::REQUIRED_ARGUMENT ],
|
109
98
|
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
|
110
99
|
[ "--fqdn", "-f", GetoptLong::REQUIRED_ARGUMENT ],
|
111
100
|
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
|
112
101
|
[ "--logdest", "-l", GetoptLong::REQUIRED_ARGUMENT ],
|
113
|
-
[ "--
|
114
|
-
[ "--port", "-p", GetoptLong::REQUIRED_ARGUMENT ],
|
115
|
-
[ "--server", "-s", GetoptLong::REQUIRED_ARGUMENT ],
|
116
|
-
[ "--ssldir", GetoptLong::REQUIRED_ARGUMENT ],
|
102
|
+
[ "--onetime", "-o", GetoptLong::NO_ARGUMENT ],
|
117
103
|
[ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
|
118
104
|
[ "--version", "-V", GetoptLong::NO_ARGUMENT ],
|
119
|
-
[ "--vardir", GetoptLong::REQUIRED_ARGUMENT ],
|
120
105
|
[ "--waitforcert", "-w", GetoptLong::REQUIRED_ARGUMENT ]
|
121
|
-
|
106
|
+
]
|
107
|
+
|
108
|
+
# Add all of the config parameters as valid options.
|
109
|
+
Puppet.config.addargs(options)
|
110
|
+
|
111
|
+
result = GetoptLong.new(*options)
|
122
112
|
|
123
113
|
server = "puppet"
|
124
114
|
fqdn = nil
|
@@ -126,14 +116,19 @@ args = {}
|
|
126
116
|
|
127
117
|
waitforcert = false
|
128
118
|
|
119
|
+
onetime = false
|
120
|
+
|
129
121
|
centrallogs = false
|
122
|
+
|
123
|
+
setdest = false
|
124
|
+
|
130
125
|
begin
|
131
126
|
result.each { |opt,arg|
|
132
127
|
case opt
|
128
|
+
# First check to see if the argument is a valid configuration parameter;
|
129
|
+
# if so, set it.
|
133
130
|
when "--centrallogging"
|
134
131
|
centrallogs = true
|
135
|
-
when "--confdir"
|
136
|
-
Puppet[:puppetconf] = arg
|
137
132
|
when "--help"
|
138
133
|
if $haveusage
|
139
134
|
RDoc::usage && exit
|
@@ -145,36 +140,34 @@ begin
|
|
145
140
|
puts "%s" % Puppet.version
|
146
141
|
exit
|
147
142
|
when "--verbose"
|
148
|
-
Puppet
|
149
|
-
Puppet
|
143
|
+
Puppet::Log.level = :info
|
144
|
+
Puppet::Log.newdestination(:console)
|
145
|
+
setdest = true
|
150
146
|
when "--debug"
|
151
|
-
Puppet
|
152
|
-
Puppet
|
153
|
-
|
154
|
-
Puppet[:noop] = true
|
155
|
-
when "--ssldir"
|
156
|
-
Puppet[:ssldir] = arg
|
147
|
+
Puppet::Log.level = :debug
|
148
|
+
Puppet::Log.newdestination(:console)
|
149
|
+
setdest = true
|
157
150
|
when "--fqdn"
|
158
151
|
fqdn = arg
|
159
|
-
when "--
|
160
|
-
|
152
|
+
when "--onetime"
|
153
|
+
onetime = true
|
161
154
|
when "--port"
|
162
155
|
args[:Port] = arg
|
163
156
|
when "--logdest"
|
164
157
|
begin
|
165
|
-
Puppet
|
158
|
+
Puppet::Log.newdestination(arg)
|
166
159
|
rescue => detail
|
167
160
|
$stderr.puts detail.to_s
|
168
161
|
end
|
169
|
-
when "--vardir"
|
170
|
-
Puppet[:puppetvar] = arg
|
171
162
|
when "--waitforcert"
|
172
|
-
waitforcert = arg
|
163
|
+
waitforcert = arg.to_i
|
164
|
+
else
|
165
|
+
Puppet.config.handlearg(opt, arg)
|
173
166
|
end
|
174
167
|
}
|
175
168
|
rescue GetoptLong::InvalidOption => detail
|
169
|
+
$stderr.puts detail
|
176
170
|
$stderr.puts "Try '#{$0} --help'"
|
177
|
-
#$stderr.puts detail
|
178
171
|
# FIXME RDoc::usage doesn't seem to work
|
179
172
|
#if $haveusage
|
180
173
|
# RDoc::usage(1,'usage')
|
@@ -182,15 +175,25 @@ rescue GetoptLong::InvalidOption => detail
|
|
182
175
|
exit(1)
|
183
176
|
end
|
184
177
|
|
185
|
-
|
178
|
+
Puppet.genconfig
|
179
|
+
Puppet.genmanifest
|
180
|
+
|
181
|
+
# Now parse the config
|
182
|
+
if Puppet[:config] and File.exists? Puppet[:config]
|
183
|
+
Puppet.config.parse(Puppet[:config])
|
184
|
+
end
|
186
185
|
|
187
|
-
if Puppet
|
186
|
+
if Puppet::Log.level == :debug or Puppet::Log.level == :info
|
188
187
|
args[:Daemonize] = false
|
189
188
|
else
|
190
189
|
args[:Daemonize] = true
|
191
190
|
end
|
192
191
|
|
193
|
-
|
192
|
+
unless setdest
|
193
|
+
Puppet::Log.newdestination(:syslog)
|
194
|
+
end
|
195
|
+
|
196
|
+
args[:Server] = Puppet[:server]
|
194
197
|
if fqdn
|
195
198
|
args[:FQDN] = fqdn
|
196
199
|
end
|
@@ -201,13 +204,12 @@ if centrallogs
|
|
201
204
|
if args.include?(:Port)
|
202
205
|
logdest += ":" + args[:Port]
|
203
206
|
end
|
204
|
-
Puppet
|
207
|
+
Puppet::Log.newdestination(logdest)
|
205
208
|
end
|
206
209
|
|
207
|
-
|
210
|
+
Puppet.notice "Starting Puppet client version %s" % [Puppet.version]
|
208
211
|
client = Puppet::Client::MasterClient.new(args)
|
209
212
|
|
210
|
-
|
211
213
|
unless client.readcert
|
212
214
|
if waitforcert
|
213
215
|
begin
|
@@ -225,22 +227,42 @@ unless client.readcert
|
|
225
227
|
exit(1)
|
226
228
|
end
|
227
229
|
end
|
230
|
+
|
231
|
+
# Now, because the Net::HTTP object cannot be modified once we've connected,
|
232
|
+
# we need to recreate the client with the certs intact
|
233
|
+
client = Puppet::Client::MasterClient.new(args)
|
234
|
+
unless client.readcert
|
235
|
+
PUppet.err "Could not read certificates after retrieving them"
|
236
|
+
exit(34)
|
237
|
+
end
|
228
238
|
end
|
229
239
|
|
230
|
-
if
|
240
|
+
if args[:Daemonize]
|
241
|
+
#exit(13)
|
231
242
|
client.daemonize
|
232
243
|
end
|
233
244
|
|
234
245
|
# now set up the network client with the certs, now that we have them
|
235
246
|
client.setcerts
|
236
247
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
248
|
+
trap(:INT) {
|
249
|
+
client.shutdown
|
250
|
+
}
|
251
|
+
|
252
|
+
if onetime
|
253
|
+
begin
|
254
|
+
client.run
|
255
|
+
rescue => detail
|
256
|
+
Puppet.err detail.to_s
|
257
|
+
if Puppet[:debug]
|
258
|
+
puts detail.backtrace
|
259
|
+
end
|
260
|
+
end
|
261
|
+
else
|
262
|
+
client.start
|
263
|
+
|
264
|
+
# Mmm, hackish
|
265
|
+
Puppet.start
|
244
266
|
end
|
245
267
|
|
246
|
-
# $Id: puppetd
|
268
|
+
# $Id: puppetd 873 2006-02-07 23:12:33Z luke $
|
data/bin/puppetdoc
CHANGED
@@ -45,17 +45,13 @@ rescue LoadError
|
|
45
45
|
$haveusage = false
|
46
46
|
end
|
47
47
|
|
48
|
-
def tab(num)
|
49
|
-
return $tab * num
|
50
|
-
end
|
51
|
-
|
52
48
|
result = GetoptLong.new(
|
53
49
|
[ "--help", "-h", GetoptLong::NO_ARGUMENT ]
|
54
50
|
)
|
55
51
|
|
56
52
|
debug = false
|
57
53
|
|
58
|
-
$tab = "
|
54
|
+
$tab = " "
|
59
55
|
|
60
56
|
begin
|
61
57
|
result.each { |opt,arg|
|
@@ -77,6 +73,33 @@ rescue GetoptLong::InvalidOption => detail
|
|
77
73
|
exit(1)
|
78
74
|
end
|
79
75
|
|
76
|
+
def scrub(text)
|
77
|
+
# For text with no carriage returns, there's nothing to do.
|
78
|
+
if text !~ /\n/
|
79
|
+
return text
|
80
|
+
end
|
81
|
+
indent = nil
|
82
|
+
|
83
|
+
# If we can match an indentation, then just remove that same level of
|
84
|
+
# indent from every line.
|
85
|
+
if text =~ /^(\s+)/
|
86
|
+
indent = $1
|
87
|
+
return text.gsub(/^#{indent}/,'')
|
88
|
+
else
|
89
|
+
return text
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
# Indent every line in the chunk except those which begin with '..'.
|
95
|
+
def indent(text, tab)
|
96
|
+
return text.gsub(/(^|\A)/, tab).gsub(/^ +\.\./, "..")
|
97
|
+
end
|
98
|
+
|
99
|
+
#def tab(num)
|
100
|
+
# return $tab * num
|
101
|
+
#end
|
102
|
+
|
80
103
|
puts %{
|
81
104
|
==============
|
82
105
|
Type Reference
|
@@ -93,18 +116,29 @@ puts %{
|
|
93
116
|
Meta-Parameters
|
94
117
|
---------------
|
95
118
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
}
|
119
|
+
Metaparameters are parameters that work with any element; they are part of the
|
120
|
+
Puppet framework itself rather than being part of the implementation of any
|
121
|
+
given instance. Thus, any defined metaparameter can be used with any instance
|
122
|
+
in your manifest, including defined components.
|
101
123
|
|
102
|
-
params.sort { |a,b|
|
103
|
-
a.to_s <=> b.to_s
|
104
|
-
}.each { |param|
|
105
|
-
puts "- **" + param.to_s + "**"
|
106
|
-
puts tab(1) + Puppet::Type.metaparamdoc(param).gsub(/\n\s*/,' ')
|
107
124
|
}
|
125
|
+
begin
|
126
|
+
params = []
|
127
|
+
Puppet::Type.eachmetaparam { |param|
|
128
|
+
params << param
|
129
|
+
}
|
130
|
+
|
131
|
+
params.sort { |a,b|
|
132
|
+
a.to_s <=> b.to_s
|
133
|
+
}.each { |param|
|
134
|
+
puts "- **" + param.to_s + "**"
|
135
|
+
#puts tab(1) + Puppet::Type.metaparamdoc(param).scrub.indent($tab)gsub(/\n\s*/,' ')
|
136
|
+
puts indent(scrub(Puppet::Type.metaparamdoc(param)), $tab)
|
137
|
+
}
|
138
|
+
rescue => detail
|
139
|
+
puts "incorrect metaparams: %s" % detail
|
140
|
+
exit(1)
|
141
|
+
end
|
108
142
|
|
109
143
|
puts %{
|
110
144
|
-----
|
@@ -113,9 +147,25 @@ Types
|
|
113
147
|
|
114
148
|
- *namevar* is the parameter used to uniquely identify a type instance.
|
115
149
|
This is the parameter that gets assigned when a string is provided before
|
116
|
-
the colon in a type declaration.
|
117
|
-
|
150
|
+
the colon in a type declaration. In general, only developers will need to
|
151
|
+
worry about which parameter is the ``namevar``.
|
152
|
+
|
153
|
+
In the following code::
|
154
|
+
|
155
|
+
file { "/etc/passwd":
|
156
|
+
owner => root,
|
157
|
+
group => root,
|
158
|
+
mode => 644
|
159
|
+
}
|
118
160
|
|
161
|
+
"/etc/passwd" is considered the name of the file object (used for things like
|
162
|
+
dependency handling), and because ``path`` is the namevar for ``file``, that
|
163
|
+
string is assigned to the ``path`` parameter.
|
164
|
+
|
165
|
+
- *parameters* determine the specific configuration of the instance. They either
|
166
|
+
directly modify the system (internally, these are called states) or they affect
|
167
|
+
how the instance behaves (e.g., adding a search path for ``exec`` instances
|
168
|
+
or determining recursion on ``file`` instances).
|
119
169
|
|
120
170
|
}
|
121
171
|
|
@@ -136,8 +186,8 @@ types.sort { |a,b|
|
|
136
186
|
%s" % [name, "=" * (name.to_s.length + 4)]
|
137
187
|
#String.new('n%s\n') % name.to_s
|
138
188
|
#puts "**" + type.doc.gsub(/\n\s*/, ' ') + "**\n\n"
|
139
|
-
puts type.doc
|
140
|
-
|
189
|
+
puts scrub(type.doc) + "\n\n"
|
190
|
+
|
141
191
|
#puts tab(1) + "* namevar: %s" % type.namevar
|
142
192
|
docs = {}
|
143
193
|
#puts "%s States\n'''''''''''''''''''''''''''''''" % name.to_s.capitalize
|
@@ -148,7 +198,33 @@ types.sort { |a,b|
|
|
148
198
|
state.nodoc
|
149
199
|
}.each { |sname|
|
150
200
|
state = type.statebyname(sname)
|
151
|
-
|
201
|
+
|
202
|
+
doc = nil
|
203
|
+
str = nil
|
204
|
+
unless doc = state.doc.dup
|
205
|
+
$stderr.puts "No docs for %s[%s]" % [type, sname]
|
206
|
+
next
|
207
|
+
end
|
208
|
+
str = doc
|
209
|
+
#puts "A---" + str + "---"
|
210
|
+
str = scrub(str)
|
211
|
+
#puts "B---" + str + "---"
|
212
|
+
#str = indent(str, $tab)
|
213
|
+
#puts "C---" + str + "---"
|
214
|
+
#str = indent($tab, scrub(doc))
|
215
|
+
|
216
|
+
# If the state has values, then add them:
|
217
|
+
|
218
|
+
#if values = state.values
|
219
|
+
# unless values.empty?
|
220
|
+
# extra = "Acceptable values are %s." % values.join(", ")
|
221
|
+
# str += "\n\n#{extra}"
|
222
|
+
# end
|
223
|
+
#end
|
224
|
+
|
225
|
+
str = indent(str, $tab)
|
226
|
+
#puts "---" + str + "---"
|
227
|
+
docs[sname] = str
|
152
228
|
#puts "- **%s**" % sname
|
153
229
|
#puts tab(1) + state.doc.gsub(/\n\s*/,' ')
|
154
230
|
}
|
@@ -157,7 +233,7 @@ types.sort { |a,b|
|
|
157
233
|
type.parameters.sort { |a,b|
|
158
234
|
a.to_s <=> b.to_s
|
159
235
|
}.each { |name,param|
|
160
|
-
docs[name] = type.paramdoc(name)
|
236
|
+
docs[name] = indent(scrub(type.paramdoc(name)), $tab)
|
161
237
|
}
|
162
238
|
|
163
239
|
docs.sort { |a, b|
|
@@ -169,7 +245,7 @@ types.sort { |a,b|
|
|
169
245
|
else
|
170
246
|
puts ""
|
171
247
|
end
|
172
|
-
puts
|
248
|
+
puts doc
|
173
249
|
}
|
174
250
|
puts "\n"
|
175
251
|
}
|
@@ -181,4 +257,4 @@ puts "
|
|
181
257
|
"
|
182
258
|
|
183
259
|
puts "\n*This page autogenerated on %s*" % Time.now
|
184
|
-
# $Id: puppetdoc
|
260
|
+
# $Id: puppetdoc 832 2006-01-17 07:11:50Z luke $
|