diff options
| author | Luke Kanies <luke@madstop.com> | 2007-11-19 01:36:48 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-11-19 01:36:48 -0600 |
| commit | 2b14f627aca1d5be69cf6606044df4d6e67f6eba (patch) | |
| tree | a20db3a608af483f598f482e743868413da8fd8f /lib/puppet/network/handler | |
| parent | 9cf477b6cc771eab7bd29d18c49128571e877987 (diff) | |
| download | puppet-2b14f627aca1d5be69cf6606044df4d6e67f6eba.tar.gz puppet-2b14f627aca1d5be69cf6606044df4d6e67f6eba.tar.xz puppet-2b14f627aca1d5be69cf6606044df4d6e67f6eba.zip | |
Reverting the changes I'd made toward removing the global
resources. These are commits:
c19835ce9f8a5138b30a1a32ca741c996b0916d2
9290cc89a2206fb5204578f8e91208857a48b147
ffb4c2dbc7314b364d25e4f7be599ef05b767b44
Diffstat (limited to 'lib/puppet/network/handler')
| -rwxr-xr-x | lib/puppet/network/handler/fileserver.rb | 7 | ||||
| -rwxr-xr-x | lib/puppet/network/handler/resource.rb | 31 |
2 files changed, 21 insertions, 17 deletions
diff --git a/lib/puppet/network/handler/fileserver.rb b/lib/puppet/network/handler/fileserver.rb index 7a5a1fe9a..dd00450be 100755 --- a/lib/puppet/network/handler/fileserver.rb +++ b/lib/puppet/network/handler/fileserver.rb @@ -551,25 +551,22 @@ class Puppet::Network::Handler @path = nil end - @cache = {} - super() end def fileobj(path, links) obj = nil - if obj = @cache[path] + if obj = Puppet.type(:file)[path] # This can only happen in local fileserving, but it's an # important one. It'd be nice if we didn't just set # the check params every time, but I'm not sure it's worth # the effort. obj[:check] = CHECKPARAMS else - obj = Puppet::Type.type(:file).create( + obj = Puppet.type(:file).create( :name => path, :check => CHECKPARAMS ) - @cache[path] = obj end if links == :manage diff --git a/lib/puppet/network/handler/resource.rb b/lib/puppet/network/handler/resource.rb index c96bdf6a6..0fcd694fb 100755 --- a/lib/puppet/network/handler/resource.rb +++ b/lib/puppet/network/handler/resource.rb @@ -53,8 +53,8 @@ class Puppet::Network::Handler return "success" end - # Describe a given resource. This returns the 'is' values for every property - # available on the resource type. + # Describe a given object. This returns the 'is' values for every property + # available on the object type. def describe(type, name, retrieve = nil, ignore = [], format = "yaml", client = nil, clientip = nil) Puppet.info "Describing %s[%s]" % [type.to_s.capitalize, name] @local = true unless client @@ -63,23 +63,29 @@ class Puppet::Network::Handler raise Puppet::Error, "Puppet type %s is unsupported" % type end + obj = nil + retrieve ||= :all ignore ||= [] - begin - resource = typeklass.create(:name => name, :check => retrieve) - rescue Puppet::Error => detail - raise Puppet::Error, "%s[%s] could not be created: %s" % - [type, name, detail] + if obj = typeklass[name] + obj[:check] = retrieve + else + begin + obj = typeklass.create(:name => name, :check => retrieve) + rescue Puppet::Error => detail + raise Puppet::Error, "%s[%s] could not be created: %s" % + [type, name, detail] + end end - unless resource + unless obj raise XMLRPC::FaultException.new( 1, "Could not create %s[%s]" % [type, name] ) end - trans = resource.to_trans + trans = obj.to_trans # Now get rid of any attributes they specifically don't want ignore.each do |st| @@ -132,10 +138,11 @@ class Puppet::Network::Handler bucket = Puppet::TransBucket.new bucket.type = typeklass.name - typeklass.instances.each do |resource| - next if ignore.include? resource.name + typeklass.instances.each do |obj| + next if ignore.include? obj.name - bucket << resource.to_trans + #object = Puppet::TransObject.new(obj.name, typeklass.name) + bucket << obj.to_trans end unless @local |
