Class: EPC::Command::UpdateDeploymentCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- EPC::Command::UpdateDeploymentCommand
- Defined in:
- lib/epc/command/deployment/update_deployment_command.rb
Constant Summary
Constants inherited from BaseCommand
BaseCommand::GIVEUP_TICKS, BaseCommand::SLEEP_TIME, BaseCommand::TICKER_TICKS
Instance Attribute Summary
Attributes inherited from BaseCommand
Instance Method Summary collapse
Methods inherited from BaseCommand
#go, inherited, #initialize, required_options
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, target = nil, *args) ⇒ Object
4 5 6 7 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 |
# File 'lib/epc/command/deployment/update_deployment_command.rb', line 4 def execute(deployment_id = nil, target = nil, *args) project_id = target.split(":")[1] rescue nil instances = [:instances] uris = [:uris] raise FatalError, "You need to specify either an instance count or uris" if blank?(instances) && blank?(uris) if numeric?(project_id) field = :id project_id = project_id.to_i else field = :name end deployed_project_id = get_deployed_project_id(deployment_id, field, project_id) raise FatalError, "Deployed project id not found" if deployed_project_id.nil? params = {} params[:instances] = instances.to_i unless blank?(instances) params[:uris] = uris.split(",") unless blank?(uris) status, response, headers = client.put(EPC::Config::DEPLOYMENTS_PATH + "/#{deployment_id}/deployed_projects/#{deployed_project_id}", params) if status.successful? say("Deployment updated") else say("Request failed with: [#{response[:message]}]") end return status end |