puppet 0.24.3 → 0.24.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 +66 -0
- data/Rakefile +8 -0
- data/bin/puppetd +20 -10
- data/bin/puppetmasterd +3 -0
- data/conf/redhat/puppet.spec +1 -1
- data/ext/emacs/puppet-mode.el +132 -70
- data/ext/puppet-test +2 -1
- data/install.rb +70 -0
- data/lib/puppet.rb +1 -1
- data/lib/puppet/defaults.rb +7 -8
- data/lib/puppet/file_serving/configuration/parser.rb +4 -2
- data/lib/puppet/indirector/facts/facter.rb +2 -1
- data/lib/puppet/indirector/node/ldap.rb +2 -1
- data/lib/puppet/indirector/node/plain.rb +7 -0
- data/lib/puppet/indirector/report/processor.rb +2 -1
- data/lib/puppet/indirector/yaml.rb +0 -5
- data/lib/puppet/metatype/evaluation.rb +13 -3
- data/lib/puppet/metatype/metaparams.rb +3 -3
- data/lib/puppet/metatype/providers.rb +2 -9
- data/lib/puppet/network/authstore.rb +2 -1
- data/lib/puppet/network/client.rb +3 -2
- data/lib/puppet/network/client/master.rb +4 -2
- data/lib/puppet/network/handler/fileserver.rb +0 -49
- data/lib/puppet/network/handler/master.rb +1 -1
- data/lib/puppet/network/handler/report.rb +2 -1
- data/lib/puppet/network/http/mongrel/rest.rb +4 -2
- data/lib/puppet/network/http/webrick/rest.rb +5 -3
- data/lib/puppet/network/http_pool.rb +18 -7
- data/lib/puppet/node.rb +1 -1
- data/lib/puppet/node/environment.rb +2 -1
- data/lib/puppet/parser/parser_support.rb +12 -9
- data/lib/puppet/provider/mailalias/aliases.rb +4 -1
- data/lib/puppet/provider/package/openbsd.rb +10 -2
- data/lib/puppet/provider/package/ports.rb +1 -2
- data/lib/puppet/provider/user/useradd.rb +1 -1
- data/lib/puppet/provider/zone/solaris.rb +2 -1
- data/lib/puppet/resource_reference.rb +2 -1
- data/lib/puppet/transportable.rb +28 -20
- data/lib/puppet/type/exec.rb +5 -0
- data/lib/puppet/type/host.rb +2 -1
- data/lib/puppet/type/service.rb +3 -1
- data/lib/puppet/util.rb +2 -1
- data/lib/puppet/util/constant_inflector.rb +2 -1
- data/lib/puppet/util/diff.rb +2 -2
- data/lib/puppet/util/fileparsing.rb +2 -1
- data/lib/puppet/util/settings.rb +26 -23
- data/lib/puppet/util/tagging.rb +2 -1
- data/test/language/parser.rb +1 -0
- data/test/lib/puppettest.rb +6 -1
- data/test/network/client/client.rb +0 -29
- data/test/network/client/master.rb +31 -0
- data/test/network/handler/master.rb +4 -0
- data/test/ral/manager/provider.rb +21 -5
- data/test/ral/providers/cron/crontab.rb +0 -1
- data/test/ral/providers/mailalias/aliases.rb +0 -1
- data/test/ral/providers/sshkey/parsed.rb +0 -1
- data/test/ral/type/tidy.rb +6 -7
- metadata +2 -2
data/CHANGELOG
CHANGED
@@ -1,3 +1,69 @@
|
|
1
|
+
Pass source to pkg_add via the PKG_PATH environment variable if
|
2
|
+
it ends in a '/' indicating it is a directory. Allows pkg_add
|
3
|
+
to resolve dependancies, and make it possible to specify packages
|
4
|
+
without version numbers.
|
5
|
+
|
6
|
+
Fixing #571 -- provider suitability is now checked at resource
|
7
|
+
evaluation time, rather than resource instantiation time. This
|
8
|
+
means that you don't catch your "errors" as early, but it also
|
9
|
+
means you should be able to realistically configure a whole host
|
10
|
+
in one run.
|
11
|
+
|
12
|
+
Moved the configuration of the Node cache to the puppetmasterd
|
13
|
+
executable, since it otherwise causes caches to be used in all
|
14
|
+
cases, which we don't want (e.g., bin/puppet was using them).
|
15
|
+
|
16
|
+
Ported #198 man page creation functionality to 0.24.x branch and
|
17
|
+
added man pages and man page creation logic to install.rb. The
|
18
|
+
man pages are stored in man/man8 and will install to config::CONFIG
|
19
|
+
mandir/man8.
|
20
|
+
|
21
|
+
Fixing #1138 -- the yamldir is automatically created by the
|
22
|
+
server now that it's in the :puppetmasterd section rather than
|
23
|
+
a separate :yaml section.
|
24
|
+
|
25
|
+
Disabling http keep-alive as a means of preventing #1010.
|
26
|
+
There is now a constant in Puppet::Network::HttpPool that will
|
27
|
+
disable or enable this feature, but note that we determined
|
28
|
+
that it can cause corruption, especially in file serving (but
|
29
|
+
it's client-side corruption).
|
30
|
+
|
31
|
+
Applying patch by Ryan McBride to fix OpenBSD package
|
32
|
+
matching. The actual problem was caused by the fix to #1001.
|
33
|
+
|
34
|
+
Found all instances of methods where split() is used without
|
35
|
+
any local variables and added a local variable -- see
|
36
|
+
http://snurl.com/21zf8. My own testing showed that this
|
37
|
+
caused memory growth to level off at a reasonable level.
|
38
|
+
Note that the link above says the problem is only with class
|
39
|
+
methods, but my own testing showed that it's any method that
|
40
|
+
meets these criteria. This is not a functional change, but
|
41
|
+
should hopefully be the last nail in the coffin of #1131.
|
42
|
+
|
43
|
+
Found an array that leaked pretty quickly between reparsing
|
44
|
+
files, thanks to work by Adam Jacob and Arjuna Christenson
|
45
|
+
(the finding, not the leak). I'm going to act like this
|
46
|
+
fixes #1131, at least for now, but I doubt it does,
|
47
|
+
since that shows general memory growth over time, whereas
|
48
|
+
the leak here should go away as soon as files are reparsed
|
49
|
+
(because the parser is holding the reference to the leaking
|
50
|
+
array).
|
51
|
+
|
52
|
+
Fixed #1147: Cached nodes are correctly considered out of
|
53
|
+
date if the node facts have been updated (thus causing
|
54
|
+
node facts to again be available in manifests, for those
|
55
|
+
cases where they were not).
|
56
|
+
|
57
|
+
Fixed #1137: The certificate name is correctly being added
|
58
|
+
to the facts hash.
|
59
|
+
|
60
|
+
Fixed #1136: Verbose and Debug no longer clobber each other.
|
61
|
+
|
62
|
+
Hopefully *finally* fixed the "already being managed" problem
|
63
|
+
(#1036). The problem only cropped up if there was a failure
|
64
|
+
when trying to manage the system -- this would cause the
|
65
|
+
setting-based resources not to get cleaned up.
|
66
|
+
|
1
67
|
0.24.3
|
2
68
|
Modified the ldap node terminus to also use the facts version
|
3
69
|
as the version for a node, which should similarly encourage the
|
data/Rakefile
CHANGED
@@ -134,3 +134,11 @@ task :dailyclean do
|
|
134
134
|
File.unlink(file)
|
135
135
|
end
|
136
136
|
end
|
137
|
+
|
138
|
+
task :tracdocs do
|
139
|
+
require 'puppet'
|
140
|
+
require 'puppet/util/reference'
|
141
|
+
Puppet::Util::Reference.references.each do |ref|
|
142
|
+
sh "puppetdoc -m trac -r #{ref.to_s}"
|
143
|
+
end
|
144
|
+
end
|
data/bin/puppetd
CHANGED
@@ -188,6 +188,8 @@ args = {}
|
|
188
188
|
options = {
|
189
189
|
:waitforcert => 120, # Default to checking for certs every 5 minutes
|
190
190
|
:onetime => false,
|
191
|
+
:verbose => false,
|
192
|
+
:debug => false,
|
191
193
|
:centrallogs => false,
|
192
194
|
:setdest => false,
|
193
195
|
:enable => false,
|
@@ -228,11 +230,9 @@ begin
|
|
228
230
|
puts "%s" % Puppet.version
|
229
231
|
exit
|
230
232
|
when "--verbose"
|
231
|
-
|
232
|
-
Puppet::Util::Log.newdestination(:console)
|
233
|
+
options[:verbose] = true
|
233
234
|
when "--debug"
|
234
|
-
|
235
|
-
Puppet::Util::Log.newdestination(:console)
|
235
|
+
options[:debug] = true
|
236
236
|
when "--fqdn"
|
237
237
|
options[:fqdn] = arg
|
238
238
|
when "--no-client"
|
@@ -247,6 +247,9 @@ begin
|
|
247
247
|
Puppet::Util::Log.newdestination(arg)
|
248
248
|
options[:setdest] = true
|
249
249
|
rescue => detail
|
250
|
+
if Puppet[:debug]
|
251
|
+
puts detail.backtrace
|
252
|
+
end
|
250
253
|
$stderr.puts detail.to_s
|
251
254
|
end
|
252
255
|
when "--waitforcert"
|
@@ -272,12 +275,23 @@ if options[:test]
|
|
272
275
|
Puppet.settings.handlearg("--no-splay")
|
273
276
|
Puppet.settings.handlearg("--show_diff")
|
274
277
|
Puppet.settings.handlearg("--no-daemonize")
|
278
|
+
options[:verbose] = true
|
275
279
|
options[:onetime] = true
|
276
280
|
options[:waitforcert] = 0
|
277
|
-
|
281
|
+
end
|
282
|
+
|
283
|
+
# Handle the logging settings.
|
284
|
+
if options[:debug] or options[:verbose]
|
285
|
+
Puppet::Util::Log.newdestination(:console)
|
286
|
+
if options[:debug]
|
287
|
+
Puppet::Util::Log.level = :debug
|
288
|
+
else
|
278
289
|
Puppet::Util::Log.level = :info
|
279
290
|
end
|
280
|
-
|
291
|
+
end
|
292
|
+
|
293
|
+
unless options[:setdest]
|
294
|
+
Puppet::Util::Log.newdestination(:syslog)
|
281
295
|
end
|
282
296
|
|
283
297
|
Puppet.genconfig
|
@@ -288,10 +302,6 @@ if Puppet[:noop]
|
|
288
302
|
Puppet[:show_diff] = true
|
289
303
|
end
|
290
304
|
|
291
|
-
unless options[:setdest]
|
292
|
-
Puppet::Util::Log.newdestination(:syslog)
|
293
|
-
end
|
294
|
-
|
295
305
|
args[:Server] = Puppet[:server]
|
296
306
|
if options[:fqdn]
|
297
307
|
args[:FQDN] = options[:fqdn]
|
data/bin/puppetmasterd
CHANGED
@@ -188,6 +188,9 @@ Puppet.genmanifest
|
|
188
188
|
# A temporary solution, to at least make the master work for now.
|
189
189
|
Puppet::Node::Facts.terminus_class = :yaml
|
190
190
|
|
191
|
+
# Cache our nodes in yaml. Currently not configurable.
|
192
|
+
Puppet::Node.cache_class = :yaml
|
193
|
+
|
191
194
|
require 'etc'
|
192
195
|
|
193
196
|
handlers = {
|
data/conf/redhat/puppet.spec
CHANGED
data/ext/emacs/puppet-mode.el
CHANGED
@@ -89,46 +89,108 @@
|
|
89
89
|
(make-local-variable 'paragraph-ignore-fill-prefix)
|
90
90
|
(setq paragraph-ignore-fill-prefix t))
|
91
91
|
|
92
|
+
(defun puppet-comment-line-p ()
|
93
|
+
"Return non-nil iff this line is a comment."
|
94
|
+
(save-excursion
|
95
|
+
(beginning-of-line)
|
96
|
+
(looking-at (format "\\s-*%s" comment-start))))
|
97
|
+
|
98
|
+
(defun puppet-in-array ()
|
99
|
+
"If point is in an array, return the position of the opening '[' of
|
100
|
+
that array, else return nil."
|
101
|
+
(save-excursion
|
102
|
+
(save-match-data
|
103
|
+
(let ((opoint (point))
|
104
|
+
(apoint (search-backward "[" nil t)))
|
105
|
+
(when apoint
|
106
|
+
;; An array opens before point. If it doesn't close before
|
107
|
+
;; point, then point must be in it.
|
108
|
+
;; ### TODO: of course, the '[' could be in a string literal,
|
109
|
+
;; ### in which case this whole idea is bogus. But baby
|
110
|
+
;; ### steps, baby steps. A more robust strategy might be
|
111
|
+
;; ### to walk backwards by sexps, until hit a wall, then
|
112
|
+
;; ### inspect the nature of that wall.
|
113
|
+
(if (= (count-matches "\\]" apoint opoint) 0)
|
114
|
+
apoint))))))
|
115
|
+
|
92
116
|
(defun puppet-indent-line ()
|
93
117
|
"Indent current line as puppet code."
|
94
118
|
(interactive)
|
95
119
|
(beginning-of-line)
|
96
120
|
(if (bobp)
|
97
121
|
(indent-line-to 0) ; First line is always non-indented
|
98
|
-
(let ((not-indented t)
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
122
|
+
(let ((not-indented t)
|
123
|
+
(array-start (puppet-in-array))
|
124
|
+
cur-indent)
|
125
|
+
(cond
|
126
|
+
(array-start
|
127
|
+
;; This line probably starts with an element from an array.
|
128
|
+
;; Indent the line to the same indentation as the first
|
129
|
+
;; element in that array. That is, this...
|
130
|
+
;;
|
131
|
+
;; exec {
|
132
|
+
;; "add_puppetmaster_mongrel_startup_links":
|
133
|
+
;; command => "string1",
|
134
|
+
;; creates => [ "string2", "string3",
|
135
|
+
;; "string4", "string5",
|
136
|
+
;; "string6", "string7",
|
137
|
+
;; "string3" ],
|
138
|
+
;; refreshonly => true,
|
139
|
+
;; }
|
140
|
+
;;
|
141
|
+
;; ...should instead look like this:
|
142
|
+
;;
|
143
|
+
;; exec {
|
144
|
+
;; "add_puppetmaster_mongrel_startup_links":
|
145
|
+
;; command => "string1",
|
146
|
+
;; creates => [ "string2", "string3",
|
147
|
+
;; "string4", "string5",
|
148
|
+
;; "string6", "string7",
|
149
|
+
;; "string8" ],
|
150
|
+
;; refreshonly => true,
|
151
|
+
;; }
|
152
|
+
(save-excursion
|
153
|
+
(goto-char array-start)
|
154
|
+
(forward-char 1)
|
155
|
+
(re-search-forward "\\S-")
|
156
|
+
(forward-char -1)
|
157
|
+
(setq cur-indent (current-column))))
|
158
|
+
((looking-at "^[^{\n]*}")
|
159
|
+
;; This line contains the end of a block, but the block does
|
160
|
+
;; not also begin on this line, so decrease the indentation.
|
161
|
+
(save-excursion
|
162
|
+
(forward-line -1)
|
163
|
+
(if (looking-at "^.*}")
|
164
|
+
(progn
|
165
|
+
(setq cur-indent (- (current-indentation) 2))
|
166
|
+
(setq not-indented nil))
|
167
|
+
(setq cur-indent (- (current-indentation) 2))))
|
168
|
+
(if (< cur-indent 0) ; We can't indent past the left margin
|
169
|
+
(setq cur-indent 0)))
|
170
|
+
(t
|
171
|
+
;; Otherwise, we did not start on a block-ending-only line.
|
172
|
+
(save-excursion
|
173
|
+
;; Iterate backwards until we find an indentation hint
|
174
|
+
(while not-indented
|
175
|
+
(forward-line -1)
|
176
|
+
(cond
|
177
|
+
((puppet-comment-line-p)
|
178
|
+
(if (bobp)
|
179
|
+
(setq not-indented nil)
|
180
|
+
;; else ignore the line and continue iterating backwards
|
181
|
+
))
|
182
|
+
((looking-at "^.*}") ; indent at the level of the END_ token
|
183
|
+
(setq cur-indent (current-indentation))
|
184
|
+
(setq not-indented nil))
|
185
|
+
((looking-at "^.*{") ; indent an extra level
|
186
|
+
(setq cur-indent (+ (current-indentation) 2))
|
187
|
+
(setq not-indented nil))
|
188
|
+
((bobp)
|
189
|
+
(setq not-indented nil))
|
190
|
+
)))))
|
129
191
|
(if cur-indent
|
130
|
-
|
131
|
-
|
192
|
+
(indent-line-to cur-indent)
|
193
|
+
(indent-line-to 0)))))
|
132
194
|
|
133
195
|
|
134
196
|
;;;###autoload
|
@@ -155,31 +217,31 @@ The variable puppet-indent-level controls the amount of indentation.
|
|
155
217
|
(setq font-lock-variable-name-face font-lock-type-face))
|
156
218
|
|
157
219
|
(setq puppet-font-lock-syntactic-keywords
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
220
|
+
'(
|
221
|
+
("\\(^\\|[=(,~?:;]\\|\\(^\\|\\s \\)\\(if\\|elsif\\|unless\\|while\\|until\\|when\\|and\\|or\\|&&\\|||\\)\\|g?sub!?\\|scan\\|split!?\\)\\s *\\(/\\)[^/\n\\\\]*\\(\\\\.[^/\n\\\\]*\\)*\\(/\\)"
|
222
|
+
(4 (7 . ?/))
|
223
|
+
(6 (7 . ?/)))
|
224
|
+
("^\\(=\\)begin\\(\\s \\|$\\)" 1 (7 . nil))
|
225
|
+
("^\\(=\\)end\\(\\s \\|$\\)" 1 (7 . nil))))
|
164
226
|
|
165
227
|
(cond ((featurep 'xemacs)
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
228
|
+
(put 'puppet-mode 'font-lock-defaults
|
229
|
+
'((puppet-font-lock-keywords)
|
230
|
+
nil nil nil
|
231
|
+
beginning-of-line
|
232
|
+
(font-lock-syntactic-keywords
|
233
|
+
. puppet-font-lock-syntactic-keywords))))
|
234
|
+
(t
|
235
|
+
(add-hook 'puppet-mode-hook
|
236
|
+
'(lambda ()
|
237
|
+
(make-local-variable 'font-lock-defaults)
|
238
|
+
(make-local-variable 'font-lock-keywords)
|
239
|
+
(make-local-variable 'font-lock-syntax-table)
|
240
|
+
(make-local-variable 'font-lock-syntactic-keywords)
|
241
|
+
(setq font-lock-defaults '((puppet-font-lock-keywords) nil nil))
|
242
|
+
(setq font-lock-keywords puppet-font-lock-keywords)
|
243
|
+
(setq font-lock-syntax-table puppet-font-lock-syntax-table)
|
244
|
+
(setq font-lock-syntactic-keywords puppet-font-lock-syntactic-keywords)))))
|
183
245
|
|
184
246
|
(defvar puppet-font-lock-syntax-table
|
185
247
|
(let* ((tbl (copy-syntax-table puppet-mode-syntax-table)))
|
@@ -196,23 +258,23 @@ The variable puppet-indent-level controls the amount of indentation.
|
|
196
258
|
1 font-lock-reference-face)
|
197
259
|
;; keywords
|
198
260
|
(cons (concat
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
261
|
+
"\\b\\(\\("
|
262
|
+
(mapconcat
|
263
|
+
'identity
|
264
|
+
'("case"
|
203
265
|
"class"
|
204
266
|
"default"
|
205
267
|
"define"
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
268
|
+
"false"
|
269
|
+
"import"
|
270
|
+
"include"
|
271
|
+
"inherits"
|
272
|
+
"node"
|
273
|
+
"true"
|
274
|
+
)
|
275
|
+
"\\|")
|
276
|
+
"\\)\\>\\)")
|
277
|
+
1)
|
216
278
|
;; variables
|
217
279
|
'("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(nil\\|self\\|true\\|false\\)\\>"
|
218
280
|
2 font-lock-variable-name-face)
|
data/ext/puppet-test
CHANGED
@@ -216,10 +216,11 @@ end
|
|
216
216
|
|
217
217
|
Suite.new :local_catalog, "Local catalog handling" do
|
218
218
|
def prepare
|
219
|
+
@node = Puppet::Node.find(Puppet[:certname])
|
219
220
|
end
|
220
221
|
|
221
222
|
newtest :compile, "Compiled catalog" do
|
222
|
-
Puppet::Node::Catalog.find(
|
223
|
+
Puppet::Node::Catalog.find(@node)
|
223
224
|
end
|
224
225
|
end
|
225
226
|
|
data/install.rb
CHANGED
@@ -47,6 +47,18 @@ rescue LoadError
|
|
47
47
|
$haverdoc = false
|
48
48
|
end
|
49
49
|
|
50
|
+
begin
|
51
|
+
if $haverdoc
|
52
|
+
rst2man = %x{which rst2man.py}
|
53
|
+
$haveman = true
|
54
|
+
else
|
55
|
+
$haveman = false
|
56
|
+
end
|
57
|
+
rescue
|
58
|
+
puts "Missing rst2man; skipping man page creation"
|
59
|
+
$haveman = false
|
60
|
+
end
|
61
|
+
|
50
62
|
PREREQS = %w{openssl facter xmlrpc/client xmlrpc/server cgi}
|
51
63
|
|
52
64
|
InstallOptions = OpenStruct.new
|
@@ -64,6 +76,7 @@ sbins = glob(%w{sbin/*})
|
|
64
76
|
bins = glob(%w{bin/*})
|
65
77
|
rdoc = glob(%w{bin/* sbin/* lib/**/*.rb README README-library CHANGELOG TODO Install}).reject { |e| e=~ /\.(bat|cmd)$/ }
|
66
78
|
ri = glob(%w(bin/*.rb sbin/* lib/**/*.rb)).reject { |e| e=~ /\.(bat|cmd)$/ }
|
79
|
+
man = glob(%w{man/man8/*})
|
67
80
|
libs = glob(%w{lib/**/*.rb lib/**/*.py})
|
68
81
|
tests = glob(%w{tests/**/*.rb})
|
69
82
|
|
@@ -84,6 +97,19 @@ def do_libs(libs, strip = 'lib/')
|
|
84
97
|
end
|
85
98
|
end
|
86
99
|
|
100
|
+
def do_man(man, strip = 'man/')
|
101
|
+
man.each do |mf|
|
102
|
+
omf = File.join(InstallOptions.man_dir, mf.gsub(/#{strip}/, ''))
|
103
|
+
om = File.dirname(omf)
|
104
|
+
File.makedirs(om, true)
|
105
|
+
File.chmod(0644, om)
|
106
|
+
File.install(mf, omf, 0644, true)
|
107
|
+
gzip = %x{which gzip}
|
108
|
+
gzip.chomp!
|
109
|
+
%x{#{gzip} #{omf}}
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
87
113
|
# Verify that all of the prereqs are installed
|
88
114
|
def check_prereqs
|
89
115
|
PREREQS.each { |pre|
|
@@ -112,6 +138,17 @@ def prepare_installation
|
|
112
138
|
InstallOptions.rdoc = false
|
113
139
|
InstallOptions.ri = false
|
114
140
|
end
|
141
|
+
|
142
|
+
|
143
|
+
if $haveman
|
144
|
+
InstallOptions.man = true
|
145
|
+
if RUBY_PLATFORM == "i386-mswin32"
|
146
|
+
InstallOptions.man = false
|
147
|
+
end
|
148
|
+
else
|
149
|
+
InstallOptions.man = false
|
150
|
+
end
|
151
|
+
|
115
152
|
InstallOptions.tests = true
|
116
153
|
|
117
154
|
ARGV.options do |opts|
|
@@ -123,6 +160,9 @@ def prepare_installation
|
|
123
160
|
opts.on('--[no-]ri', 'Prevents the creation of RI output.', 'Default off on mswin32.') do |onri|
|
124
161
|
InstallOptions.ri = onri
|
125
162
|
end
|
163
|
+
opts.on('--[no-]man', 'Presents the creation of man pages.', 'Default on.') do |onman|
|
164
|
+
InstallOptions.man = onman
|
165
|
+
end
|
126
166
|
opts.on('--[no-]tests', 'Prevents the execution of unit tests.', 'Default on.') do |ontest|
|
127
167
|
InstallOptions.tests = ontest
|
128
168
|
end
|
@@ -163,15 +203,18 @@ def prepare_installation
|
|
163
203
|
if (destdir = ENV['DESTDIR'])
|
164
204
|
bindir = "#{destdir}#{Config::CONFIG['bindir']}"
|
165
205
|
sbindir = "#{destdir}#{Config::CONFIG['sbindir']}"
|
206
|
+
mandir = "#{destdir}#{Config::CONFIG['mandir']}"
|
166
207
|
sitelibdir = "#{destdir}#{sitelibdir}"
|
167
208
|
tmpdirs << bindir
|
168
209
|
|
169
210
|
FileUtils.makedirs(bindir)
|
170
211
|
FileUtils.makedirs(sbindir)
|
212
|
+
FileUtils.makedirs(mandir)
|
171
213
|
FileUtils.makedirs(sitelibdir)
|
172
214
|
else
|
173
215
|
bindir = Config::CONFIG['bindir']
|
174
216
|
sbindir = Config::CONFIG['sbindir']
|
217
|
+
mandir = Config::CONFIG['mandir']
|
175
218
|
tmpdirs << Config::CONFIG['bindir']
|
176
219
|
end
|
177
220
|
|
@@ -180,6 +223,7 @@ def prepare_installation
|
|
180
223
|
InstallOptions.bin_dir = bindir
|
181
224
|
InstallOptions.sbin_dir = sbindir
|
182
225
|
InstallOptions.lib_dir = libdir
|
226
|
+
InstallOptions.man_dir = mandir
|
183
227
|
end
|
184
228
|
|
185
229
|
##
|
@@ -212,6 +256,30 @@ def build_ri(files)
|
|
212
256
|
end
|
213
257
|
end
|
214
258
|
|
259
|
+
def build_man(bins)
|
260
|
+
return unless $haveman
|
261
|
+
begin
|
262
|
+
# Locate rst2man
|
263
|
+
rst2man = %x{which rst2man.py}
|
264
|
+
rst2man.chomp!
|
265
|
+
# Create puppet.conf.8 man page
|
266
|
+
%x{bin/puppetdoc --reference configuration > ./puppet.conf.rst}
|
267
|
+
%x{#{rst2man} ./puppet.conf.rst ./man/man8/puppet.conf.8}
|
268
|
+
File.unlink("./puppet.conf.rst")
|
269
|
+
|
270
|
+
# Create binary man pages
|
271
|
+
bins.each do |bin|
|
272
|
+
b = bin.gsub( "bin/", "")
|
273
|
+
%x{#{bin} --help > ./#{b}.rst}
|
274
|
+
%x{#{rst2man} ./#{b}.rst ./man/man8/#{b}.8}
|
275
|
+
File.unlink("./#{b}.rst")
|
276
|
+
end
|
277
|
+
rescue SystemCallError
|
278
|
+
$stderr.puts "Couldn't build man pages: " + $!
|
279
|
+
$stderr.puts "Continuing with install..."
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
215
283
|
def run_tests(test_list)
|
216
284
|
begin
|
217
285
|
require 'test/unit/ui/console/testrunner'
|
@@ -309,6 +377,8 @@ prepare_installation
|
|
309
377
|
run_tests(tests) if InstallOptions.tests
|
310
378
|
#build_rdoc(rdoc) if InstallOptions.rdoc
|
311
379
|
#build_ri(ri) if InstallOptions.ri
|
380
|
+
#build_man(bins) if InstallOptions.man
|
312
381
|
do_bins(sbins, InstallOptions.sbin_dir)
|
313
382
|
do_bins(bins, InstallOptions.bin_dir)
|
314
383
|
do_libs(libs)
|
384
|
+
do_man(man)
|