summaryrefslogtreecommitdiffstats
path: root/state.rb
diff options
context:
space:
mode:
authorCasey Dahlin <cdahlin@redhat.com>2008-10-10 16:38:26 -0400
committerCasey Dahlin <cdahlin@redhat.com>2008-10-10 16:38:26 -0400
commitcccfc879a4e45f3dccecd99533d6dbeb9b2a53b2 (patch)
treedcfd8e3580bf173e67844b83af381e92b022d95e /state.rb
parenteab22be32d53d8a82571a48124f78c745299ae9c (diff)
downloadupstate-cccfc879a4e45f3dccecd99533d6dbeb9b2a53b2.tar.gz
upstate-cccfc879a4e45f3dccecd99533d6dbeb9b2a53b2.tar.xz
upstate-cccfc879a4e45f3dccecd99533d6dbeb9b2a53b2.zip
Better release comparison
State#release will now release all holds which match (should be rare) and matches holds more correctly.
Diffstat (limited to 'state.rb')
-rw-r--r--state.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/state.rb b/state.rb
index c1f6c9f..b82b81f 100644
--- a/state.rb
+++ b/state.rb
@@ -155,11 +155,12 @@ class State
# Release a hold on this state. Arguments are the same as for +hold+.
def release(hold, params = {})
+ return if @holds.size == 0
hold = Hold::Dep.new(hold) if hold.is_a? State
hold = Hold::User.new(params) if hold == :user
hold = Hold::System.new(params) if hold == :system
raise TypeError unless hold.is_a? Hold
- @holds.delete hold
+ @holds.reject!{ |x| hold == x }
drop if @holds.size == 0
self
end