diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-02-28 05:32:46 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-02-28 05:32:46 +0000 |
commit | d229d49c5614c5ca9e15ae5716968a184f6f1bc7 (patch) | |
tree | 208381631a0d9f7e995cfcb16a27c8210fb05fcb /lib | |
parent | be8dfd92b4d1212a9beaa520f80043fe67e0bbbb (diff) | |
download | puppet-d229d49c5614c5ca9e15ae5716968a184f6f1bc7.tar.gz puppet-d229d49c5614c5ca9e15ae5716968a184f6f1bc7.tar.xz puppet-d229d49c5614c5ca9e15ae5716968a184f6f1bc7.zip |
Fixing at least part of #514. This does not get rid of all errors, but at least it fixes the spurious warning
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2241 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/transaction.rb | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index 2a83ea630..182534de7 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -35,6 +35,22 @@ class Transaction end end + # Check to see if we should actually allow deleition. + 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 + # dependency is itself being deleted. + if ! resource.implicit? and resource.deleting? + if deps = @relgraph.dependents(resource) and ! deps.empty? and deps.detect { |d| ! d.deleting? } + resource.warning "%s still depend%s on me -- not deleting" % + [deps.collect { |r| r.ref }.join(","), deps.length > 1 ? "":"s"] + return false + end + end + + return true + end + # Apply all changes for a resource, returning a list of the events # generated. def apply(resource) @@ -54,17 +70,6 @@ class Transaction return [] end changes = [changes] unless changes.is_a?(Array) - - # If a resource is going to be deleted but it still has dependencies, then - # don't delete it unless it's implicit or the dependency is itself being - # deleted. - if ! resource.implicit? and resource.deleting? - if deps = @relgraph.dependents(resource) and ! deps.empty? and deps.detect { |d| ! d.deleting? } - resource.warning "%s still depend%s on me -- not deleting" % - [deps.collect { |r| r.ref }.join(","), if deps.length > 1; ""; else "s"; end] - return [] - end - end unless changes.is_a? Array changes = [changes] @@ -74,6 +79,8 @@ class Transaction @resourcemetrics[:out_of_sync] += 1 end + return [] if changes.empty? or ! allow_processing?(resource, changes) + resourceevents = apply_changes(resource, changes) unless changes.empty? |