diff options
| author | Luke Kanies <luke@madstop.com> | 2007-09-22 12:56:32 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-09-22 12:56:32 -0500 |
| commit | 60cd6a73b2b0cb7b26b091d4214c66eb5ed3b0ad (patch) | |
| tree | 1199cb338548abd11c3f92dd3bcb056fe69d20ce /lib | |
| parent | 46d69068fa7b2f3448294c5d3da21c69cef73d2f (diff) | |
| download | puppet-60cd6a73b2b0cb7b26b091d4214c66eb5ed3b0ad.tar.gz puppet-60cd6a73b2b0cb7b26b091d4214c66eb5ed3b0ad.tar.xz puppet-60cd6a73b2b0cb7b26b091d4214c66eb5ed3b0ad.zip | |
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.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/metatype/instances.rb | 5 | ||||
| -rw-r--r-- | lib/puppet/node/configuration.rb | 12 | ||||
| -rw-r--r-- | lib/puppet/transaction.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/type.rb | 12 | ||||
| -rw-r--r-- | lib/puppet/type/pfile.rb | 3 |
5 files changed, 27 insertions, 8 deletions
diff --git a/lib/puppet/metatype/instances.rb b/lib/puppet/metatype/instances.rb index 4fd72e85c..4af230b28 100644 --- a/lib/puppet/metatype/instances.rb +++ b/lib/puppet/metatype/instances.rb @@ -137,9 +137,8 @@ class Puppet::Type # now pass through and create the new object elsif implicit - Puppet.notice "Ignoring implicit %s" % title - - return retobj + Puppet.debug "Ignoring implicit %s[%s]" % [self.name, title] + return nil else # If only one of the objects is being managed, then merge them if retobj.managed? 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 diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index 43889927c..bb8918845 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -26,7 +26,8 @@ class Transaction end end - # Check to see if we should actually allow deleition. + # Check to see if we should actually allow processing, but this really only + # matters when a resource is getting deleted. def allow_processing?(resource, changes) # If a resource is going to be deleted but it still has # dependencies, then don't delete it unless it's implicit or the diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index e55873c2b..19f676ff4 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -316,9 +316,15 @@ class Type def parent return nil unless configuration - # We should never have more than one parent, so let's just ignore - # it if we happen to. - if parents = configuration.relationship_graph.adjacent(self, :direction => :in) + # This is kinda weird. + if implicit? + parents = configuration.relationship_graph.adjacent(self, :direction => :in) + else + parents = configuration.adjacent(self, :direction => :in) + end + if parents + # We should never have more than one parent, so let's just ignore + # it if we happen to. return parents.shift else return nil diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index f2fa6a14d..8b5d6e399 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -650,6 +650,9 @@ module Puppet return nil end end + + # LAK:FIXME This shouldn't be necessary, but as long as we're + # modeling the relationship graph specifically, it is. configuration.relationship_graph.add_edge! self, child unless child.parent raise "Did not set parent of %s" % child.ref |
