From 60cd6a73b2b0cb7b26b091d4214c66eb5ed3b0ad Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Sat, 22 Sep 2007 12:56:32 -0500 Subject: The structure for handling resource generation is now in place, which means I'm over the hump in developing this branch. I have to fix some design flaws I made in the configurations, particularly that the 'runner' handler needs to be able to specify tags and whether to ignore schedules, but otherwise, I think it's straightforward test- and bug-fixing from here out. --- lib/puppet/node/configuration.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/puppet/node') diff --git a/lib/puppet/node/configuration.rb b/lib/puppet/node/configuration.rb index de6e776c5..747ab9ef6 100644 --- a/lib/puppet/node/configuration.rb +++ b/lib/puppet/node/configuration.rb @@ -118,11 +118,21 @@ class Puppet::Node::Configuration < Puppet::PGraph # Create an implicit resource, meaning that it will lose out # to any explicitly defined resources. This method often returns # nil. + # The quirk of this method is that it's not possible to create + # an implicit resource before an explicit resource of the same name, + # because all explicit resources are created before any generate() + # methods are called on the individual resources. Thus, this + # method can safely just check if an explicit resource already exists + # and toss this implicit resource if so. def create_implicit_resource(type, options) unless options.include?(:implicit) options[:implicit] = true end - # LAK:FIXME catch exceptions here and return nil when problems + + # This will return nil if an equivalent explicit resource already exists. + # When resource classes no longer retain references to resource instances, + # this will need to be modified to catch that conflict and discard + # implicit resources. if resource = create_resource(type, options) resource.implicit = true -- cgit