opendelivery 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/opendelivery/stack.rb +51 -51
- metadata +1 -1
data/lib/opendelivery/stack.rb
CHANGED
@@ -72,71 +72,71 @@ module OpenDelivery
|
|
72
72
|
end
|
73
73
|
@domain.destroy_item(domain, stack_name)
|
74
74
|
end
|
75
|
+
end
|
75
76
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
end
|
77
|
+
def list
|
78
|
+
@cfn.stacks.each do |stack|
|
79
|
+
puts "Stack Name: #{stack.name} | Status: #{stack.status}"
|
80
80
|
end
|
81
|
+
end
|
81
82
|
|
82
|
-
|
83
|
+
protected
|
83
84
|
|
84
|
-
|
85
|
-
|
86
|
-
|
85
|
+
def wait_for_stack(stack)
|
86
|
+
while stack.status != "CREATE_COMPLETE"
|
87
|
+
sleep 20
|
87
88
|
|
88
|
-
|
89
|
-
|
90
|
-
end
|
89
|
+
if FAILURE_STATUSES.include? stack.status
|
90
|
+
stack.delete
|
91
91
|
end
|
92
92
|
end
|
93
|
+
end
|
93
94
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
end
|
95
|
+
def print_status(status, silent)
|
96
|
+
timestamp = Time.now.strftime("%Y.%m.%d %H:%M:%S:%L")
|
97
|
+
unless silent
|
98
|
+
puts "#{timestamp}: #{status}"
|
99
99
|
end
|
100
|
+
end
|
100
101
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
print_status(status, silent)
|
116
|
-
success = false
|
117
|
-
keep_watching = true
|
118
|
-
elsif (FAILURE_STATUSES.include? stack_status)
|
119
|
-
status = "Failed: #{stack_status}"
|
120
|
-
print_status(status, silent)
|
121
|
-
success = false
|
122
|
-
keep_watching = false
|
123
|
-
else
|
124
|
-
status = "didn't find #{stack_status} in the list of expected statuses"
|
125
|
-
print_status(status, silent)
|
126
|
-
success = false
|
127
|
-
abort_count = abort_count - 1
|
128
|
-
# if we get too many unknown statuses, assume something has gone horribly wrong and quit.
|
129
|
-
keep_watching = (abort_count > 0)
|
130
|
-
end
|
131
|
-
rescue AWS::CloudFormation::Errors::Throttling
|
132
|
-
status = "Rate limit exceeded, retrying..."
|
102
|
+
def watch_loop(stack, sleep_time, silent)
|
103
|
+
keep_watching = true
|
104
|
+
success = false
|
105
|
+
abort_count = 10
|
106
|
+
while(keep_watching) do
|
107
|
+
begin
|
108
|
+
stack_status = stack.status
|
109
|
+
if (SUCCESS_STATUSES.include? stack_status)
|
110
|
+
status = "Success: #{stack_status}"
|
111
|
+
print_status(status, silent)
|
112
|
+
success = true
|
113
|
+
keep_watching = false
|
114
|
+
elsif (PROGRESS_STATUSES.include? stack_status)
|
115
|
+
status = "In Progress: #{stack_status}"
|
133
116
|
print_status(status, silent)
|
134
|
-
|
117
|
+
success = false
|
118
|
+
keep_watching = true
|
119
|
+
elsif (FAILURE_STATUSES.include? stack_status)
|
120
|
+
status = "Failed: #{stack_status}"
|
121
|
+
print_status(status, silent)
|
122
|
+
success = false
|
123
|
+
keep_watching = false
|
124
|
+
else
|
125
|
+
status = "didn't find #{stack_status} in the list of expected statuses"
|
126
|
+
print_status(status, silent)
|
127
|
+
success = false
|
128
|
+
abort_count = abort_count - 1
|
129
|
+
# if we get too many unknown statuses, assume something has gone horribly wrong and quit.
|
130
|
+
keep_watching = (abort_count > 0)
|
135
131
|
end
|
136
|
-
|
132
|
+
rescue AWS::CloudFormation::Errors::Throttling
|
133
|
+
status = "Rate limit exceeded, retrying..."
|
134
|
+
print_status(status, silent)
|
135
|
+
sleep (sleep_time * 0.1)
|
137
136
|
end
|
138
|
-
|
137
|
+
sleep(sleep_time)
|
139
138
|
end
|
139
|
+
return success
|
140
140
|
end
|
141
141
|
end
|
142
142
|
end
|