diff options
| author | Luke Kanies <luke@madstop.com> | 2007-11-27 17:24:13 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-11-27 17:24:13 -0600 |
| commit | 0ef6b9579df65adda51389a2ab3e514ef42afa14 (patch) | |
| tree | 150340dc12e29d3b8397521e33e2baf60147d299 /lib/puppet/node | |
| parent | a38b4151244c0af4bdf058d3fec5a01dc271e1c3 (diff) | |
| download | puppet-0ef6b9579df65adda51389a2ab3e514ef42afa14.tar.gz puppet-0ef6b9579df65adda51389a2ab3e514ef42afa14.tar.xz puppet-0ef6b9579df65adda51389a2ab3e514ef42afa14.zip | |
Fixing #931 by keeping track in configurations of
what transportable resources get converted to, so
different names don't throw it off.
I also got rid of the Puppet::Type#merge method, which
has been deprecated for ages but was still in there. I
had to fix a few tests that weren't cleaning up after themselves
as a result.
Diffstat (limited to 'lib/puppet/node')
| -rw-r--r-- | lib/puppet/node/configuration.rb | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/puppet/node/configuration.rb b/lib/puppet/node/configuration.rb index 804f357d1..393f23913 100644 --- a/lib/puppet/node/configuration.rb +++ b/lib/puppet/node/configuration.rb @@ -442,10 +442,18 @@ class Puppet::Node::Configuration < Puppet::PGraph def to_configuration(convert) result = self.class.new(self.name) + map = {} vertices.each do |resource| next if resource.respond_to?(:virtual?) and resource.virtual? - result.add_resource resource.send(convert) + newres = resource.send(convert) + + # We can't guarantee that resources don't munge their names + # (like files do with trailing slashes), so we have to keep track + # of what a resource got converted to. + map[resource.ref] = newres + + result.add_resource newres end message = convert.to_s.gsub "_", " " @@ -454,17 +462,19 @@ class Puppet::Node::Configuration < Puppet::PGraph next if edge.source.respond_to?(:virtual?) and edge.source.virtual? next if edge.target.respond_to?(:virtual?) and edge.target.virtual? - unless source = result.resource(edge.source.ref) - raise Puppet::DevError, "Could not find vertex for %s when converting %s" % [edge.source.ref, message] + unless source = map[edge.source.ref] + raise Puppet::DevError, "Could not find resource %s when converting %s resources" % [edge.source.ref, message] end - unless target = result.resource(edge.target.ref) - raise Puppet::DevError, "Could not find vertex for %s when converting %s" % [edge.target.ref, message] + unless target = map[edge.target.ref] + raise Puppet::DevError, "Could not find resource %s when converting %s resources" % [edge.target.ref, message] end result.add_edge!(source, target, edge.label) end + map.clear + result.add_class *self.classes result.tag(*self.tags) |
