From c19835ce9f8a5138b30a1a32ca741c996b0916d2 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Sun, 18 Nov 2007 11:21:22 -0600 Subject: 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. --- lib/puppet/node/configuration.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/puppet/node') diff --git a/lib/puppet/node/configuration.rb b/lib/puppet/node/configuration.rb index 061e83f4b..e131839df 100644 --- a/lib/puppet/node/configuration.rb +++ b/lib/puppet/node/configuration.rb @@ -60,11 +60,22 @@ class Puppet::Node::Configuration < Puppet::PGraph end ref = resource.ref + if @resource_table.include?(ref) raise ArgumentError, "Resource %s is already defined" % ref else @resource_table[ref] = resource end + + # If the name and title differ, set up an alias + if ! resource.is_a?(Puppet::Type::Component) and resource.respond_to?(:title) and resource.name != resource.title + if obj = resource(resource.class.name, resource.name) + raise Puppet::Error, "%s already exists with name %s" % [obj.title, self.name] if resource.class.isomorphic? + else + self.alias(resource, resource.name) + end + end + resource.configuration = self unless is_relationship_graph add_vertex!(resource) end @@ -183,6 +194,11 @@ class Puppet::Node::Configuration < Puppet::PGraph unless klass = Puppet::Type.type(type) raise ArgumentError, "Unknown resource type %s" % type end + if options.is_a?(Puppet::TransObject) + options.configuration = self + else + options[:configuration] = self + end return unless resource = klass.create(options) @transient_resources << resource if applying? -- cgit