Module: Nucleus::Adapters::V1::OpenshiftV2::AppStates
- Included in:
- Nucleus::Adapters::V1::OpenshiftV2
- Defined in:
- lib/nucleus/adapters/v1/openshift_v2/app_states.rb
Instance Method Summary collapse
-
#application_state(app, gear_groups = nil, deployments = nil) ⇒ Symbol
Determine the current state of the application in the Nucleus lifecycle.
Instance Method Details
#application_state(app, gear_groups = nil, deployments = nil) ⇒ Symbol
Determine the current state of the application in the Nucleus lifecycle.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/nucleus/adapters/v1/openshift_v2/app_states.rb', line 8 def application_state(app, gear_groups = nil, deployments = nil) deployments = load_deployments(app[:id]) unless deployments gear_groups = load_gears(app[:id]) unless gear_groups return :created if state_created?(app, gear_groups, deployments) return :deployed if state_deployed?(app, gear_groups, deployments) return :running if gear_groups[0][:gears].any? { |gear| gear[:state] == 'started' } return :stopped if gear_groups[0][:gears].all? { |gear| gear[:state] == 'stopped' } return :idle if gear_groups[0][:gears].all? { |gear| gear[:state] == 'idle' } log.debug("Failed to determine state for: #{app}") fail Errors::UnknownAdapterCallError, 'Could not determine app state. Please verify the Openshift V2 adapter' end |