puppet 0.13.6 → 0.16.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 +57 -0
- data/Rakefile +38 -410
- data/bin/puppet +14 -12
- data/bin/puppetca +1 -3
- data/bin/puppetd +25 -7
- data/bin/puppetdoc +161 -104
- data/bin/puppetmasterd +4 -4
- data/conf/epm.list +8 -0
- data/conf/redhat/client.init +6 -1
- data/conf/redhat/no-chuser-0.15.1.patch +38 -0
- data/conf/redhat/puppet.spec +20 -5
- data/conf/redhat/puppetd.conf +1 -1
- data/conf/redhat/puppetmasterd.conf +1 -1
- data/conf/redhat/server.init +2 -4
- data/examples/code/snippets/{casestatement → casestatement.pp} +12 -1
- data/examples/code/snippets/selectorvalues.pp +15 -0
- data/examples/code/snippets/singleselector.pp +22 -0
- data/examples/code/snippets/tag.pp +9 -0
- data/ext/module_puppet +1 -1
- data/install.rb +303 -303
- data/lib/puppet.rb +7 -9
- data/lib/puppet/client.rb +18 -5
- data/lib/puppet/client/dipper.rb +12 -10
- data/lib/puppet/client/master.rb +113 -41
- data/lib/puppet/client/pelement.rb +20 -0
- data/lib/puppet/config.rb +113 -6
- data/lib/puppet/element.rb +1 -3
- data/lib/puppet/event.rb +12 -23
- data/lib/puppet/filetype.rb +93 -5
- data/lib/puppet/inifile.rb +201 -0
- data/lib/puppet/log.rb +18 -6
- data/lib/puppet/parameter.rb +80 -29
- data/lib/puppet/parser/ast.rb +6 -4
- data/lib/puppet/parser/ast/caseopt.rb +13 -4
- data/lib/puppet/parser/ast/casestatement.rb +2 -2
- data/lib/puppet/parser/ast/component.rb +4 -14
- data/lib/puppet/parser/ast/hostclass.rb +1 -1
- data/lib/puppet/parser/ast/leaf.rb +12 -0
- data/lib/puppet/parser/ast/node.rb +4 -4
- data/lib/puppet/parser/ast/objectdef.rb +5 -51
- data/lib/puppet/parser/ast/selector.rb +2 -0
- data/lib/puppet/parser/ast/tag.rb +26 -0
- data/lib/puppet/parser/interpreter.rb +89 -74
- data/lib/puppet/parser/lexer.rb +4 -3
- data/lib/puppet/parser/parser.rb +440 -378
- data/lib/puppet/parser/scope.rb +844 -887
- data/lib/puppet/server.rb +12 -1
- data/lib/puppet/server/authconfig.rb +166 -0
- data/lib/puppet/server/authstore.rb +8 -6
- data/lib/puppet/server/ca.rb +23 -26
- data/lib/puppet/server/filebucket.rb +24 -23
- data/lib/puppet/server/fileserver.rb +116 -47
- data/lib/puppet/server/master.rb +58 -19
- data/lib/puppet/server/pelement.rb +176 -0
- data/lib/puppet/server/rights.rb +78 -0
- data/lib/puppet/server/servlet.rb +19 -6
- data/lib/puppet/sslcertificates.rb +4 -2
- data/lib/puppet/sslcertificates/ca.rb +66 -34
- data/lib/puppet/storage.rb +20 -26
- data/lib/puppet/transaction.rb +49 -92
- data/lib/puppet/type.rb +142 -35
- data/lib/puppet/type/cron.rb +29 -14
- data/lib/puppet/type/exec.rb +92 -35
- data/lib/puppet/type/group.rb +29 -11
- data/lib/puppet/type/nameservice.rb +50 -1
- data/lib/puppet/type/nameservice/netinfo.rb +68 -1
- data/lib/puppet/type/nameservice/objectadd.rb +1 -0
- data/lib/puppet/type/package.rb +150 -109
- data/lib/puppet/type/package/apple.rb +27 -0
- data/lib/puppet/type/package/apt.rb +1 -0
- data/lib/puppet/type/package/darwinport.rb +97 -0
- data/lib/puppet/type/package/dpkg.rb +10 -2
- data/lib/puppet/type/package/freebsd.rb +19 -0
- data/lib/puppet/type/package/{bsd.rb → openbsd.rb} +36 -7
- data/lib/puppet/type/package/ports.rb +98 -0
- data/lib/puppet/type/package/rpm.rb +43 -7
- data/lib/puppet/type/package/sun.rb +53 -36
- data/lib/puppet/type/package/yum.rb +5 -16
- data/lib/puppet/type/parsedtype.rb +41 -29
- data/lib/puppet/type/parsedtype/host.rb +13 -5
- data/lib/puppet/type/parsedtype/mount.rb +250 -0
- data/lib/puppet/type/parsedtype/port.rb +8 -6
- data/lib/puppet/type/pfile.rb +284 -30
- data/lib/puppet/type/pfile/checksum.rb +96 -68
- data/lib/puppet/type/pfile/content.rb +16 -13
- data/lib/puppet/type/pfile/ensure.rb +64 -126
- data/lib/puppet/type/pfile/group.rb +12 -5
- data/lib/puppet/type/pfile/mode.rb +16 -4
- data/lib/puppet/type/pfile/source.rb +47 -73
- data/lib/puppet/type/pfile/target.rb +81 -0
- data/lib/puppet/type/pfile/uid.rb +10 -3
- data/lib/puppet/type/pfilebucket.rb +12 -3
- data/lib/puppet/type/schedule.rb +5 -1
- data/lib/puppet/type/service.rb +138 -66
- data/lib/puppet/type/service/debian.rb +9 -3
- data/lib/puppet/type/service/init.rb +51 -56
- data/lib/puppet/type/service/smf.rb +16 -6
- data/lib/puppet/type/state.rb +71 -32
- data/lib/puppet/type/symlink.rb +12 -7
- data/lib/puppet/type/tidy.rb +5 -1
- data/lib/puppet/type/user.rb +116 -20
- data/lib/puppet/type/yumrepo.rb +314 -0
- data/lib/puppet/util.rb +84 -14
- data/test/client/client.rb +41 -18
- data/test/client/master.rb +50 -4
- data/test/executables/puppetbin.rb +31 -4
- data/test/executables/puppetca.rb +18 -2
- data/test/language/ast.rb +201 -31
- data/test/language/interpreter.rb +8 -2
- data/test/{parser → language}/lexer.rb +1 -1
- data/test/language/node.rb +84 -0
- data/test/{parser → language}/parser.rb +1 -1
- data/test/language/scope.rb +101 -2
- data/test/language/snippets.rb +23 -2
- data/test/other/config.rb +99 -1
- data/test/other/filetype.rb +95 -0
- data/test/other/inifile.rb +114 -0
- data/test/other/log.rb +3 -2
- data/test/other/transactions.rb +55 -10
- data/test/puppet/utiltest.rb +25 -1
- data/test/puppettest.rb +140 -46
- data/test/server/authconfig.rb +56 -0
- data/test/server/bucket.rb +32 -18
- data/test/server/fileserver.rb +75 -30
- data/test/server/master.rb +27 -4
- data/test/server/pelement.rb +298 -0
- data/test/server/rights.rb +41 -0
- data/test/server/server.rb +2 -2
- data/test/tagging/tagging.rb +100 -1
- data/test/types/basic.rb +3 -3
- data/test/types/cron.rb +24 -1
- data/test/types/exec.rb +99 -1
- data/test/types/file.rb +298 -2
- data/test/types/filebucket.rb +4 -15
- data/test/types/filesources.rb +43 -14
- data/test/types/group.rb +1 -13
- data/test/types/mount.rb +277 -0
- data/test/types/package.rb +164 -33
- data/test/types/parameter.rb +107 -0
- data/test/types/port.rb +2 -1
- data/test/types/service.rb +37 -2
- data/test/types/state.rb +92 -0
- data/test/types/symlink.rb +30 -2
- data/test/types/tidy.rb +2 -14
- data/test/types/type.rb +35 -1
- data/test/types/user.rb +110 -1
- data/test/types/yumrepo.rb +95 -0
- metadata +316 -290
- data/test/types/filetype.rb +0 -160
data/bin/puppet
CHANGED
@@ -27,10 +27,6 @@
|
|
27
27
|
# debug::
|
28
28
|
# Enable full debugging.
|
29
29
|
#
|
30
|
-
# extclassfile::
|
31
|
-
# Specify the location of the class file to load. Only affects the
|
32
|
-
# +--loadclasses+ option.
|
33
|
-
#
|
34
30
|
# help::
|
35
31
|
# Print this help message
|
36
32
|
#
|
@@ -74,10 +70,10 @@ end
|
|
74
70
|
|
75
71
|
options = [
|
76
72
|
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
|
77
|
-
[ "--extclassfile", "-e", GetoptLong::REQUIRED_ARGUMENT ],
|
78
73
|
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
|
79
74
|
[ "--logdest", "-l", GetoptLong::REQUIRED_ARGUMENT ],
|
80
|
-
[ "--
|
75
|
+
[ "--execute", "-e", GetoptLong::REQUIRED_ARGUMENT ],
|
76
|
+
[ "--loadclasses", "-L", GetoptLong::NO_ARGUMENT ],
|
81
77
|
[ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
|
82
78
|
[ "--use-nodes", GetoptLong::NO_ARGUMENT ],
|
83
79
|
[ "--version", "-V", GetoptLong::NO_ARGUMENT ]
|
@@ -93,7 +89,8 @@ verbose = false
|
|
93
89
|
noop = false
|
94
90
|
logfile = false
|
95
91
|
loadclasses = false
|
96
|
-
|
92
|
+
|
93
|
+
code = nil
|
97
94
|
|
98
95
|
master = {
|
99
96
|
:Local => true
|
@@ -120,8 +117,8 @@ begin
|
|
120
117
|
verbose = true
|
121
118
|
when "--debug"
|
122
119
|
debug = true
|
123
|
-
when "--
|
124
|
-
|
120
|
+
when "--execute"
|
121
|
+
code = arg
|
125
122
|
when "--loadclasses"
|
126
123
|
loadclasses = true
|
127
124
|
when "--logdest"
|
@@ -170,17 +167,22 @@ end
|
|
170
167
|
Puppet.genconfig
|
171
168
|
Puppet.genmanifest
|
172
169
|
|
173
|
-
|
170
|
+
if code
|
171
|
+
master[:Code] = code
|
172
|
+
else
|
173
|
+
master[:Manifest] = ARGV.shift
|
174
|
+
end
|
174
175
|
|
176
|
+
# Allow users to load the classes that puppetd creates.
|
175
177
|
if loadclasses
|
176
|
-
file =
|
178
|
+
file = Puppet[:classfile]
|
177
179
|
if FileTest.exists?(file)
|
178
180
|
unless FileTest.readable?(file)
|
179
181
|
$stderr.puts "%s is not readable" % file
|
180
182
|
exit(63)
|
181
183
|
end
|
182
184
|
|
183
|
-
master[:Classes] = File.read(file).split(/[\s\n]
|
185
|
+
master[:Classes] = File.read(file).split(/[\s\n]+/)
|
184
186
|
end
|
185
187
|
end
|
186
188
|
|
data/bin/puppetca
CHANGED
@@ -138,8 +138,6 @@ end
|
|
138
138
|
Puppet.genconfig
|
139
139
|
Puppet.genmanifest
|
140
140
|
|
141
|
-
Puppet::Util.chuser
|
142
|
-
|
143
141
|
begin
|
144
142
|
ca = Puppet::SSLCertificates::CA.new()
|
145
143
|
rescue => detail
|
@@ -223,4 +221,4 @@ else
|
|
223
221
|
exit(42)
|
224
222
|
end
|
225
223
|
|
226
|
-
# $Id: puppetca
|
224
|
+
# $Id: puppetca 1111 2006-04-12 17:36:14Z luke $
|
data/bin/puppetd
CHANGED
@@ -10,7 +10,8 @@
|
|
10
10
|
#
|
11
11
|
# puppetd [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose]
|
12
12
|
# [-l|--logdest <syslog|<file>|console>] [--fqdn <host name>]
|
13
|
-
# [-o|--onetime] [-w|--waitforcert <seconds>] [
|
13
|
+
# [-o|--onetime] [-w|--waitforcert <seconds>] [-t|--test]
|
14
|
+
# [--disable] [--enable]
|
14
15
|
#
|
15
16
|
# = Description
|
16
17
|
#
|
@@ -25,6 +26,10 @@
|
|
25
26
|
# Once the client has a signed certificate, it will retrieve its configuration
|
26
27
|
# and apply it.
|
27
28
|
#
|
29
|
+
# The vast majority of options are shared between all Puppet executables and
|
30
|
+
# are documented completely at
|
31
|
+
# http://reductivelabs.com/projects/puppet/documentation.
|
32
|
+
#
|
28
33
|
# = Options
|
29
34
|
#
|
30
35
|
# Note that any configuration parameter that's valid in the configuration file
|
@@ -33,10 +38,6 @@
|
|
33
38
|
#
|
34
39
|
# See the configuration file for the full list of acceptable parameters.
|
35
40
|
#
|
36
|
-
# centrallogging::
|
37
|
-
# Send all produced logs to the central puppetmasterd system. This currently
|
38
|
-
# results in a significant slowdown, so it is not recommended.
|
39
|
-
#
|
40
41
|
# disable::
|
41
42
|
# Disable working on the local system. This puts a lock file in place,
|
42
43
|
# causing +puppetd+ not to work on the system until the lock file is removed.
|
@@ -44,6 +45,9 @@
|
|
44
45
|
# configuration to override the local state until everything is tested and
|
45
46
|
# committed.
|
46
47
|
#
|
48
|
+
# +puppetd+ uses the same lock file while it is running, so no more than one
|
49
|
+
# +puppetd+ process is working at a time.
|
50
|
+
#
|
47
51
|
# +puppetd+ exits after executing this.
|
48
52
|
#
|
49
53
|
# debug::
|
@@ -51,7 +55,8 @@
|
|
51
55
|
#
|
52
56
|
# enable::
|
53
57
|
# Enable working on the local system. This removes any lock file, causing
|
54
|
-
# +puppetd+ to start managing the local system again
|
58
|
+
# +puppetd+ to start managing the local system again (although it will continue
|
59
|
+
# to use its normal scheduling, so it might not start for another half hour).
|
55
60
|
#
|
56
61
|
# +puppetd+ exits after executing this.
|
57
62
|
#
|
@@ -72,6 +77,10 @@
|
|
72
77
|
# Run the configuration once, rather than as a long-running daemon. This is
|
73
78
|
# useful for interactively running puppetd.
|
74
79
|
#
|
80
|
+
# test::
|
81
|
+
# Enable the most common options used for testing. These are +onetime+,
|
82
|
+
# +verbose+, and +no-usecacheonfailure+.
|
83
|
+
#
|
75
84
|
# verbose::
|
76
85
|
# Turn on verbose reporting.
|
77
86
|
#
|
@@ -117,6 +126,7 @@ options = [
|
|
117
126
|
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
|
118
127
|
[ "--logdest", "-l", GetoptLong::REQUIRED_ARGUMENT ],
|
119
128
|
[ "--onetime", "-o", GetoptLong::NO_ARGUMENT ],
|
129
|
+
[ "--test", "-t", GetoptLong::NO_ARGUMENT ],
|
120
130
|
[ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
|
121
131
|
[ "--version", "-V", GetoptLong::NO_ARGUMENT ],
|
122
132
|
[ "--waitforcert", "-w", GetoptLong::REQUIRED_ARGUMENT ]
|
@@ -151,6 +161,14 @@ begin
|
|
151
161
|
disable = true
|
152
162
|
when "--enable"
|
153
163
|
enable = true
|
164
|
+
when "--test"
|
165
|
+
# Enable all of the most common test options.
|
166
|
+
Puppet.config.handlearg("--no-usecacheonfailure")
|
167
|
+
onetime = true
|
168
|
+
unless Puppet::Log.level == :debug
|
169
|
+
Puppet::Log.level = :info
|
170
|
+
end
|
171
|
+
Puppet::Log.newdestination(:console)
|
154
172
|
when "--centrallogging"
|
155
173
|
centrallogs = true
|
156
174
|
when "--help"
|
@@ -301,4 +319,4 @@ else
|
|
301
319
|
Puppet.start
|
302
320
|
end
|
303
321
|
|
304
|
-
# $Id: puppetd
|
322
|
+
# $Id: puppetd 1108 2006-04-11 23:08:48Z luke $
|
data/bin/puppetdoc
CHANGED
@@ -8,19 +8,26 @@
|
|
8
8
|
#
|
9
9
|
# = Usage
|
10
10
|
#
|
11
|
-
# puppetdoc [-h|--help]
|
11
|
+
# puppetdoc [-h|--help] [-a|--arguments] [-t|--types]
|
12
12
|
#
|
13
13
|
# = Description
|
14
14
|
#
|
15
15
|
# This command generates a restructured-text document describing all installed
|
16
|
-
# Puppet types
|
17
|
-
#
|
16
|
+
# Puppet types or all allowable arguments to puppet executables. It is largely
|
17
|
+
# meant for internal use and is used to generate the reference document
|
18
|
+
# available on the Reductive Labs web site.
|
18
19
|
#
|
19
20
|
# = Options
|
20
21
|
#
|
22
|
+
# arguments::
|
23
|
+
# Print the documentation for arguments.
|
24
|
+
#
|
21
25
|
# help::
|
22
26
|
# Print this help message
|
23
27
|
#
|
28
|
+
# types::
|
29
|
+
# Print the argumenst for Puppet types. This is the default.
|
30
|
+
#
|
24
31
|
# = Example
|
25
32
|
#
|
26
33
|
# $ puppetdoc > /tmp/reference.rst
|
@@ -46,6 +53,8 @@ rescue LoadError
|
|
46
53
|
end
|
47
54
|
|
48
55
|
result = GetoptLong.new(
|
56
|
+
[ "--arguments", "-a", GetoptLong::NO_ARGUMENT ],
|
57
|
+
[ "--types", "-t", GetoptLong::NO_ARGUMENT ],
|
49
58
|
[ "--help", "-h", GetoptLong::NO_ARGUMENT ]
|
50
59
|
)
|
51
60
|
|
@@ -53,9 +62,15 @@ debug = false
|
|
53
62
|
|
54
63
|
$tab = " "
|
55
64
|
|
65
|
+
mode = :types
|
66
|
+
|
56
67
|
begin
|
57
68
|
result.each { |opt,arg|
|
58
69
|
case opt
|
70
|
+
when "--arguments"
|
71
|
+
mode = :arguments
|
72
|
+
when "--types"
|
73
|
+
mode = :types
|
59
74
|
when "--help"
|
60
75
|
if $haveusage
|
61
76
|
RDoc::usage && exit
|
@@ -96,22 +111,56 @@ def indent(text, tab)
|
|
96
111
|
return text.gsub(/(^|\A)/, tab).gsub(/^ +\.\./, "..")
|
97
112
|
end
|
98
113
|
|
99
|
-
#
|
100
|
-
|
101
|
-
|
114
|
+
# Print the docs for arguments
|
115
|
+
def self.arguments
|
116
|
+
puts %{
|
117
|
+
===========================
|
118
|
+
Puppet Executable Reference
|
119
|
+
===========================
|
120
|
+
|
121
|
+
Every Puppet executable (with the exception of ``puppetdoc``) accepts all of
|
122
|
+
these arguments, but not all of the arguments make sense for every executable.
|
123
|
+
Each argument has a section listed with it in parentheses; often, that section
|
124
|
+
will map to an executable (e.g., ``puppetd``), in which case it probably only
|
125
|
+
makes sense for that one executable. If ``puppet`` is listed as the section,
|
126
|
+
it is most likely an option that is valid for everyone.
|
127
|
+
|
128
|
+
This will not always be the case. I have tried to be as thorough as possible
|
129
|
+
in the descriptions of the arguments, so it should be obvious whether an
|
130
|
+
argument is approprite or not.
|
131
|
+
|
132
|
+
}
|
133
|
+
|
134
|
+
docs = {}
|
135
|
+
Puppet.config.each do |name, object|
|
136
|
+
docs[name] = object
|
137
|
+
end
|
102
138
|
|
103
|
-
|
139
|
+
docs.sort { |a, b|
|
140
|
+
a[0].to_s <=> b[0].to_s
|
141
|
+
}.each do |name, object|
|
142
|
+
puts "* **#{name.to_s}** (*#{object.section.to_s}*)"
|
143
|
+
puts ""
|
144
|
+
puts " " + object.desc.gsub(/\n/, " ")
|
145
|
+
puts ""
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
149
|
+
|
150
|
+
# Print the docs for types
|
151
|
+
def self.types
|
152
|
+
puts %{
|
104
153
|
==============
|
105
154
|
Type Reference
|
106
155
|
==============
|
107
156
|
|
108
|
-
}
|
157
|
+
}
|
109
158
|
|
110
|
-
types = {}
|
111
|
-
Puppet::Type.eachtype { |type|
|
112
|
-
|
113
|
-
}
|
114
|
-
puts %{
|
159
|
+
types = {}
|
160
|
+
Puppet::Type.eachtype { |type|
|
161
|
+
types[type.name] = type
|
162
|
+
}
|
163
|
+
puts %{
|
115
164
|
---------------
|
116
165
|
Meta-Parameters
|
117
166
|
---------------
|
@@ -121,26 +170,26 @@ Puppet framework itself rather than being part of the implementation of any
|
|
121
170
|
given instance. Thus, any defined metaparameter can be used with any instance
|
122
171
|
in your manifest, including defined components.
|
123
172
|
|
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
173
|
}
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
174
|
+
begin
|
175
|
+
params = []
|
176
|
+
Puppet::Type.eachmetaparam { |param|
|
177
|
+
params << param
|
178
|
+
}
|
179
|
+
|
180
|
+
params.sort { |a,b|
|
181
|
+
a.to_s <=> b.to_s
|
182
|
+
}.each { |param|
|
183
|
+
puts "- **" + param.to_s + "**"
|
184
|
+
#puts tab(1) + Puppet::Type.metaparamdoc(param).scrub.indent($tab)gsub(/\n\s*/,' ')
|
185
|
+
puts indent(scrub(Puppet::Type.metaparamdoc(param)), $tab)
|
186
|
+
}
|
187
|
+
rescue => detail
|
188
|
+
puts "incorrect metaparams: %s" % detail
|
189
|
+
exit(1)
|
190
|
+
end
|
142
191
|
|
143
|
-
puts %{
|
192
|
+
puts %{
|
144
193
|
-----
|
145
194
|
Types
|
146
195
|
-----
|
@@ -167,94 +216,102 @@ Types
|
|
167
216
|
how the instance behaves (e.g., adding a search path for ``exec`` instances
|
168
217
|
or determining recursion on ``file`` instances).
|
169
218
|
|
170
|
-
}
|
219
|
+
}
|
171
220
|
|
172
|
-
types.sort { |a,b|
|
173
|
-
|
174
|
-
}.each { |name,type|
|
175
|
-
|
176
|
-
|
221
|
+
types.sort { |a,b|
|
222
|
+
a.to_s <=> b.to_s
|
223
|
+
}.each { |name,type|
|
224
|
+
next if name == :puppet
|
225
|
+
next if name == :component
|
177
226
|
|
178
|
-
|
227
|
+
puts "
|
179
228
|
|
180
229
|
----------------
|
181
230
|
|
182
231
|
"
|
183
232
|
|
184
|
-
|
233
|
+
puts "
|
185
234
|
%s
|
186
235
|
%s" % [name, "=" * (name.to_s.length + 4)]
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
236
|
+
#String.new('n%s\n') % name.to_s
|
237
|
+
#puts "**" + type.doc.gsub(/\n\s*/, ' ') + "**\n\n"
|
238
|
+
puts scrub(type.doc) + "\n\n"
|
239
|
+
|
240
|
+
#puts tab(1) + "* namevar: %s" % type.namevar
|
241
|
+
docs = {}
|
242
|
+
#puts "%s States\n'''''''''''''''''''''''''''''''" % name.to_s.capitalize
|
243
|
+
type.validstates.sort { |a,b|
|
244
|
+
a.to_s <=> b.to_s
|
245
|
+
}.reject { |sname|
|
246
|
+
state = type.statebyname(sname)
|
247
|
+
state.nodoc
|
248
|
+
}.each { |sname|
|
249
|
+
state = type.statebyname(sname)
|
250
|
+
|
251
|
+
unless state
|
252
|
+
raise "Could not retrieve state %s on type %s" % [sname, type.name]
|
253
|
+
end
|
254
|
+
|
255
|
+
doc = nil
|
256
|
+
str = nil
|
257
|
+
unless doc = state.doc
|
258
|
+
$stderr.puts "No docs for %s[%s]" % [type, sname]
|
259
|
+
next
|
260
|
+
end
|
261
|
+
doc = doc.dup
|
262
|
+
str = doc
|
263
|
+
#puts "A---" + str + "---"
|
264
|
+
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
|
+
|
279
|
+
str = indent(str, $tab)
|
280
|
+
#puts "---" + str + "---"
|
281
|
+
docs[sname] = str
|
282
|
+
#puts "- **%s**" % sname
|
283
|
+
#puts tab(1) + state.doc.gsub(/\n\s*/,' ')
|
284
|
+
}
|
285
|
+
|
286
|
+
puts "\n%s Parameters\n''''''''''''''''''''''''''''''" % name.to_s.capitalize
|
287
|
+
type.parameters.sort { |a,b|
|
288
|
+
a.to_s <=> b.to_s
|
289
|
+
}.each { |name,param|
|
290
|
+
docs[name] = indent(scrub(type.paramdoc(name)), $tab)
|
291
|
+
}
|
292
|
+
|
293
|
+
docs.sort { |a, b|
|
294
|
+
a[0].to_s <=> b[0].to_s
|
295
|
+
}.each { |name, doc|
|
296
|
+
print "- **%s**" % name
|
297
|
+
if type.namevar == name and name != :name
|
298
|
+
puts " (*namevar*)"
|
299
|
+
else
|
300
|
+
puts ""
|
301
|
+
end
|
302
|
+
puts doc
|
303
|
+
}
|
304
|
+
puts "\n"
|
230
305
|
}
|
306
|
+
end
|
231
307
|
|
232
|
-
|
233
|
-
type.parameters.sort { |a,b|
|
234
|
-
a.to_s <=> b.to_s
|
235
|
-
}.each { |name,param|
|
236
|
-
docs[name] = indent(scrub(type.paramdoc(name)), $tab)
|
237
|
-
}
|
238
|
-
|
239
|
-
docs.sort { |a, b|
|
240
|
-
a[0].to_s <=> b[0].to_s
|
241
|
-
}.each { |name, doc|
|
242
|
-
print "- **%s**" % name
|
243
|
-
if type.namevar == name and name != :name
|
244
|
-
puts " (*namevar*)"
|
245
|
-
else
|
246
|
-
puts ""
|
247
|
-
end
|
248
|
-
puts doc
|
249
|
-
}
|
250
|
-
puts "\n"
|
251
|
-
}
|
308
|
+
send(mode)
|
252
309
|
|
253
310
|
puts "
|
254
311
|
|
255
312
|
----------------
|
256
313
|
|
257
314
|
"
|
258
|
-
|
259
315
|
puts "\n*This page autogenerated on %s*" % Time.now
|
260
|
-
|
316
|
+
|
317
|
+
# $Id: puppetdoc 1110 2006-04-11 23:44:36Z luke $
|