opsworks_interactor 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/opsworks_interactor.rb +9 -15
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62f1a9b712c88917063bf1d15779f12231602fc2
|
4
|
+
data.tar.gz: f2837796d701ce11d9bd6e859b759465de56b82d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b86bf385a08ccd2c49a329c52707b59558582c4d7dc8fea2d55547ce31dac2de2d77391b2a64ce227693692907e929851723ca881e72d1d7e8ea71bc257a5f03
|
7
|
+
data.tar.gz: b7cf663266bc0142a52b0670e0a6aed09839715986731b72da461ce2b8035e8376ac8589a8430a600456d2411f61f27f8c3253a7151681ceac03f5ab2aa48796
|
data/lib/opsworks_interactor.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'aws-sdk'
|
2
|
+
require 'timeout'
|
2
3
|
class OpsworksInteractor
|
3
|
-
Aws::Waiters::Errors::TimeoutError = Class.new(Aws::Waiters::Errors::WaiterFailed)
|
4
|
-
|
5
4
|
begin
|
6
5
|
require 'redis-semaphore'
|
7
6
|
rescue LoadError
|
@@ -75,18 +74,13 @@ class OpsworksInteractor
|
|
75
74
|
# Polls Opsworks for timeout seconds until deployment_id has completed
|
76
75
|
def wait_until_deploy_completion(deployment_id, timeout)
|
77
76
|
started_at = Time.now
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
# poll for a time period, instead of a number of attempts
|
86
|
-
before_wait do |_attempts, _response|
|
87
|
-
if (Time.now - started_at) > timeout
|
88
|
-
raise Aws::Waiters::Errors::TimeoutError
|
89
|
-
end
|
77
|
+
Timeout::timeout(timeout) do
|
78
|
+
@opsworks_client.wait_until(
|
79
|
+
:deployment_successful,
|
80
|
+
deployment_ids: [deployment_id]
|
81
|
+
) do |w|
|
82
|
+
# disable max attempts
|
83
|
+
w.max_attempts = nil
|
90
84
|
end
|
91
85
|
end
|
92
86
|
end
|
@@ -115,7 +109,7 @@ class OpsworksInteractor
|
|
115
109
|
instance_id: instance.instance_id
|
116
110
|
)
|
117
111
|
ensure
|
118
|
-
attach_to_elbs(instance: instance, load_balancers: load_balancers) if
|
112
|
+
attach_to_elbs(instance: instance, load_balancers: load_balancers) if load_balancers
|
119
113
|
|
120
114
|
log("=== Done deploying on #{instance.hostname} ===\n\n")
|
121
115
|
end
|