stackit 0.2.8 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stackit/mixin/availability_zone.rb +7 -0
- data/lib/stackit/mixin/opsworks.rb +12 -0
- data/lib/stackit/stack/managed_stack_service.rb +90 -38
- data/lib/stackit/version.rb +1 -1
- data/lib/stackit.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ae87dceb69b924c250e0520eb60e133cdd96d55
|
4
|
+
data.tar.gz: 66b8268399565686f4abdc904b14e4360df71a5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f74864e0c51bb6c9699d8b5a2cba475b88a2d922e62e2b4ac084125207c3219e66548157551142f2d4cc147c958c72fb63fdf581526c4c09a206ce057db882e
|
7
|
+
data.tar.gz: 1ce70a217a4bba624bdf2c4c399aac5df0b9992a760ef404632594bfe010bb22dc934a0f78006c5ce917d2b3690175b2d75e4a4c73a7e57afdd6e2df678e319f
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Stackit::Mixin::OpsWorks
|
2
|
+
|
3
|
+
def opsworks_service_role_arn(key = :OpsWorksServiceRole)
|
4
|
+
"arn:aws:iam::#{Stackit.aws.account_id}:role/#{resolve_parameter(key)}"
|
5
|
+
end
|
6
|
+
|
7
|
+
def opsworks_cookbook_source(key = :DevOpsBucket, cookbook_archive = 'cookbooks.tar.gz')
|
8
|
+
"https://s3.amazonaws.com/#{resolve_parameter(key)}/#{cookbook_archive}"
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
@@ -10,27 +10,33 @@ module Stackit
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def create!
|
13
|
-
|
13
|
+
final_stack.create!
|
14
14
|
end
|
15
15
|
|
16
16
|
def update!
|
17
|
-
|
17
|
+
final_stack.update!
|
18
18
|
end
|
19
19
|
|
20
20
|
def delete!
|
21
|
-
|
21
|
+
final_stack.delete!
|
22
22
|
end
|
23
23
|
|
24
24
|
protected
|
25
25
|
|
26
26
|
def stack_name
|
27
|
-
|
28
|
-
"#{Stackit.environment}-#{options[:stack_name]}"
|
27
|
+
options[:stack_name] || "#{Stackit.environment}-#{options[:stack_name]}"
|
29
28
|
end
|
30
29
|
|
31
30
|
def template
|
32
|
-
|
33
|
-
|
31
|
+
options[:template] || File.expand_path("#{options[:stack_name]}.json", template_dir)
|
32
|
+
end
|
33
|
+
|
34
|
+
def stack_policy
|
35
|
+
options[:template]
|
36
|
+
end
|
37
|
+
|
38
|
+
def stack_policy_during_update
|
39
|
+
options[:stack_policy_during_update]
|
34
40
|
end
|
35
41
|
|
36
42
|
def parameters_file
|
@@ -38,6 +44,10 @@ module Stackit
|
|
38
44
|
File.expand_path("#{options[:stack_name]}.parameters", template_dir)
|
39
45
|
end
|
40
46
|
|
47
|
+
def depends
|
48
|
+
options[:depends]
|
49
|
+
end
|
50
|
+
|
41
51
|
def parameter_mappings
|
42
52
|
{}
|
43
53
|
end
|
@@ -51,43 +61,84 @@ module Stackit
|
|
51
61
|
end
|
52
62
|
|
53
63
|
def disable_rollback
|
54
|
-
true
|
64
|
+
!!options[:debug] ? true : !!options[:disable_rollback]
|
65
|
+
end
|
66
|
+
|
67
|
+
def wait
|
68
|
+
options[:wait]
|
69
|
+
end
|
70
|
+
|
71
|
+
def force
|
72
|
+
options[:force]
|
73
|
+
end
|
74
|
+
|
75
|
+
def dry_run
|
76
|
+
options[:dry_run]
|
77
|
+
end
|
78
|
+
|
79
|
+
def debug
|
80
|
+
!!options[:debug]
|
81
|
+
end
|
82
|
+
|
83
|
+
def timeout_in_minutes
|
84
|
+
options[:timeout_in_minutes]
|
85
|
+
end
|
86
|
+
|
87
|
+
def notification_arns
|
88
|
+
options[:notification_arns]
|
89
|
+
end
|
90
|
+
|
91
|
+
def capabilities
|
92
|
+
options[:capabilities]
|
93
|
+
end
|
94
|
+
|
95
|
+
def tags
|
96
|
+
options[:tags]
|
97
|
+
end
|
98
|
+
|
99
|
+
def on_failure
|
100
|
+
options[:on_failure]
|
101
|
+
end
|
102
|
+
|
103
|
+
def retain_resources
|
104
|
+
options[:retain_resources]
|
105
|
+
end
|
106
|
+
|
107
|
+
def use_previous_template
|
108
|
+
options[:use_previous_template]
|
55
109
|
end
|
56
110
|
|
57
111
|
def stack
|
58
|
-
|
59
|
-
params.merge!(options[:parameters]) if options[:parameters]
|
60
|
-
ManagedStack.new(
|
112
|
+
@stack ||= ManagedStack.new(
|
61
113
|
template: template,
|
62
114
|
stack_name: stack_name,
|
63
|
-
stack_policy:
|
64
|
-
stack_policy_during_update:
|
65
|
-
depends:
|
66
|
-
user_defined_parameters: params,
|
115
|
+
stack_policy: stack_policy,
|
116
|
+
stack_policy_during_update: stack_policy_during_update,
|
117
|
+
depends: depends,
|
67
118
|
parameters_file: parameters_file,
|
68
119
|
parameter_map: parameter_mappings,
|
69
|
-
disable_rollback:
|
70
|
-
wait:
|
71
|
-
force:
|
72
|
-
dry_run:
|
73
|
-
debug:
|
74
|
-
timeout_in_minutes:
|
75
|
-
notification_arns:
|
76
|
-
capabilities:
|
77
|
-
tags:
|
78
|
-
on_failure:
|
79
|
-
use_previous_template:
|
80
|
-
retain_resources:
|
120
|
+
disable_rollback: disable_rollback,
|
121
|
+
wait: wait,
|
122
|
+
force: force,
|
123
|
+
dry_run: dry_run,
|
124
|
+
debug: debug,
|
125
|
+
timeout_in_minutes: timeout_in_minutes,
|
126
|
+
notification_arns: notification_arns,
|
127
|
+
capabilities: capabilities,
|
128
|
+
tags: tags,
|
129
|
+
on_failure: on_failure,
|
130
|
+
use_previous_template: use_previous_template,
|
131
|
+
retain_resources: retain_resources
|
81
132
|
)
|
82
133
|
end
|
83
134
|
|
84
135
|
def depends_stacks
|
85
|
-
|
86
|
-
|
136
|
+
return @depends_stacks unless @depends_stacks.nil?
|
137
|
+
@depends_stacks = []
|
138
|
+
return @depends_stacks unless options[:depends]
|
87
139
|
options[:depends].each do |stack|
|
88
|
-
|
140
|
+
@depends_stacks << Stackit::Stack.new(stack_name: stack)
|
89
141
|
end
|
90
|
-
stacks
|
91
142
|
end
|
92
143
|
|
93
144
|
def stacks
|
@@ -96,7 +147,7 @@ module Stackit
|
|
96
147
|
|
97
148
|
def resolve_parameter(key)
|
98
149
|
depends_stacks.each do |s|
|
99
|
-
value = s[key]
|
150
|
+
value = s[key.to_s]
|
100
151
|
return value unless value.nil?
|
101
152
|
end
|
102
153
|
end
|
@@ -105,19 +156,20 @@ module Stackit
|
|
105
156
|
values = []
|
106
157
|
depends_stacks.each do |s|
|
107
158
|
keys.each do |key|
|
108
|
-
value = s[key]
|
159
|
+
value = s[key.to_s]
|
109
160
|
values << value unless value.nil?
|
110
161
|
end
|
111
162
|
end
|
112
163
|
values.join(',')
|
113
164
|
end
|
114
165
|
|
115
|
-
|
116
|
-
"arn:aws:iam::#{Stackit.aws.account_id}:role/#{resolve_parameter(key)}"
|
117
|
-
end
|
166
|
+
private
|
118
167
|
|
119
|
-
def
|
120
|
-
|
168
|
+
def final_stack
|
169
|
+
params = user_defined_parameters
|
170
|
+
params.merge!(options[:parameters]) if options[:parameters]
|
171
|
+
stack.instance_variable_set(:@user_defined_parameters, user_defined_parameters)
|
172
|
+
stack
|
121
173
|
end
|
122
174
|
|
123
175
|
end
|
data/lib/stackit/version.rb
CHANGED
data/lib/stackit.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stackit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Hahn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -145,6 +145,8 @@ files:
|
|
145
145
|
- lib/stackit/cli/base_cli.rb
|
146
146
|
- lib/stackit/cli/stack_cli.rb
|
147
147
|
- lib/stackit/cli/stackit_cli.rb
|
148
|
+
- lib/stackit/mixin/availability_zone.rb
|
149
|
+
- lib/stackit/mixin/opsworks.rb
|
148
150
|
- lib/stackit/stack.rb
|
149
151
|
- lib/stackit/stack/default-stack-policy.json
|
150
152
|
- lib/stackit/stack/default_notifier.rb
|