puppet 0.23.0 → 0.23.1
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/Rakefile +1 -1
- data/bin/filebucket +6 -6
- data/bin/puppetca +11 -1
- data/bin/puppetmasterd +7 -6
- data/conf/redhat/client.init +1 -0
- data/conf/redhat/{puppetd.conf → puppet.conf} +1 -1
- data/conf/redhat/puppet.spec +43 -31
- data/conf/redhat/server.init +1 -0
- data/lib/puppet.rb +3 -3
- data/lib/puppet/configuration.rb +16 -5
- data/lib/puppet/metatype/attributes.rb +12 -19
- data/lib/puppet/metatype/evaluation.rb +10 -1
- data/lib/puppet/metatype/instances.rb +39 -15
- data/lib/puppet/metatype/manager.rb +1 -28
- data/lib/puppet/metatype/metaparams.rb +20 -16
- data/lib/puppet/metatype/providers.rb +8 -2
- data/lib/puppet/metatype/schedules.rb +14 -19
- data/lib/puppet/{modules.rb → module.rb} +2 -0
- data/lib/puppet/network/authstore.rb +5 -1
- data/lib/puppet/network/client/dipper.rb +2 -2
- data/lib/puppet/network/client/master.rb +18 -9
- data/lib/puppet/network/handler/fileserver.rb +3 -6
- data/lib/puppet/network/handler/report.rb +2 -1
- data/lib/puppet/network/server/mongrel.rb +4 -2
- data/lib/puppet/network/xmlrpc/client.rb +10 -3
- data/lib/puppet/parameter.rb +11 -4
- data/lib/puppet/parser/ast/collexpr.rb +10 -10
- data/lib/puppet/parser/ast/hostclass.rb +2 -2
- data/lib/puppet/parser/ast/resourceparam.rb +4 -3
- data/lib/puppet/parser/ast/resourceref.rb +16 -2
- data/lib/puppet/parser/collector.rb +8 -4
- data/lib/puppet/parser/functions.rb +5 -2
- data/lib/puppet/parser/interpreter.rb +48 -9
- data/lib/puppet/parser/lexer.rb +2 -1
- data/lib/puppet/parser/parser.rb +669 -589
- data/lib/puppet/parser/resource.rb +20 -11
- data/lib/puppet/parser/resource/param.rb +21 -10
- data/lib/puppet/parser/resource/reference.rb +2 -2
- data/lib/puppet/parser/scope.rb +22 -10
- data/lib/puppet/{type/property.rb → property.rb} +48 -15
- data/lib/puppet/propertychange.rb +3 -3
- data/lib/puppet/provider/cron/crontab.rb +38 -36
- data/lib/puppet/provider/host/netinfo.rb +1 -2
- data/lib/puppet/provider/mailalias/aliases.rb +31 -0
- data/lib/puppet/provider/maillist/mailman.rb +113 -0
- data/lib/puppet/provider/mount.rb +5 -11
- data/lib/puppet/provider/mount/parsed.rb +2 -2
- data/lib/puppet/provider/package/appdmg.rb +1 -2
- data/lib/puppet/provider/package/apt.rb +3 -1
- data/lib/puppet/provider/package/aptrpm.rb +14 -4
- data/lib/puppet/provider/package/blastwave.rb +6 -4
- data/lib/puppet/provider/package/dpkg.rb +12 -4
- data/lib/puppet/provider/package/pkgdmg.rb +2 -2
- data/lib/puppet/provider/package/rpm.rb +11 -1
- data/lib/puppet/provider/package/rug.rb +1 -0
- data/lib/puppet/provider/package/urpmi.rb +11 -1
- data/lib/puppet/provider/package/yum.rb +12 -2
- data/lib/puppet/provider/parsedfile.rb +36 -6
- data/lib/puppet/rails.rb +9 -2
- data/lib/puppet/rails/param_name.rb +2 -3
- data/lib/puppet/rails/param_value.rb +20 -1
- data/lib/puppet/rails/resource.rb +8 -2
- data/lib/puppet/reference/configuration.rb +14 -16
- data/lib/puppet/reference/type.rb +4 -4
- data/lib/puppet/transaction.rb +4 -4
- data/lib/puppet/type.rb +19 -6
- data/lib/puppet/type/component.rb +9 -3
- data/lib/puppet/type/cron.rb +10 -4
- data/lib/puppet/type/exec.rb +9 -5
- data/lib/puppet/type/group.rb +2 -3
- data/lib/puppet/type/mailalias.rb +50 -0
- data/lib/puppet/type/maillist.rb +57 -0
- data/lib/puppet/type/mount.rb +25 -11
- data/lib/puppet/type/package.rb +6 -27
- data/lib/puppet/type/pfile.rb +5 -6
- data/lib/puppet/type/pfile/source.rb +8 -2
- data/lib/puppet/type/pfilebucket.rb +4 -3
- data/lib/puppet/type/resources.rb +1 -3
- data/lib/puppet/type/schedule.rb +16 -16
- data/lib/puppet/type/service.rb +4 -1
- data/lib/puppet/type/tidy.rb +1 -2
- data/lib/puppet/type/user.rb +2 -3
- data/lib/puppet/type/yumrepo.rb +2 -2
- data/lib/puppet/util.rb +29 -4
- data/lib/puppet/util/autoload.rb +45 -16
- data/lib/puppet/util/fileparsing.rb +23 -6
- data/lib/puppet/util/filetype.rb +12 -1
- data/lib/puppet/util/log.rb +2 -2
- data/lib/puppet/util/log_paths.rb +16 -0
- data/lib/puppet/util/reference.rb +2 -2
- data/test/language/ast/hostclass.rb +21 -4
- data/test/language/ast/resourceref.rb +95 -0
- data/test/language/functions.rb +5 -5
- data/test/language/interpreter.rb +129 -1
- data/test/language/node.rb +13 -2
- data/test/language/resource.rb +26 -1
- data/test/language/scope.rb +25 -5
- data/test/lib/puppettest/support/collection.rb +2 -2
- data/test/network/client/master.rb +28 -42
- data/test/network/server/mongrel_test.rb +7 -1
- data/test/other/propertychange.rb +2 -2
- data/test/other/transactions.rb +44 -5
- data/test/puppet/modules.rb +2 -1
- data/test/rails/ast.rb +7 -8
- data/test/rails/collection.rb +2 -2
- data/test/rails/railsresource.rb +21 -5
- data/test/ral/manager/attributes.rb +33 -1
- data/test/ral/manager/instances.rb +33 -6
- data/test/ral/manager/type.rb +29 -49
- data/test/ral/providers/cron/crontab.rb +61 -13
- data/test/ral/providers/mailalias/aliases.rb +57 -0
- data/test/ral/providers/mount/parsed.rb +4 -4
- data/test/ral/providers/package/apt.rb +13 -1
- data/test/ral/providers/parsedfile.rb +20 -7
- data/test/ral/types/cron.rb +17 -1
- data/test/ral/types/mailalias.rb +50 -0
- data/test/ral/types/mount.rb +35 -2
- data/test/ral/types/package.rb +10 -2
- data/test/ral/types/parameter.rb +4 -4
- data/test/ral/types/property.rb +39 -1
- data/test/util/autoload.rb +33 -18
- data/test/util/filetype.rb +49 -3
- metadata +13 -6
- data/lib/puppet/element.rb +0 -52
@@ -96,6 +96,15 @@ class Puppet::Type
|
|
96
96
|
prophash
|
97
97
|
}
|
98
98
|
end
|
99
|
+
|
100
|
+
# Are we running in noop mode?
|
101
|
+
def noop?
|
102
|
+
@noop || Puppet[:noop]
|
103
|
+
end
|
104
|
+
|
105
|
+
def noop
|
106
|
+
noop?
|
107
|
+
end
|
99
108
|
|
100
109
|
# Retrieve the changes associated with all of the properties.
|
101
110
|
def propertychanges(currentvalues)
|
@@ -144,4 +153,4 @@ class Puppet::Type
|
|
144
153
|
end
|
145
154
|
end
|
146
155
|
|
147
|
-
# $Id: evaluation.rb
|
156
|
+
# $Id: evaluation.rb 2678 2007-07-11 19:30:42Z luke $
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'puppet/transportable'
|
2
|
+
|
1
3
|
class Puppet::Type
|
2
4
|
# Make 'new' private, so people have to use create instead.
|
3
5
|
class << self
|
@@ -89,7 +91,7 @@ class Puppet::Type
|
|
89
91
|
# If we're the base class, then pass the info on appropriately
|
90
92
|
if self == Puppet::Type
|
91
93
|
type = nil
|
92
|
-
if hash.is_a? TransObject
|
94
|
+
if hash.is_a? Puppet::TransObject
|
93
95
|
type = hash.type
|
94
96
|
else
|
95
97
|
# If we're using the type to determine object type, then delete it
|
@@ -116,7 +118,7 @@ class Puppet::Type
|
|
116
118
|
end
|
117
119
|
|
118
120
|
name = nil
|
119
|
-
unless hash.is_a? TransObject
|
121
|
+
unless hash.is_a? Puppet::TransObject
|
120
122
|
hash = self.hash2trans(hash)
|
121
123
|
end
|
122
124
|
|
@@ -182,13 +184,22 @@ class Puppet::Type
|
|
182
184
|
end
|
183
185
|
|
184
186
|
# remove a specified object
|
185
|
-
def self.delete(
|
187
|
+
def self.delete(resource)
|
186
188
|
return unless defined? @objects
|
187
|
-
if @objects.include?(
|
188
|
-
@objects.delete(
|
189
|
+
if @objects.include?(resource.title)
|
190
|
+
@objects.delete(resource.title)
|
189
191
|
end
|
190
|
-
if @aliases.include?(
|
191
|
-
@aliases.delete(
|
192
|
+
if @aliases.include?(resource.title)
|
193
|
+
@aliases.delete(resource.title)
|
194
|
+
end
|
195
|
+
if @aliases.has_value?(resource)
|
196
|
+
names = []
|
197
|
+
@aliases.each do |name, otherres|
|
198
|
+
if otherres == resource
|
199
|
+
names << name
|
200
|
+
end
|
201
|
+
end
|
202
|
+
names.each { |name| @aliases.delete(name) }
|
192
203
|
end
|
193
204
|
end
|
194
205
|
|
@@ -236,7 +247,7 @@ class Puppet::Type
|
|
236
247
|
end
|
237
248
|
# okay, now make a transobject out of hash
|
238
249
|
begin
|
239
|
-
trans = TransObject.new(title, self.name.to_s)
|
250
|
+
trans = Puppet::TransObject.new(title, self.name.to_s)
|
240
251
|
hash.each { |param, value|
|
241
252
|
trans[param] = value
|
242
253
|
}
|
@@ -255,17 +266,30 @@ class Puppet::Type
|
|
255
266
|
end
|
256
267
|
|
257
268
|
# Put the default provider first, then the rest of the suitable providers.
|
258
|
-
|
269
|
+
provider_instances = {}
|
259
270
|
providers_by_source.collect do |provider|
|
260
271
|
provider.instances.collect do |instance|
|
261
|
-
if
|
262
|
-
|
263
|
-
|
272
|
+
# First try to get the resource if it already exists
|
273
|
+
if resource = self[instance.name] and resource.provider.class != instance.class
|
274
|
+
# Skip instances that map to a managed resource with a different provider
|
264
275
|
next
|
265
276
|
end
|
266
|
-
packages[instance.name] = instance
|
267
277
|
|
268
|
-
|
278
|
+
# We always want to use the "first" provider instance we find, unless the resource
|
279
|
+
# is already managed and has a different provider set
|
280
|
+
if other = provider_instances[instance.name]
|
281
|
+
Puppet.warning "%s %s found in both %s and %s; skipping the %s version" %
|
282
|
+
[self.name.to_s.capitalize, instance.name, other.class.name, instance.class.name, instance.class.name]
|
283
|
+
next
|
284
|
+
end
|
285
|
+
provider_instances[instance.name] = instance
|
286
|
+
|
287
|
+
if resource
|
288
|
+
resource.provider = instance
|
289
|
+
resource
|
290
|
+
else
|
291
|
+
create(:name => instance.name, :provider => instance, :check => :all)
|
292
|
+
end
|
269
293
|
end
|
270
294
|
end.flatten.compact
|
271
295
|
end
|
@@ -292,4 +316,4 @@ class Puppet::Type
|
|
292
316
|
end
|
293
317
|
end
|
294
318
|
|
295
|
-
# $Id: instances.rb
|
319
|
+
# $Id: instances.rb 2718 2007-07-19 22:12:51Z luke $
|
@@ -29,30 +29,6 @@ module Manager
|
|
29
29
|
typeloader.loadall
|
30
30
|
end
|
31
31
|
|
32
|
-
# Do an on-demand plugin load
|
33
|
-
def loadplugin(name)
|
34
|
-
paths = Puppet[:pluginpath].split(":")
|
35
|
-
unless paths.include?(Puppet[:plugindest])
|
36
|
-
Puppet.notice "Adding plugin destination %s to plugin search path" %
|
37
|
-
Puppet[:plugindest]
|
38
|
-
Puppet[:pluginpath] += ":" + Puppet[:plugindest]
|
39
|
-
end
|
40
|
-
paths.each do |dir|
|
41
|
-
file = ::File.join(dir, name.to_s + ".rb")
|
42
|
-
if FileTest.exists?(file)
|
43
|
-
begin
|
44
|
-
load file
|
45
|
-
Puppet.info "loaded %s" % file
|
46
|
-
return true
|
47
|
-
rescue LoadError => detail
|
48
|
-
Puppet.info "Could not load plugin %s: %s" %
|
49
|
-
[file, detail]
|
50
|
-
return false
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
32
|
# Define a new type.
|
57
33
|
def newtype(name, options = {}, &block)
|
58
34
|
# Handle backward compatibility
|
@@ -144,9 +120,6 @@ module Manager
|
|
144
120
|
unless @types.include? name
|
145
121
|
Puppet.warning "Loaded puppet/type/#{name} but no class was created"
|
146
122
|
end
|
147
|
-
else
|
148
|
-
# If we can't load it from there, try loading it as a plugin.
|
149
|
-
loadplugin(name)
|
150
123
|
end
|
151
124
|
|
152
125
|
return @types[name]
|
@@ -166,4 +139,4 @@ module Manager
|
|
166
139
|
end
|
167
140
|
end
|
168
141
|
|
169
|
-
# $Id: manager.rb
|
142
|
+
# $Id: manager.rb 2680 2007-07-12 04:27:04Z luke $
|
@@ -38,14 +38,6 @@ class Puppet::Type
|
|
38
38
|
|
39
39
|
The creation of the schedule object does not need to appear in the
|
40
40
|
configuration before objects that use it."
|
41
|
-
|
42
|
-
munge do |name|
|
43
|
-
if schedule = Puppet.type(:schedule)[name]
|
44
|
-
return schedule
|
45
|
-
else
|
46
|
-
return name
|
47
|
-
end
|
48
|
-
end
|
49
41
|
end
|
50
42
|
|
51
43
|
newmetaparam(:check) do
|
@@ -59,7 +51,14 @@ class Puppet::Type
|
|
59
51
|
munge do |args|
|
60
52
|
# If they've specified all, collect all known properties
|
61
53
|
if args == :all
|
62
|
-
args = @resource.class.properties.
|
54
|
+
args = @resource.class.properties.find_all do |property|
|
55
|
+
# Only get properties supported by our provider
|
56
|
+
if @resource.provider
|
57
|
+
@resource.provider.class.supports_parameter?(property)
|
58
|
+
else
|
59
|
+
true
|
60
|
+
end
|
61
|
+
end.collect do |property|
|
63
62
|
property.name
|
64
63
|
end
|
65
64
|
end
|
@@ -214,10 +213,10 @@ class Puppet::Type
|
|
214
213
|
end
|
215
214
|
|
216
215
|
newmetaparam(:tag) do
|
217
|
-
desc "Add the specified tags to the associated
|
216
|
+
desc "Add the specified tags to the associated resource. While all resources
|
218
217
|
are automatically tagged with as much information as possible
|
219
|
-
(e.g., each class and
|
220
|
-
be useful to add your own tags to a given
|
218
|
+
(e.g., each class and definition containing the resource), it can
|
219
|
+
be useful to add your own tags to a given resource.
|
221
220
|
|
222
221
|
Tags are currently useful for things like applying a subset of a
|
223
222
|
host's configuration::
|
@@ -329,11 +328,16 @@ class Puppet::Type
|
|
329
328
|
file { \"/usr/local/scripts/myscript\":
|
330
329
|
source => \"puppet://server/module/myscript\",
|
331
330
|
mode => 755,
|
332
|
-
require =>
|
331
|
+
require => File[\"/usr/local/scripts\"]
|
333
332
|
}
|
334
333
|
|
334
|
+
Multiple dependencies can be specified by providing a comma-seperated list
|
335
|
+
of resources, enclosed in square brackets::
|
336
|
+
|
337
|
+
require => [ File[\"/usr/local\"], File[\"/usr/local/scripts\"] ]
|
338
|
+
|
335
339
|
Note that Puppet will autorequire everything that it can, and
|
336
|
-
there are hooks in place so that it's easy for
|
340
|
+
there are hooks in place so that it's easy for resources to add new
|
337
341
|
ways to autorequire objects, so if you think Puppet could be
|
338
342
|
smarter here, let us know.
|
339
343
|
|
@@ -342,7 +346,7 @@ class Puppet::Type
|
|
342
346
|
automatically realize that the parent directory should be created
|
343
347
|
before the script is pulled down.
|
344
348
|
|
345
|
-
Currently, exec
|
349
|
+
Currently, exec resources will autorequire their CWD (if it is
|
346
350
|
specified) plus any fully qualified paths that appear in the
|
347
351
|
command. For instance, if you had an ``exec`` command that ran
|
348
352
|
the ``myscript`` mentioned above, the above code that pulls the
|
@@ -410,4 +414,4 @@ class Puppet::Type
|
|
410
414
|
end
|
411
415
|
end # Puppet::Type
|
412
416
|
|
413
|
-
# $Id: metaparams.rb
|
417
|
+
# $Id: metaparams.rb 2684 2007-07-12 16:39:47Z luke $
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'puppet/provider'
|
1
2
|
require 'puppet/util/provider_features'
|
2
3
|
class Puppet::Type
|
3
4
|
# Add the feature handling module.
|
@@ -113,6 +114,11 @@ class Puppet::Type
|
|
113
114
|
def self.provide(name, options = {}, &block)
|
114
115
|
name = Puppet::Util.symbolize(name)
|
115
116
|
|
117
|
+
if obj = @providers[name]
|
118
|
+
Puppet.debug "Reloading %s %s provider" % [name, self.name]
|
119
|
+
unprovide(name)
|
120
|
+
end
|
121
|
+
|
116
122
|
parent = if pname = options[:parent]
|
117
123
|
options.delete(:parent)
|
118
124
|
if pname.is_a? Class
|
@@ -127,7 +133,7 @@ class Puppet::Type
|
|
127
133
|
end
|
128
134
|
end
|
129
135
|
else
|
130
|
-
Puppet::
|
136
|
+
Puppet::Provider
|
131
137
|
end
|
132
138
|
|
133
139
|
options[:resource_type] ||= self
|
@@ -244,4 +250,4 @@ class Puppet::Type
|
|
244
250
|
end
|
245
251
|
end
|
246
252
|
|
247
|
-
# $Id: providers.rb
|
253
|
+
# $Id: providers.rb 2714 2007-07-19 18:12:20Z luke $
|
@@ -3,32 +3,27 @@ class Puppet::Type
|
|
3
3
|
# the instantiation phase, so that the schedule can be anywhere in the
|
4
4
|
# file.
|
5
5
|
def schedule
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
#return if self.is_a?(Puppet.type(:component))
|
17
|
-
|
18
|
-
if sched = Puppet.type(:schedule)[self[:schedule]]
|
19
|
-
self[:schedule] = sched
|
20
|
-
else
|
21
|
-
self.fail "Could not find schedule %s" % self[:schedule]
|
6
|
+
unless defined? @schedule
|
7
|
+
if name = self[:schedule]
|
8
|
+
if sched = Puppet.type(:schedule)[name]
|
9
|
+
@schedule = sched
|
10
|
+
else
|
11
|
+
self.fail "Could not find schedule %s" % name
|
12
|
+
end
|
13
|
+
else
|
14
|
+
@schedule = nil
|
15
|
+
end
|
22
16
|
end
|
17
|
+
@schedule
|
23
18
|
end
|
24
19
|
|
25
20
|
# Check whether we are scheduled to run right now or not.
|
26
21
|
def scheduled?
|
27
22
|
return true if Puppet[:ignoreschedules]
|
28
|
-
return true unless schedule = self
|
23
|
+
return true unless schedule = self.schedule
|
29
24
|
|
30
25
|
# We use 'checked' here instead of 'synced' because otherwise we'll
|
31
|
-
# end up checking most
|
26
|
+
# end up checking most resources most times, because they will generally
|
32
27
|
# have been synced a long time ago (e.g., a file only gets updated
|
33
28
|
# once a month on the server and its schedule is daily; the last sync time
|
34
29
|
# will have been a month ago, so we'd end up checking every run).
|
@@ -36,4 +31,4 @@ class Puppet::Type
|
|
36
31
|
end
|
37
32
|
end
|
38
33
|
|
39
|
-
# $Id: schedules.rb
|
34
|
+
# $Id: schedules.rb 2665 2007-07-09 21:32:33Z luke $
|
@@ -68,6 +68,10 @@ module Puppet
|
|
68
68
|
@declarations = []
|
69
69
|
end
|
70
70
|
|
71
|
+
def to_s
|
72
|
+
"authstore"
|
73
|
+
end
|
74
|
+
|
71
75
|
private
|
72
76
|
|
73
77
|
# Store the results of a pattern into our hash. Basically just
|
@@ -290,4 +294,4 @@ module Puppet
|
|
290
294
|
end
|
291
295
|
end
|
292
296
|
|
293
|
-
# $Id: authstore.rb
|
297
|
+
# $Id: authstore.rb 2673 2007-07-10 19:26:36Z luke $
|
@@ -19,7 +19,7 @@ class Puppet::Network::Client::Dipper < Puppet::Network::Client
|
|
19
19
|
# Back up a file to our bucket
|
20
20
|
def backup(file)
|
21
21
|
unless FileTest.exists?(file)
|
22
|
-
raise(
|
22
|
+
raise(ArgumentError, "File %s does not exist" % file)
|
23
23
|
end
|
24
24
|
contents = ::File.read(file)
|
25
25
|
unless local?
|
@@ -78,4 +78,4 @@ class Puppet::Network::Client::Dipper < Puppet::Network::Client
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
# $Id: dipper.rb
|
81
|
+
# $Id: dipper.rb 2679 2007-07-11 20:23:49Z luke $
|
@@ -175,7 +175,10 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
|
|
175
175
|
def getconfig
|
176
176
|
dostorage()
|
177
177
|
|
178
|
-
facts =
|
178
|
+
facts = nil
|
179
|
+
Puppet::Util.benchmark(:debug, "Retrieved facts") do
|
180
|
+
facts = self.class.facts
|
181
|
+
end
|
179
182
|
|
180
183
|
if self.objects or FileTest.exists?(self.cachefile)
|
181
184
|
if self.fresh?(facts)
|
@@ -300,8 +303,12 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
|
|
300
303
|
lockfile.lockfile
|
301
304
|
else
|
302
305
|
got_lock = true
|
303
|
-
|
304
|
-
|
306
|
+
begin
|
307
|
+
@configtime = thinmark do
|
308
|
+
self.getconfig
|
309
|
+
end
|
310
|
+
rescue => detail
|
311
|
+
Puppet.err "Could not retrieve configuration: %s" % detail
|
305
312
|
end
|
306
313
|
|
307
314
|
if defined? @objects and @objects
|
@@ -450,18 +457,20 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
|
|
450
457
|
# Retrieve the plugins from the central server. We only have to load the
|
451
458
|
# changed plugins, because Puppet::Type loads plugins on demand.
|
452
459
|
def self.getplugins
|
453
|
-
path = Puppet[:pluginpath].split(":")
|
454
460
|
download(:dest => Puppet[:plugindest], :source => Puppet[:pluginsource],
|
455
461
|
:ignore => Puppet[:pluginsignore], :name => "plugin") do |object|
|
456
462
|
|
457
|
-
next
|
463
|
+
next if FileTest.directory?(object[:path])
|
464
|
+
path = object[:path].sub(Puppet[:plugindest], '').sub(/^\/+/, '')
|
465
|
+
unless Puppet::Util::Autoload.loaded?(path)
|
466
|
+
next
|
467
|
+
end
|
458
468
|
|
459
469
|
begin
|
460
|
-
Puppet.info "Reloading
|
461
|
-
::File.basename(::File.basename(object[:path])).sub(".rb",'')
|
470
|
+
Puppet.info "Reloading downloaded file %s" % path
|
462
471
|
load object[:path]
|
463
472
|
rescue => detail
|
464
|
-
Puppet.warning "Could not reload
|
473
|
+
Puppet.warning "Could not reload downloaded file %s: %s" %
|
465
474
|
[object[:path], detail]
|
466
475
|
end
|
467
476
|
end
|
@@ -683,4 +692,4 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
|
|
683
692
|
end
|
684
693
|
end
|
685
694
|
|
686
|
-
# $Id: master.rb
|
695
|
+
# $Id: master.rb 2671 2007-07-10 19:25:32Z luke $
|
@@ -393,7 +393,7 @@ class Puppet::Network::Handler
|
|
393
393
|
|
394
394
|
mod = Puppet::Module::find(tmp)
|
395
395
|
if mod
|
396
|
-
mount = @mounts[MODULES].copy(mod, mod.files)
|
396
|
+
mount = @mounts[MODULES].copy(mod.name, mod.files)
|
397
397
|
else
|
398
398
|
unless mount = @mounts[tmp]
|
399
399
|
raise FileServerError, "Fileserver module '%s' not mounted" % tmp
|
@@ -456,7 +456,6 @@ class Puppet::Network::Handler
|
|
456
456
|
sync.synchronize(Sync::EX) do
|
457
457
|
@@files[path] = data
|
458
458
|
data[:loaded_obj] = Puppet::Util::LoadedFile.new(path)
|
459
|
-
Puppet.notice "Initializing values for %s" % path
|
460
459
|
data[:values] = properties(obj)
|
461
460
|
return data[:values]
|
462
461
|
end
|
@@ -469,13 +468,11 @@ class Puppet::Network::Handler
|
|
469
468
|
|
470
469
|
if changed
|
471
470
|
sync.synchronize(Sync::EX) do
|
472
|
-
Puppet.notice "Getting values for %s" % path
|
473
471
|
data[:values] = properties(obj)
|
474
472
|
return data[:values]
|
475
473
|
end
|
476
474
|
else
|
477
475
|
sync.synchronize(Sync::SH) do
|
478
|
-
Puppet.info "Using cached values for %s" % path
|
479
476
|
return data[:values]
|
480
477
|
end
|
481
478
|
end
|
@@ -635,7 +632,7 @@ class Puppet::Network::Handler
|
|
635
632
|
end
|
636
633
|
|
637
634
|
def to_s
|
638
|
-
"mount[
|
635
|
+
"mount[%s]" % @name
|
639
636
|
end
|
640
637
|
|
641
638
|
# Verify our configuration is valid. This should really check to
|
@@ -660,4 +657,4 @@ class Puppet::Network::Handler
|
|
660
657
|
end
|
661
658
|
end
|
662
659
|
|
663
|
-
# $Id: fileserver.rb
|
660
|
+
# $Id: fileserver.rb 2653 2007-07-06 00:54:51Z luke $
|