diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-04-30 20:19:55 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-04-30 20:19:55 +0000 |
commit | a1574a544cd7fc0df16acc4102b75c414a8e80a2 (patch) | |
tree | d0293364f8e75495dada805a36d412393b932b33 | |
parent | 7825f4944c3b29a994bc9be947f0463a68d2cc8e (diff) | |
download | puppet-a1574a544cd7fc0df16acc4102b75c414a8e80a2.tar.gz puppet-a1574a544cd7fc0df16acc4102b75c414a8e80a2.tar.xz puppet-a1574a544cd7fc0df16acc4102b75c414a8e80a2.zip |
Fixing TransObject#to_type so that it does not modify the object being converted
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1153 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r-- | lib/puppet/transportable.rb | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/lib/puppet/transportable.rb b/lib/puppet/transportable.rb index 75f40bd08..3422cd71b 100644 --- a/lib/puppet/transportable.rb +++ b/lib/puppet/transportable.rb @@ -60,14 +60,14 @@ module Puppet def to_type(parent = nil) retobj = nil - if type = Puppet::Type.type(self.type) + if typeklass = Puppet::Type.type(self.type) # FIXME This should really be done differently, but... - if retobj = type[self.name] + if retobj = typeklass[self.name] self.each do |param, val| retobj[param] = val end else - unless retobj = type.create(self) + unless retobj = typeklass.create(self) #Puppet.notice "Could not create %s[%s]" % # [self.type, self.name] return nil @@ -79,13 +79,7 @@ module Puppet raise Puppet::Error.new("Could not find object type %s" % self.type) end - #if defined? @tags and @tags - # #Puppet.debug "%s(%s) tags: %s" % [@type, @name, @tags.join(" ")] - # retobj.tags = @tags - #end - if parent - self[:parent] = parent parent.push retobj end @@ -117,7 +111,6 @@ module Puppet end def push(*args) - #Puppet.warning "calling push" args.each { |arg| case arg when Puppet::TransBucket, Puppet::TransObject @@ -129,7 +122,6 @@ module Puppet end } @children += args - #Puppet.warning @children.inspect end # Convert to a parseable manifest @@ -174,15 +166,15 @@ module Puppet usetrans = true if usetrans - name = nil + tmpname = nil # Nodes have the same name and type if self.name - name = "%s[%s]" % [@type, self.name] + tmpname = "%s[%s]" % [@type, self.name] else - name = @type + tmpname = @type end - trans = TransObject.new(name, :component) + trans = TransObject.new(tmpname, :component) if defined? @parameters @parameters.each { |param,value| Puppet.debug "Defining %s on %s of type %s" % |