summaryrefslogtreecommitdiffstats
path: root/lib/puppet/node
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/node
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/node')
-rw-r--r--lib/puppet/node/configuration.rb16
1 files changed, 16 insertions, 0 deletions
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?