Class: OpsDeploy::DeploymentWaiter

Inherits:
Waiter
  • Object
show all
Defined in:
lib/ops_deploy/waiter.rb

Instance Attribute Summary

Attributes inherited from Waiter

#callback, #data, #end_when

Instance Method Summary collapse

Constructor Details

#initialize(opsworks, deployment, callback = nil) ⇒ DeploymentWaiter



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/ops_deploy/waiter.rb', line 28

def initialize(opsworks, deployment, callback = nil)
  super() {
    deploy = opsworks.describe_deployments(deployment_ids: [deployment.deployment_id]).deployments.first

    # Retry if there's no duration
    if deploy.status != "running" and deploy.duration.nil?
      deploy = opsworks.describe_deployments(deployment_ids: [deployment.deployment_id]).deployments.first
    end

    deploy
  }

  @end_when = Proc.new {
    |deployment_obj|
    deployment_obj.status != "running"
  }

  @callback = callback
end