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/lib/puppet/type/exec.rb
CHANGED
@@ -13,7 +13,7 @@ module Puppet
|
|
13
13
|
share their commands with other instances as a dependency, since
|
14
14
|
Puppet has no way of knowing which instance you mean.
|
15
15
|
|
16
|
-
For example
|
16
|
+
For example:
|
17
17
|
|
18
18
|
# defined in the production class
|
19
19
|
exec { \"make\":
|
@@ -47,8 +47,8 @@ module Puppet
|
|
47
47
|
require 'open3'
|
48
48
|
require 'puppet/type/state'
|
49
49
|
|
50
|
-
# Create a new check mechanism. It's basically just a parameter that
|
51
|
-
# one extra 'check' method.
|
50
|
+
# Create a new check mechanism. It's basically just a parameter that
|
51
|
+
# provides one extra 'check' method.
|
52
52
|
def self.newcheck(name, &block)
|
53
53
|
@checks ||= {}
|
54
54
|
|
@@ -268,7 +268,7 @@ module Puppet
|
|
268
268
|
desc "The command should only be run as a
|
269
269
|
refresh mechanism for when a dependent object is changed. It only
|
270
270
|
makes sense to use this option when this command depends on some
|
271
|
-
other object; it is useful for triggering an action
|
271
|
+
other object; it is useful for triggering an action:
|
272
272
|
|
273
273
|
# Pull down the main aliases file
|
274
274
|
file { \"/etc/aliases\":
|
@@ -278,11 +278,12 @@ module Puppet
|
|
278
278
|
# Rebuild the database, but only when the file changes
|
279
279
|
exec { newaliases:
|
280
280
|
path => [\"/usr/bin\", \"/usr/sbin\"],
|
281
|
-
|
281
|
+
subscribe => file[\"/etc/aliases\"],
|
282
282
|
refreshonly => true
|
283
283
|
}
|
284
284
|
|
285
|
-
|
285
|
+
Note that only ``subscribe`` can trigger actions, not ``require``,
|
286
|
+
so it only makes sense to use ``refreshonly`` with ``subscribe``."
|
286
287
|
|
287
288
|
newvalues(:true, :false)
|
288
289
|
|
@@ -297,8 +298,6 @@ module Puppet
|
|
297
298
|
desc "A file that this command creates. If this
|
298
299
|
parameter is provided, then the command will only be run
|
299
300
|
if the specified file does not exist.
|
300
|
-
|
301
|
-
::
|
302
301
|
|
303
302
|
exec { \"tar xf /my/tar/file.tar\":
|
304
303
|
cwd => \"/var/tmp\",
|
@@ -330,16 +329,16 @@ module Puppet
|
|
330
329
|
end
|
331
330
|
|
332
331
|
newcheck(:unless) do
|
333
|
-
desc "If this parameter is set, then this
|
334
|
-
the command returns 0. For example
|
332
|
+
desc "If this parameter is set, then this ``exec`` will run unless
|
333
|
+
the command returns 0. For example:
|
335
334
|
|
336
335
|
exec { \"/bin/echo root >> /usr/lib/cron/cron.allow\":
|
337
336
|
path => \"/usr/bin:/usr/sbin:/bin\",
|
338
337
|
unless => \"grep root /usr/lib/cron/cron.allow 2>/dev/null\"
|
339
338
|
}
|
340
339
|
|
341
|
-
This would add
|
342
|
-
|
340
|
+
This would add ``root`` to the cron.allow file (on Solaris) unless
|
341
|
+
``grep`` determines it's already there.
|
343
342
|
|
344
343
|
Note that this command follows the same rules as the main command,
|
345
344
|
which is to say that it must be fully qualified if the path is not set.
|
@@ -362,15 +361,15 @@ module Puppet
|
|
362
361
|
end
|
363
362
|
|
364
363
|
newcheck(:onlyif) do
|
365
|
-
desc "If this parameter is set, then this
|
366
|
-
the command returns 0. For example
|
364
|
+
desc "If this parameter is set, then this ``exec`` will only run if
|
365
|
+
the command returns 0. For example:
|
367
366
|
|
368
367
|
exec { \"logrotate\":
|
369
368
|
path => \"/usr/bin:/usr/sbin:/bin\",
|
370
369
|
onlyif => \"test `du /var/log/messages | cut -f1` -gt 100000\"
|
371
370
|
}
|
372
371
|
|
373
|
-
This would run
|
372
|
+
This would run ``logrotate`` only if that test returned true.
|
374
373
|
|
375
374
|
Note that this command follows the same rules as the main command,
|
376
375
|
which is to say that it must be fully qualified if the path is not set.
|
@@ -542,4 +541,4 @@ module Puppet
|
|
542
541
|
end
|
543
542
|
end
|
544
543
|
|
545
|
-
# $Id: exec.rb
|
544
|
+
# $Id: exec.rb 1422 2006-07-22 03:32:56Z luke $
|
data/lib/puppet/type/group.rb
CHANGED
@@ -171,6 +171,14 @@ module Puppet
|
|
171
171
|
isnamevar
|
172
172
|
end
|
173
173
|
|
174
|
+
newparam(:allowdupe) do
|
175
|
+
desc "Whether to allow duplicate GIDs."
|
176
|
+
|
177
|
+
newvalues(:true, :false)
|
178
|
+
|
179
|
+
defaultto false
|
180
|
+
end
|
181
|
+
|
174
182
|
# List all groups
|
175
183
|
def self.listbyname
|
176
184
|
groups = []
|
@@ -222,4 +230,4 @@ module Puppet
|
|
222
230
|
end
|
223
231
|
end
|
224
232
|
|
225
|
-
# $Id: group.rb
|
233
|
+
# $Id: group.rb 1416 2006-07-21 19:05:30Z luke $
|
@@ -25,9 +25,7 @@ class Type
|
|
25
25
|
|
26
26
|
next unless obj # In case there was an error somewhere
|
27
27
|
|
28
|
-
obj.retrieve
|
29
|
-
|
30
|
-
|
28
|
+
#obj.retrieve
|
31
29
|
obj
|
32
30
|
end
|
33
31
|
end
|
@@ -120,7 +118,6 @@ class State
|
|
120
118
|
# cases.
|
121
119
|
def retrieve
|
122
120
|
if obj = @parent.getinfo(true)
|
123
|
-
|
124
121
|
if method = self.class.posixmethod || self.class.name
|
125
122
|
@is = obj.send(method)
|
126
123
|
else
|
@@ -264,4 +261,4 @@ else
|
|
264
261
|
end
|
265
262
|
|
266
263
|
|
267
|
-
# $Id: nameservice.rb
|
264
|
+
# $Id: nameservice.rb 1156 2006-05-01 01:07:47Z luke $
|
@@ -82,6 +82,8 @@ module Puppet
|
|
82
82
|
end
|
83
83
|
|
84
84
|
# Retrieve the data, yo.
|
85
|
+
# FIXME This should retrieve as much information as possible,
|
86
|
+
# rather than retrieving it one at a time.
|
85
87
|
def retrieve
|
86
88
|
NetInfo.flush
|
87
89
|
dir = @parent.class.netinfodir
|
@@ -144,6 +146,7 @@ module Puppet
|
|
144
146
|
# This is really lame. We have to iterate over each
|
145
147
|
# of the groups and add us to them.
|
146
148
|
def setgrouplist(groups)
|
149
|
+
groups = groups.split(/\s*,\s*/)
|
147
150
|
# Get just the groups we need to modify
|
148
151
|
diff = groups - @is
|
149
152
|
|
@@ -65,6 +65,9 @@ module Puppet
|
|
65
65
|
cmd << @parent.state(:gid).class.objectaddflag << gid
|
66
66
|
end
|
67
67
|
end
|
68
|
+
if @parent[:allowdupe] == :true
|
69
|
+
cmd << "-o"
|
70
|
+
end
|
68
71
|
cmd << @parent[:name]
|
69
72
|
|
70
73
|
return cmd.join(" ")
|
@@ -75,12 +78,15 @@ module Puppet
|
|
75
78
|
end
|
76
79
|
|
77
80
|
def modifycmd
|
78
|
-
[
|
79
|
-
"groupmod",
|
81
|
+
cmd = ["groupmod",
|
80
82
|
self.class.objectaddflag,
|
81
|
-
"'%s'" % self.should
|
82
|
-
|
83
|
-
|
83
|
+
"'%s'" % self.should]
|
84
|
+
if @parent[:allowdupe] == :true
|
85
|
+
cmd << "-o"
|
86
|
+
end
|
87
|
+
cmd << @parent[:name]
|
88
|
+
|
89
|
+
return cmd.join(" ")
|
84
90
|
end
|
85
91
|
end
|
86
92
|
|
@@ -110,6 +116,10 @@ module Puppet
|
|
110
116
|
cmd << "-M"
|
111
117
|
else
|
112
118
|
end
|
119
|
+
if @parent[:allowdupe] == :true
|
120
|
+
cmd << "-o"
|
121
|
+
end
|
122
|
+
|
113
123
|
cmd << @parent[:name]
|
114
124
|
|
115
125
|
cmd.join(" ")
|
@@ -120,12 +130,15 @@ module Puppet
|
|
120
130
|
end
|
121
131
|
|
122
132
|
def modifycmd
|
123
|
-
cmd = [
|
124
|
-
"usermod",
|
133
|
+
cmd = ["usermod",
|
125
134
|
self.class.objectaddflag,
|
126
|
-
"'%s'" % self.should
|
127
|
-
|
128
|
-
|
135
|
+
"'%s'" % self.should]
|
136
|
+
if @parent[:allowdupe] == :true
|
137
|
+
cmd << "-o"
|
138
|
+
end
|
139
|
+
cmd << @parent[:name]
|
140
|
+
|
141
|
+
return cmd.join(" ")
|
129
142
|
end
|
130
143
|
end
|
131
144
|
end
|
@@ -37,6 +37,12 @@ module Puppet
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
# Apparently, contrary to the man page, groupadd does
|
41
|
+
# not accept -o.
|
42
|
+
#if @parent[:allowdupe] == :true
|
43
|
+
# cmd << "-o"
|
44
|
+
#end
|
45
|
+
|
40
46
|
return cmd.join(" ")
|
41
47
|
end
|
42
48
|
|
@@ -45,13 +51,14 @@ module Puppet
|
|
45
51
|
end
|
46
52
|
|
47
53
|
def modifycmd
|
48
|
-
[
|
54
|
+
cmd = [
|
49
55
|
"pw",
|
50
56
|
"groupmod",
|
51
57
|
@parent[:name],
|
52
58
|
self.class.objectaddflag,
|
53
59
|
"'%s'" % self.should
|
54
|
-
]
|
60
|
+
]
|
61
|
+
return cmd.join(" ")
|
55
62
|
end
|
56
63
|
end
|
57
64
|
|
@@ -71,6 +78,10 @@ module Puppet
|
|
71
78
|
cmd << "-M"
|
72
79
|
end
|
73
80
|
|
81
|
+
if @parent[:allowdupe] == :true
|
82
|
+
cmd << "-o"
|
83
|
+
end
|
84
|
+
|
74
85
|
cmd.join(" ")
|
75
86
|
end
|
76
87
|
|
@@ -86,7 +97,9 @@ module Puppet
|
|
86
97
|
"-w", "no",
|
87
98
|
self.class.objectaddflag,
|
88
99
|
"'%s'" % self.should
|
89
|
-
]
|
100
|
+
]
|
101
|
+
|
102
|
+
return cmd.join(" ")
|
90
103
|
end
|
91
104
|
end
|
92
105
|
end
|
data/lib/puppet/type/package.rb
CHANGED
@@ -60,6 +60,10 @@ module Puppet
|
|
60
60
|
|
61
61
|
mod.module_eval(&block)
|
62
62
|
|
63
|
+
class << mod
|
64
|
+
include Puppet::Util
|
65
|
+
end
|
66
|
+
|
63
67
|
# It's at least conceivable that a module would not define this method
|
64
68
|
# "module_function" makes the :list method private, so if the parent
|
65
69
|
# method also called module_function, then it's already private
|
@@ -108,11 +112,10 @@ module Puppet
|
|
108
112
|
end
|
109
113
|
|
110
114
|
ensurable do
|
111
|
-
desc "What state the package should be in.
|
112
|
-
|
113
|
-
|
114
|
-
those
|
115
|
-
their own."
|
115
|
+
desc "What state the package should be in.
|
116
|
+
*latest* only makes sense for those packaging formats that can
|
117
|
+
retrieve new packages on their own and will throw an error on
|
118
|
+
those that cannot."
|
116
119
|
|
117
120
|
attr_accessor :latest
|
118
121
|
|
@@ -134,19 +137,26 @@ module Puppet
|
|
134
137
|
@parent[:type]
|
135
138
|
)
|
136
139
|
end
|
140
|
+
|
141
|
+
# Because yum always exits with a 0 exit code, there's a retrieve
|
142
|
+
# in the "install" method. So, check the current state now,
|
143
|
+
# to compare against later.
|
144
|
+
current = self.is
|
137
145
|
begin
|
138
146
|
@parent.update
|
139
147
|
rescue => detail
|
140
148
|
self.fail "Could not update: %s" % detail
|
141
149
|
end
|
142
150
|
|
143
|
-
if
|
151
|
+
if current == :absent
|
144
152
|
return :package_created
|
145
153
|
else
|
146
154
|
return :package_changed
|
147
155
|
end
|
148
156
|
end
|
149
157
|
|
158
|
+
defaultto :installed
|
159
|
+
|
150
160
|
# Override the parent method, because we've got all kinds of
|
151
161
|
# funky definitions of 'in sync'.
|
152
162
|
def insync?
|
@@ -214,9 +224,7 @@ module Puppet
|
|
214
224
|
|
215
225
|
# This retrieves the current state
|
216
226
|
def retrieve
|
217
|
-
#unless defined? @is
|
218
227
|
@parent.retrieve
|
219
|
-
#end
|
220
228
|
end
|
221
229
|
|
222
230
|
def sync
|
@@ -244,7 +252,7 @@ module Puppet
|
|
244
252
|
system uses internally, which is sometimes (especially on Solaris)
|
245
253
|
a name that is basically useless to humans. If you want to
|
246
254
|
abstract package installation, then you can use aliases to provide
|
247
|
-
a common name to packages
|
255
|
+
a common name to packages:
|
248
256
|
|
249
257
|
# In the 'openssl' class
|
250
258
|
$ssl = $operationgsystem ? {
|
@@ -371,6 +379,13 @@ module Puppet
|
|
371
379
|
desc "A read-only parameter set by the package."
|
372
380
|
end
|
373
381
|
|
382
|
+
newparam(:allowcdrom) do
|
383
|
+
desc "Tells apt to allow cdrom sources in the sources.list file.
|
384
|
+
Normally apt will bail if you try this."
|
385
|
+
|
386
|
+
newvalues(:true, :false)
|
387
|
+
end
|
388
|
+
|
374
389
|
autorequire(:file) do
|
375
390
|
autos = []
|
376
391
|
[:responsefile, :adminfile].each { |param|
|
@@ -446,27 +461,6 @@ module Puppet
|
|
446
461
|
end
|
447
462
|
end
|
448
463
|
|
449
|
-
# Return a list of valid package types
|
450
|
-
# def self.getpkglist
|
451
|
-
# if @types.nil?
|
452
|
-
# if @default.nil?
|
453
|
-
# self.init
|
454
|
-
# end
|
455
|
-
# @types = [@default]
|
456
|
-
# end
|
457
|
-
#
|
458
|
-
# list = @types.collect { |type|
|
459
|
-
# if typeobj = Puppet::PackagingType[type]
|
460
|
-
# # pull all of the objects
|
461
|
-
# typeobj.list
|
462
|
-
# else
|
463
|
-
# raise Puppet::Error, "Could not find package type '%s'" % type
|
464
|
-
# end
|
465
|
-
# }.flatten
|
466
|
-
# @listed = true
|
467
|
-
# return list
|
468
|
-
# end
|
469
|
-
|
470
464
|
# Create a new package object from listed information
|
471
465
|
def self.installedpkg(hash)
|
472
466
|
unless hash.include? :type
|
@@ -592,50 +586,6 @@ module Puppet
|
|
592
586
|
end
|
593
587
|
end
|
594
588
|
end # Puppet.type(:package)
|
595
|
-
|
596
|
-
# this is how we retrieve packages
|
597
|
-
class PackageSource
|
598
|
-
attr_accessor :uri
|
599
|
-
attr_writer :retrieve
|
600
|
-
|
601
|
-
@@sources = Hash.new(false)
|
602
|
-
|
603
|
-
def PackageSource.get(file)
|
604
|
-
type = file.sub(%r{:.+},'')
|
605
|
-
source = nil
|
606
|
-
if source = @@sources[type]
|
607
|
-
return source.retrieve(file)
|
608
|
-
else
|
609
|
-
raise Puppet::Error, "Unknown package source: %s" % type
|
610
|
-
end
|
611
|
-
end
|
612
|
-
|
613
|
-
def initialize(name)
|
614
|
-
if block_given?
|
615
|
-
yield self
|
616
|
-
end
|
617
|
-
|
618
|
-
@@sources[name] = self
|
619
|
-
end
|
620
|
-
|
621
|
-
def retrieve(path)
|
622
|
-
@retrieve.call(path)
|
623
|
-
end
|
624
|
-
|
625
|
-
end
|
626
|
-
|
627
|
-
PackageSource.new("file") { |obj|
|
628
|
-
obj.retrieve = proc { |path|
|
629
|
-
# this might not work for windows...
|
630
|
-
file = path.sub(%r{^file://},'')
|
631
|
-
|
632
|
-
if FileTest.exists?(file)
|
633
|
-
return file
|
634
|
-
else
|
635
|
-
raise Puppet::Error, "File %s does not exist" % file
|
636
|
-
end
|
637
|
-
}
|
638
|
-
}
|
639
589
|
end
|
640
590
|
|
641
|
-
# $Id: package.rb
|
591
|
+
# $Id: package.rb 1417 2006-07-21 19:33:36Z luke $
|
@@ -21,7 +21,21 @@ module Puppet
|
|
21
21
|
raise Puppet::PackageError.new(output)
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
def list
|
26
|
+
packages = []
|
27
|
+
|
28
|
+
Dir.entries("/Library/Receipts").find { |f|
|
29
|
+
f =~ /\.pkg$/
|
30
|
+
}.collect { |f|
|
31
|
+
Puppet.type(:package).installedpkg(
|
32
|
+
:name => f.sub(/\.pkg/, ''),
|
33
|
+
:type => :apple,
|
34
|
+
:ensure => :installed
|
35
|
+
)
|
36
|
+
}
|
37
|
+
end
|
24
38
|
end
|
25
39
|
end
|
26
40
|
|
27
|
-
# $Id: apple.rb
|
41
|
+
# $Id: apple.rb 1156 2006-05-01 01:07:47Z luke $
|