autostacker24 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/autostacker24/stacker.rb +12 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6210a52e8c14cb3667edf24744b0b75aa3dbaf3d
|
4
|
+
data.tar.gz: ec2a091c5f96b41cdde1efba6a0baf7de7acd0f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 339109e33de55680a01d41003b6ac9706bba72228b486b04e53585986087ce76c380d215b920f3007915ebe05db45060a089db0953398c79a98545190dd82f11
|
7
|
+
data.tar.gz: 5eebb293cc28bee1f895ff24795f9e0307c68e512cce3e63e6b33f12ff4dbf06a3d060e04201ba3f8a7342aefdb1c041345bfed5b7c112d83b46d41fef1dbd50
|
@@ -7,6 +7,8 @@ require_relative 'template_preprocessor.rb'
|
|
7
7
|
STDOUT.sync = true
|
8
8
|
STDERR.sync = true
|
9
9
|
|
10
|
+
DEFAULT_TIMEOUT = 60
|
11
|
+
|
10
12
|
module Stacker
|
11
13
|
|
12
14
|
attr_reader :region, :credentials
|
@@ -26,15 +28,15 @@ module Stacker
|
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
29
|
-
def create_or_update_stack(stack_name, template, parameters, parent_stack_name = nil, tags = nil)
|
31
|
+
def create_or_update_stack(stack_name, template, parameters, parent_stack_name = nil, tags = nil, timeout_in_minutes = DEFAULT_TIMEOUT)
|
30
32
|
if find_stack(stack_name).nil?
|
31
|
-
create_stack(stack_name, template, parameters, parent_stack_name, tags)
|
33
|
+
create_stack(stack_name, template, parameters, parent_stack_name, tags, timeout_in_minutes)
|
32
34
|
else
|
33
|
-
update_stack(stack_name, template, parameters, parent_stack_name, tags)
|
35
|
+
update_stack(stack_name, template, parameters, parent_stack_name, tags, timeout_in_minutes)
|
34
36
|
end
|
35
37
|
end
|
36
38
|
|
37
|
-
def create_stack(stack_name, template, parameters, parent_stack_name = nil, tags = nil)
|
39
|
+
def create_stack(stack_name, template, parameters, parent_stack_name = nil, tags = nil, timeout_in_minutes = DEFAULT_TIMEOUT)
|
38
40
|
merge_and_validate(template, parameters, parent_stack_name)
|
39
41
|
cloud_formation.create_stack(stack_name: stack_name,
|
40
42
|
template_body: template_body(template),
|
@@ -42,10 +44,10 @@ module Stacker
|
|
42
44
|
parameters: transform_input(parameters),
|
43
45
|
capabilities: ['CAPABILITY_IAM'],
|
44
46
|
tags: tags)
|
45
|
-
wait_for_stack(stack_name, :create)
|
47
|
+
wait_for_stack(stack_name, :create, Set.new, timeout_in_minutes)
|
46
48
|
end
|
47
49
|
|
48
|
-
def update_stack(stack_name, template, parameters, parent_stack_name = nil, tags = nil)
|
50
|
+
def update_stack(stack_name, template, parameters, parent_stack_name = nil, tags = nil, timeout_in_minutes = DEFAULT_TIMEOUT)
|
49
51
|
seen_events = get_stack_events(stack_name).map {|e| e[:event_id]}
|
50
52
|
begin
|
51
53
|
merge_and_validate(template, parameters, parent_stack_name)
|
@@ -59,7 +61,7 @@ module Stacker
|
|
59
61
|
puts "stack #{stack_name} is already up to date"
|
60
62
|
find_stack(stack_name)
|
61
63
|
else
|
62
|
-
wait_for_stack(stack_name, :update, seen_events)
|
64
|
+
wait_for_stack(stack_name, :update, seen_events, timeout_in_minutes)
|
63
65
|
end
|
64
66
|
end
|
65
67
|
|
@@ -85,14 +87,13 @@ module Stacker
|
|
85
87
|
cloud_formation.validate_template(template_body: template_body(template))
|
86
88
|
end
|
87
89
|
|
88
|
-
def delete_stack(stack_name)
|
90
|
+
def delete_stack(stack_name, timeout_in_minutes = 60)
|
89
91
|
seen_events = get_stack_events(stack_name).map {|e| e[:event_id]}
|
90
92
|
cloud_formation.delete_stack(stack_name: stack_name)
|
91
|
-
wait_for_stack(stack_name, :delete, seen_events)
|
93
|
+
wait_for_stack(stack_name, :delete, seen_events, timeout_in_minutes)
|
92
94
|
end
|
93
95
|
|
94
|
-
def wait_for_stack(stack_name, operation, seen_events = Set.new)
|
95
|
-
timeout_in_minutes = 60 # for now
|
96
|
+
def wait_for_stack(stack_name, operation, seen_events = Set.new, timeout_in_minutes = DEFAULT_TIMEOUT)
|
96
97
|
stop_time = Time.now + timeout_in_minutes * 60
|
97
98
|
finished = /(CREATE_COMPLETE|UPDATE_COMPLETE|DELETE_COMPLETE|ROLLBACK_COMPLETE|ROLLBACK_FAILED|CREATE_FAILED|DELETE_FAILED)$/
|
98
99
|
puts "waiting for #{operation} stack #{stack_name}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autostacker24
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johannes Mueller
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-05
|
12
|
+
date: 2016-07-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk-core
|