Skip to content

Commit

Permalink
Merge pull request #18487 from kbrock/service_vms-power_state
Browse files Browse the repository at this point in the history
Speed up Service access
  • Loading branch information
Fryguy authored Mar 25, 2019
2 parents 3dfb0b0 + ff8ee93 commit 20b5b2d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/models/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,21 @@ def power_states_match?(action)
end

def all_states_match?(action)
return true if composite? && (power_states.uniq == map_power_states(action))
return true if atomic? && (power_states[0] == POWER_STATE_MAP[action])
false
if composite?
power_states.uniq == map_power_states(action)
else
power_states[0] == POWER_STATE_MAP[action]
end
end

# @return true if this is a composite service
def composite?
children.present?
end

# @return true if this is a single service (not made up of multiple services)
def atomic?
children.empty?
!composite?
end

def orchestration_stacks
Expand Down

0 comments on commit 20b5b2d

Please sign in to comment.