diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-01-28 02:08:38 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-01-28 02:08:38 +0000 |
commit | 0a9c8da2c31c22d6713b1c0d6b50ad4759fc6617 (patch) | |
tree | 7e7d738a4c479bd20c38ef2580821678685d5eff | |
parent | f6a3d94fc69e98c812e732f473b77bb34c55faeb (diff) | |
download | puppet-0a9c8da2c31c22d6713b1c0d6b50ad4759fc6617.tar.gz puppet-0a9c8da2c31c22d6713b1c0d6b50ad4759fc6617.tar.xz puppet-0a9c8da2c31c22d6713b1c0d6b50ad4759fc6617.zip |
Changing how transactions check whether a resource is being deleted. This is a small step towards fixing #428.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2102 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r-- | lib/puppet/metatype/attributes.rb | 5 | ||||
-rw-r--r-- | lib/puppet/transaction.rb | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/puppet/metatype/attributes.rb b/lib/puppet/metatype/attributes.rb index 28cefec6a..8956b754b 100644 --- a/lib/puppet/metatype/attributes.rb +++ b/lib/puppet/metatype/attributes.rb @@ -412,6 +412,11 @@ class Puppet::Type self.devfail "Invalid set type %s" % [type] end end + + # Are we deleting this resource? + def deleting? + obj = @states[:ensure] and obj.should == :absent + end # Allow an outside party to specify the 'is' value for a state. The # arguments are an array because you can't use parens with 'is=' calls. diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index 8775c05e6..e184bf128 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -57,7 +57,7 @@ class Transaction # If a resource is going to be deleted but it still has dependencies, then # don't delete it unless it's implicit. - if ! resource.implicit? and deleting?(changes) + if ! resource.implicit? and resource.deleting? if deps = @relgraph.dependents(resource) and ! deps.empty? resource.warning "%s still depend%s on me -- not deleting" % [deps.collect { |r| r.ref }.join(","), if deps.length > 1; ""; else "s"; end] @@ -456,8 +456,6 @@ class Transaction graph.add_edge!(edge) end end - - graph(graph, :relationships) # Lastly, add in any autorequires graph.vertices.each do |vertex| @@ -468,6 +466,8 @@ class Transaction end end + graph(graph, :relationships) + # Then splice in the container information graph.splice!(@resources, Puppet::Type::Component) |