summaryrefslogtreecommitdiffstats
path: root/state.rb
diff options
context:
space:
mode:
authorCasey Dahlin <cdahlin@redhat.com>2008-10-10 16:30:14 -0400
committerCasey Dahlin <cdahlin@redhat.com>2008-10-10 16:30:14 -0400
commiteab22be32d53d8a82571a48124f78c745299ae9c (patch)
tree30248842d41e01cf63816fa0ba96b18ff5506390 /state.rb
parent8b070c38e555df5c98e7d6648672dbe5806c7085 (diff)
downloadupstate-eab22be32d53d8a82571a48124f78c745299ae9c.tar.gz
upstate-eab22be32d53d8a82571a48124f78c745299ae9c.tar.xz
upstate-eab22be32d53d8a82571a48124f78c745299ae9c.zip
Make State#check_deps behave properly when dropping
State#check_deps used to throw an exception if called for a dropping receiver. Now check_deps is a no-op on dropping states.
Diffstat (limited to 'state.rb')
-rw-r--r--state.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/state.rb b/state.rb
index 56322a1..c1f6c9f 100644
--- a/state.rb
+++ b/state.rb
@@ -78,10 +78,13 @@ class State
# Make sure our deps are satisfied, and remove ourselves from the list of
# states if they aren't
def check_deps
+ return if @status == :dropping
@deps.each do |dep|
dep = dep.state
next if dep.status != :down
- raise ConsistencyFault, "Lost dep on #{dep} without notify for #{self}" if @status != :down
+ unless @status == :down
+ raise ConsistencyFault, "Lost dep on #{dep} without notify for #{self}"
+ end
@@states.delete self
#self.methods.each{ |x| define_method(x, :"*args"){ raise ConsistencyFault, "Operation on dead state" } }
self.freeze