leeroy_app 0.2.0 → 0.2.1
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.
- checksums.yaml +4 -4
- data/.codeclimate.yml +26 -0
- data/.rubocop.yml +1156 -0
- data/Gemfile.lock +1 -1
- data/lib/leeroy/helpers/aws.rb +37 -52
- data/lib/leeroy/helpers/dumpable.rb +0 -4
- data/lib/leeroy/helpers/env.rb +0 -2
- data/lib/leeroy/state.rb +1 -1
- data/lib/leeroy/task/base.rb +4 -4
- data/lib/leeroy/task/stub.rb +0 -4
- data/lib/leeroy/version.rb +1 -1
- metadata +4 -2
data/Gemfile.lock
CHANGED
data/lib/leeroy/helpers/aws.rb
CHANGED
@@ -27,20 +27,24 @@ module Leeroy
|
|
27
27
|
logger.debug "AWS helpers initialized"
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
def ec2Request(method, params = {}, ec2 = self.ec2, options = self.options, global_options = self.global_options)
|
30
|
+
def awsRequest(service, method, params = {}, global_options = self.global_options)
|
33
31
|
begin
|
34
|
-
logger.debug "constructing
|
32
|
+
logger.debug "constructing AWS request for '#{service}: #{method}'"
|
33
|
+
|
34
|
+
client = self.send(service.to_sym)
|
35
35
|
|
36
36
|
params_mash = Leeroy::Types::Mash.new(params)
|
37
37
|
params = params_mash
|
38
38
|
|
39
|
-
dry_run
|
39
|
+
# dry_run is an ec2 thing
|
40
|
+
case service.to_sym
|
41
|
+
when :ec2
|
42
|
+
dry_run = global_options[:op] ? false : true
|
40
43
|
|
41
|
-
|
44
|
+
params.dry_run = dry_run
|
45
|
+
end
|
42
46
|
|
43
|
-
resp =
|
47
|
+
resp = client.send(method.to_sym, params)
|
44
48
|
|
45
49
|
logger.debug "resp: #{resp.inspect}"
|
46
50
|
|
@@ -51,7 +55,19 @@ module Leeroy
|
|
51
55
|
end
|
52
56
|
end
|
53
57
|
|
54
|
-
|
58
|
+
# EC2
|
59
|
+
|
60
|
+
def ec2Request(method, params = {}, global_options = self.global_options)
|
61
|
+
begin
|
62
|
+
awsRequest(:ec2, method, params, global_options)
|
63
|
+
|
64
|
+
rescue Aws::EC2::Errors::DryRunOperation => e
|
65
|
+
logger.info e.message
|
66
|
+
"DRYRUN_DUMMY_VALUE: #{self.class.to_s}"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def getVpcId(vpcname)
|
55
71
|
begin
|
56
72
|
logger.debug "getting VPC ID for '#{vpcname}'"
|
57
73
|
|
@@ -79,7 +95,7 @@ module Leeroy
|
|
79
95
|
end
|
80
96
|
end
|
81
97
|
|
82
|
-
def getSgId(sgname, vpcname, vpcid
|
98
|
+
def getSgId(sgname, vpcname, vpcid)
|
83
99
|
begin
|
84
100
|
logger.debug "getting SG ID for '#{sgname}'"
|
85
101
|
|
@@ -132,7 +148,7 @@ module Leeroy
|
|
132
148
|
|
133
149
|
rescue Aws::EC2::Errors::DryRunOperation => e
|
134
150
|
logger.info e.message
|
135
|
-
"DRYRUN_DUMMY_VALUE: #{self.class
|
151
|
+
"DRYRUN_DUMMY_VALUE: #{self.class}"
|
136
152
|
|
137
153
|
rescue StandardError => e
|
138
154
|
raise e
|
@@ -158,7 +174,7 @@ module Leeroy
|
|
158
174
|
|
159
175
|
rescue Aws::EC2::Errors::DryRunOperation => e
|
160
176
|
logger.info e.message
|
161
|
-
"DRYRUN_DUMMY_VALUE: #{self.class
|
177
|
+
"DRYRUN_DUMMY_VALUE: #{self.class}"
|
162
178
|
|
163
179
|
rescue StandardError => e
|
164
180
|
raise e
|
@@ -166,7 +182,7 @@ module Leeroy
|
|
166
182
|
end
|
167
183
|
|
168
184
|
|
169
|
-
def createTags(tags = {}, resourceids = [], state = self.state, env = self.env,
|
185
|
+
def createTags(tags = {}, resourceids = [], state = self.state, env = self.env, options = self.options)
|
170
186
|
begin
|
171
187
|
if resourceids.length == 0
|
172
188
|
if state.instanceid?
|
@@ -190,7 +206,7 @@ module Leeroy
|
|
190
206
|
|
191
207
|
rescue Aws::EC2::Errors::DryRunOperation => e
|
192
208
|
logger.info e.message
|
193
|
-
"DRYRUN_DUMMY_VALUE: #{self.class
|
209
|
+
"DRYRUN_DUMMY_VALUE: #{self.class}"
|
194
210
|
|
195
211
|
rescue StandardError => e
|
196
212
|
raise e
|
@@ -210,7 +226,7 @@ module Leeroy
|
|
210
226
|
|
211
227
|
rescue Aws::EC2::Errors::DryRunOperation => e
|
212
228
|
logger.info e.message
|
213
|
-
"DRYRUN_DUMMY_VALUE: #{self.class
|
229
|
+
"DRYRUN_DUMMY_VALUE: #{self.class}"
|
214
230
|
|
215
231
|
rescue StandardError => e
|
216
232
|
raise e
|
@@ -277,7 +293,8 @@ module Leeroy
|
|
277
293
|
image_names = filterImages(selector, collector)
|
278
294
|
image_numbers = image_names.collect do |name|
|
279
295
|
if name =~ /(\d+)$/
|
280
|
-
|
296
|
+
# extract numeric suffixes of names, convert to Integers
|
297
|
+
$1.to_i
|
281
298
|
end
|
282
299
|
end
|
283
300
|
|
@@ -290,27 +307,11 @@ module Leeroy
|
|
290
307
|
|
291
308
|
# RDS
|
292
309
|
|
293
|
-
def rdsRequest(method, params = {},
|
294
|
-
|
295
|
-
logger.debug "constructing RDS request for '#{method}'"
|
296
|
-
|
297
|
-
params_mash = Leeroy::Types::Mash.new(params)
|
298
|
-
params = params_mash
|
299
|
-
|
300
|
-
logger.debug "params: #{params.inspect}"
|
301
|
-
|
302
|
-
resp = rds.send(method.to_sym, params)
|
303
|
-
|
304
|
-
logger.debug "resp: #{resp.inspect}"
|
305
|
-
|
306
|
-
resp
|
307
|
-
|
308
|
-
rescue StandardError => e
|
309
|
-
raise e
|
310
|
-
end
|
310
|
+
def rdsRequest(method, params = {}, global_options = self.global_options)
|
311
|
+
awsRequest(:rds, method, params, global_options)
|
311
312
|
end
|
312
313
|
|
313
|
-
def getRDSInstanceEndpoint(instancename
|
314
|
+
def getRDSInstanceEndpoint(instancename)
|
314
315
|
begin
|
315
316
|
logger.debug "getting DB Instance Endpoint for '#{instancename}'"
|
316
317
|
|
@@ -331,24 +332,8 @@ module Leeroy
|
|
331
332
|
|
332
333
|
# S3
|
333
334
|
|
334
|
-
def s3Request(method, params = {},
|
335
|
-
|
336
|
-
logger.debug "constructing S3 request for '#{method}'"
|
337
|
-
|
338
|
-
params_mash = Leeroy::Types::Mash.new(params)
|
339
|
-
params = params_mash
|
340
|
-
|
341
|
-
logger.debug "params: #{params.inspect}"
|
342
|
-
|
343
|
-
resp = s3.send(method.to_sym, params)
|
344
|
-
|
345
|
-
logger.debug "resp: #{resp.inspect}"
|
346
|
-
|
347
|
-
resp
|
348
|
-
|
349
|
-
rescue StandardError => e
|
350
|
-
raise e
|
351
|
-
end
|
335
|
+
def s3Request(method, params = {}, global_options = self.global_options)
|
336
|
+
awsRequest(:s3, method, params, global_options)
|
352
337
|
end
|
353
338
|
|
354
339
|
def buildS3ObjectName(key, type, prefixes = Leeroy::Env::S3_PREFIXES)
|
@@ -28,12 +28,8 @@ module Leeroy
|
|
28
28
|
begin
|
29
29
|
raw = self.fetch(property.to_s)
|
30
30
|
|
31
|
-
# logger.debug "raw: #{raw.inspect}"
|
32
|
-
|
33
31
|
cooked = raw.respond_to?(:dumper) ? raw.dumper : raw
|
34
32
|
|
35
|
-
# logger.debug "cooked: #{cooked.inspect}"
|
36
|
-
|
37
33
|
dump_mash.store(property.to_s, cooked)
|
38
34
|
|
39
35
|
rescue KeyError => e
|
data/lib/leeroy/helpers/env.rb
CHANGED
data/lib/leeroy/state.rb
CHANGED
@@ -24,7 +24,7 @@ module Leeroy
|
|
24
24
|
logger.debug e.message
|
25
25
|
|
26
26
|
not_found = args[0]
|
27
|
-
logger.
|
27
|
+
logger.debug "property '#{not_found}' not found in statedata, checking state"
|
28
28
|
|
29
29
|
begin
|
30
30
|
self.send(not_found.to_sym, &block)
|
data/lib/leeroy/task/base.rb
CHANGED
@@ -36,10 +36,10 @@ module Leeroy
|
|
36
36
|
|
37
37
|
def perform(args = self.args, options = self.options, global_options = self.global_options)
|
38
38
|
begin
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
logger.info("performing #{self.class.to_s}")
|
40
|
+
logger.debug("args: #{args.inspect}")
|
41
|
+
logger.debug("options: #{options.inspect}")
|
42
|
+
logger.debug("global_options: #{global_options.inspect}")
|
43
43
|
|
44
44
|
rescue StandardError => e
|
45
45
|
raise e
|
data/lib/leeroy/task/stub.rb
CHANGED
@@ -8,8 +8,6 @@ module Leeroy
|
|
8
8
|
super
|
9
9
|
|
10
10
|
begin
|
11
|
-
logger.debug "performing for #{self.class}"
|
12
|
-
logger.debug "state: #{self.state}"
|
13
11
|
message = self.state.message
|
14
12
|
|
15
13
|
increment = self.options[:increment].to_i
|
@@ -29,8 +27,6 @@ module Leeroy
|
|
29
27
|
|
30
28
|
dump_state
|
31
29
|
|
32
|
-
logger.debug "done performing for #{self.class}"
|
33
|
-
|
34
30
|
rescue StandardError => e
|
35
31
|
raise e
|
36
32
|
end
|
data/lib/leeroy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leeroy_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Huff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aruba
|
@@ -258,8 +258,10 @@ executables:
|
|
258
258
|
extensions: []
|
259
259
|
extra_rdoc_files: []
|
260
260
|
files:
|
261
|
+
- .codeclimate.yml
|
261
262
|
- .gitignore
|
262
263
|
- .rspec
|
264
|
+
- .rubocop.yml
|
263
265
|
- .ruby-version
|
264
266
|
- Gemfile
|
265
267
|
- Gemfile.lock
|