Class: EPC::Command::UndeployCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- EPC::Command::UndeployCommand
- Defined in:
- lib/epc/command/undeploy_command.rb
Constant Summary collapse
- SLEEP_TIME =
1
- TICKER_TICKS =
Numerators are in secs
25/SLEEP_TIME
- GIVEUP_TICKS =
120/SLEEP_TIME
Instance Attribute Summary
Attributes inherited from BaseCommand
#client, #klass_name, #object_id, #object_type, #options, #target_id, #target_type
Instance Method Summary collapse
Methods inherited from BaseCommand
#check_options, #context_params, #context_params=, #go, include_module, inherited, #initialize, required_options, #say_err
Methods included from PersistentAttributes
#auth_token, #caller_id, #target_url
Constructor Details
This class inherits a constructor from EPC::Command::BaseCommand
Instance Method Details
#execute(deployment_id = nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/epc/command/undeploy_command.rb', line 8 def execute(deployment_id = nil) path = File.(".") solution_name = @options[:solution_name] if deployment_id.nil? solution_id, solution_name = infer_solution_context(solution_name, path) if solution_id.nil? || solution_name.empty? say("Solution could not be inferred") say(EPC::Help::COMMAND_USAGES[:undeploy]) return 1 end cmd = ListDeploymentsCommand.new(client, {:solution_name => solution_id, :status => "STARTED"}).execute return 1 if cmd == 1 deployment_id = ask("Enter deployment id: ", Integer) end if deployment_id.nil? say("You must specify a deployment id") say(EPC::Help::COMMAND_USAGES[:undeploy]) return 1 end begin say("Undeploying #{deployment_id}") undeploy(deployment_id) say("Undeploying - ") shown, deployment_status = poll_for_deployment_statuses(deployment_id) if shown display_statuses(deployment_status) end rescue Exception => ex say("Undeploy failed [#{ex.to_s}].") end return @status end |