opendelivery 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/opendelivery/stack.rb +56 -55
  2. metadata +1 -1
@@ -66,76 +66,77 @@ module OpenDelivery
66
66
  def destroy(stack_name, domain=nil, wait=false)
67
67
  stack = @cfn.stacks[stack_name]
68
68
  unless stack.exists? raise "Stack: #{stack_name} doesn't exist, therefore it cannot be destroyed"
69
- stack.delete
70
- while wait and stack.exists?
71
- sleep 20
69
+ stack.delete
70
+ while wait and stack.exists?
71
+ sleep 20
72
+ end
73
+ @domain.destroy_item(domain, stack_name)
72
74
  end
73
- @domain.destroy_item(domain, stack_name)
74
- end
75
75
 
76
- def list
77
- @cfn.stacks.each do |stack|
78
- puts "Stack Name: #{stack.name} | Status: #{stack.status}"
76
+ def list
77
+ @cfn.stacks.each do |stack|
78
+ puts "Stack Name: #{stack.name} | Status: #{stack.status}"
79
+ end
79
80
  end
80
- end
81
81
 
82
- private
82
+ private
83
83
 
84
- def wait_for_stack(stack)
85
- while stack.status != "CREATE_COMPLETE"
86
- sleep 20
84
+ def wait_for_stack(stack)
85
+ while stack.status != "CREATE_COMPLETE"
86
+ sleep 20
87
87
 
88
- if FAILURE_STATUSES.include? stack.status
89
- stack.delete
88
+ if FAILURE_STATUSES.include? stack.status
89
+ stack.delete
90
+ end
90
91
  end
91
92
  end
92
- end
93
93
 
94
- def print_status(status, silent)
95
- timestamp = Time.now.strftime("%Y.%m.%d %H:%M:%S:%L")
96
- unless silent
97
- puts "#{timestamp}: #{status}"
94
+ def print_status(status, silent)
95
+ timestamp = Time.now.strftime("%Y.%m.%d %H:%M:%S:%L")
96
+ unless silent
97
+ puts "#{timestamp}: #{status}"
98
+ end
98
99
  end
99
- end
100
100
 
101
- def watch_loop(stack, sleep_time, silent)
102
- keep_watching = true
103
- success = false
104
- abort_count = 10
105
- while(keep_watching) do
106
- begin
107
- stack_status = stack.status
108
- if (SUCCESS_STATUSES.include? stack_status)
109
- status = "Success: #{stack_status}"
110
- print_status(status, silent)
111
- success = true
112
- keep_watching = false
113
- elsif (PROGRESS_STATUSES.include? stack_status)
114
- status = "In Progress: #{stack_status}"
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"
101
+ def watch_loop(stack, sleep_time, silent)
102
+ keep_watching = true
103
+ success = false
104
+ abort_count = 10
105
+ while(keep_watching) do
106
+ begin
107
+ stack_status = stack.status
108
+ if (SUCCESS_STATUSES.include? stack_status)
109
+ status = "Success: #{stack_status}"
110
+ print_status(status, silent)
111
+ success = true
112
+ keep_watching = false
113
+ elsif (PROGRESS_STATUSES.include? stack_status)
114
+ status = "In Progress: #{stack_status}"
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..."
125
133
  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)
134
+ sleep (sleep_time * 0.1)
130
135
  end
131
- rescue AWS::CloudFormation::Errors::Throttling
132
- status = "Rate limit exceeded, retrying..."
133
- print_status(status, silent)
134
- sleep (sleep_time * 0.1)
136
+ sleep(sleep_time)
135
137
  end
136
- sleep(sleep_time)
138
+ return success
137
139
  end
138
- return success
139
140
  end
140
141
  end
141
142
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opendelivery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: