summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network/handler
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-11-18 11:21:22 -0600
committerLuke Kanies <luke@madstop.com>2007-11-18 11:21:22 -0600
commitc19835ce9f8a5138b30a1a32ca741c996b0916d2 (patch)
tree1a7b05839f013cc8a610f7c9493e206606fab977 /lib/puppet/network/handler
parent9290cc89a2206fb5204578f8e91208857a48b147 (diff)
downloadpuppet-c19835ce9f8a5138b30a1a32ca741c996b0916d2.tar.gz
puppet-c19835ce9f8a5138b30a1a32ca741c996b0916d2.tar.xz
puppet-c19835ce9f8a5138b30a1a32ca741c996b0916d2.zip
Fixed most failing tests, but there are still over thirty failing.
At this point, I'm holding the experiment until after the release, so I'm committing this for now and will take it back up after 0.24.0 is out.
Diffstat (limited to 'lib/puppet/network/handler')
-rwxr-xr-xlib/puppet/network/handler/fileserver.rb7
-rwxr-xr-xlib/puppet/network/handler/resource.rb31
2 files changed, 17 insertions, 21 deletions
diff --git a/lib/puppet/network/handler/fileserver.rb b/lib/puppet/network/handler/fileserver.rb
index dd00450be..7a5a1fe9a 100755
--- a/lib/puppet/network/handler/fileserver.rb
+++ b/lib/puppet/network/handler/fileserver.rb
@@ -551,22 +551,25 @@ class Puppet::Network::Handler
@path = nil
end
+ @cache = {}
+
super()
end
def fileobj(path, links)
obj = nil
- if obj = Puppet.type(:file)[path]
+ if obj = @cache[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(:file).create(
+ obj = Puppet::Type.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 0fcd694fb..c96bdf6a6 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 object. This returns the 'is' values for every property
- # available on the object type.
+ # Describe a given resource. This returns the 'is' values for every property
+ # available on the resource 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,29 +63,23 @@ class Puppet::Network::Handler
raise Puppet::Error, "Puppet type %s is unsupported" % type
end
- obj = nil
-
retrieve ||= :all
ignore ||= []
- 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
+ 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]
end
- unless obj
+ unless resource
raise XMLRPC::FaultException.new(
1, "Could not create %s[%s]" % [type, name]
)
end
- trans = obj.to_trans
+ trans = resource.to_trans
# Now get rid of any attributes they specifically don't want
ignore.each do |st|
@@ -138,11 +132,10 @@ class Puppet::Network::Handler
bucket = Puppet::TransBucket.new
bucket.type = typeklass.name
- typeklass.instances.each do |obj|
- next if ignore.include? obj.name
+ typeklass.instances.each do |resource|
+ next if ignore.include? resource.name
- #object = Puppet::TransObject.new(obj.name, typeklass.name)
- bucket << obj.to_trans
+ bucket << resource.to_trans
end
unless @local