diff options
author | Casey Dahlin <cdahlin@redhat.com> | 2008-10-03 17:14:58 -0400 |
---|---|---|
committer | Casey Dahlin <cdahlin@redhat.com> | 2008-10-03 17:14:58 -0400 |
commit | f781921d50493a886d6b214af7b77ae293ee1a7d (patch) | |
tree | d5985ec4d7a6a79e0b542164f46121dacf281c69 | |
parent | 7c5adf0c59a35bb48941d9e860d1dca109b2859b (diff) | |
download | upstate-f781921d50493a886d6b214af7b77ae293ee1a7d.tar.gz upstate-f781921d50493a886d6b214af7b77ae293ee1a7d.tar.xz upstate-f781921d50493a886d6b214af7b77ae293ee1a7d.zip |
Fix depsolving logic to handle depless services
Services with no dependencies no longer cause failure
-rw-r--r-- | state.rb | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -195,11 +195,19 @@ class State active_states = @@states.select{ |x| x.active } candidates = @depends.map{ |d| active_states.select{ |s| d.match s } } return nil if candidates.include? [] - candidates[0].product(*candidates[1..-1]).map{ |x| x.to_set } \ - .select{ |x| x.inject(true){ |st, y| st and y.rooted_in x } } \ - .reject do |dset| - active_states.select{ |x| x.is_a? self and x.deps == dset }.size > 0 - end.each{ |x| self.new x } + + unless candidates == [] + candidates = candidates[0].product(*candidates[1..-1]).map{ |x| x.to_set } \ + .select{ |x| x.size == 0 or x.inject(true){ |st, y| st and y.rooted_in x } } + else + candidates = [Set.new] + end + + candidates.reject! do |dset| + active_states.select{ |x| x.is_a? self and x.deps == dset }.size > 0 + end + + candidates.each{ |x| self.new x } end # Depsolve all state classes. This method is not defined in subclasses of |