awsutils 2.2.1 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +13 -1
- data/README.md +4 -0
- data/Rakefile +1 -1
- data/awsutils.gemspec +15 -10
- data/bin/ec2addsg +1 -1
- data/bin/ec2delsg +2 -2
- data/bin/ec2info +1 -1
- data/bin/ec2listmachines +1 -1
- data/lib/awsutils/awslogs.rb +15 -7
- data/lib/awsutils/ec2addsg.rb +9 -9
- data/lib/awsutils/ec2delsg.rb +41 -55
- data/lib/awsutils/ec2info.rb +19 -29
- data/lib/awsutils/ec2latestimage.rb +13 -16
- data/lib/awsutils/ec2listmachines.rb +153 -355
- data/lib/awsutils/ec2lsgrp.rb +1 -0
- data/lib/awsutils/ec2sg.rb +3 -1
- data/lib/awsutils/r53addrr.rb +11 -15
- data/lib/awsutils/r53ls.rb +5 -5
- data/lib/awsutils/version.rb +1 -1
- data/spec/lib/awsutils/ec2addsg_spec.rb +3 -3
- data/spec/lib/awsutils/ec2lsgrp_spec.rb +3 -2
- metadata +103 -19
data/lib/awsutils/ec2lsgrp.rb
CHANGED
data/lib/awsutils/ec2sg.rb
CHANGED
@@ -50,10 +50,12 @@ module AwsUtils
|
|
50
50
|
servers_using_group = connection.servers.map do |server|
|
51
51
|
next unless server.state != 'terminated' &&
|
52
52
|
server.groups.include?(@opts[:security_group])
|
53
|
-
|
53
|
+
|
54
|
+
server.tags['Name'] || server.id
|
54
55
|
end.compact
|
55
56
|
|
56
57
|
return false unless servers_using_group.empty?
|
58
|
+
|
57
59
|
print 'The following servers are still using this group: '
|
58
60
|
puts servers_using_group.join(',')
|
59
61
|
|
data/lib/awsutils/r53addrr.rb
CHANGED
@@ -3,26 +3,22 @@ require 'fog'
|
|
3
3
|
require 'optimist'
|
4
4
|
|
5
5
|
module AwsUtils
|
6
|
-
|
7
6
|
class Route53AddResourceRecord
|
8
|
-
|
9
7
|
def connection
|
10
8
|
@connection ||= Fog::DNS::AWS.new
|
11
|
-
end
|
9
|
+
end
|
12
10
|
|
13
11
|
def parse_opts
|
14
|
-
|
15
|
-
opt :name,
|
16
|
-
opt :type,
|
17
|
-
opt :ttl,
|
18
|
-
opt :value,
|
19
|
-
end
|
20
|
-
end
|
12
|
+
Optimist.options do
|
13
|
+
opt :name, 'The name', short: 'n', type: String, required: true
|
14
|
+
opt :type, 'Record type (e.g. CNAME or A)', short: 'T', type: String, required: true
|
15
|
+
opt :ttl, 'Time-to-live', short: 't', type: String, default: '300'
|
16
|
+
opt :value, 'Record Value', short: 'v', type: String, required: true
|
17
|
+
end
|
18
|
+
end
|
21
19
|
|
22
20
|
def initialize
|
23
21
|
@opts = parse_opts
|
24
|
-
end
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end # module AwsUtils
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/awsutils/r53ls.rb
CHANGED
@@ -7,7 +7,7 @@ module AwsUtils
|
|
7
7
|
class Route53ListResourceRecord
|
8
8
|
def connection
|
9
9
|
@connection ||= Fog::DNS::AWS.new
|
10
|
-
end
|
10
|
+
end
|
11
11
|
|
12
12
|
def parse_opts
|
13
13
|
opts = Optimist.options do
|
@@ -15,7 +15,7 @@ module AwsUtils
|
|
15
15
|
end
|
16
16
|
opts[:name] = ARGV.last
|
17
17
|
opts
|
18
|
-
end
|
18
|
+
end
|
19
19
|
|
20
20
|
def zone
|
21
21
|
@zone ||= connection.zones.all('domain' => zone_name).first
|
@@ -31,7 +31,7 @@ module AwsUtils
|
|
31
31
|
|
32
32
|
def initialize
|
33
33
|
@opts = parse_opts
|
34
|
-
end
|
34
|
+
end
|
35
35
|
|
36
36
|
def display_record(record)
|
37
37
|
if @opts[:format] == 'json'
|
@@ -88,5 +88,5 @@ module AwsUtils
|
|
88
88
|
display_record(record_by_name)
|
89
89
|
end
|
90
90
|
end
|
91
|
-
end
|
92
|
-
end
|
91
|
+
end
|
92
|
+
end
|
data/lib/awsutils/version.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
require 'awsutils/ec2addsg'
|
3
3
|
|
4
4
|
describe AwsUtils::Ec2AddSecurityGroup do
|
5
|
-
it
|
5
|
+
it 'takes security_group name' do
|
6
6
|
group_name = 'rspec_test_group'
|
7
|
-
ARGV = ['-N', group_name, '-d', 'rspec test group description']
|
7
|
+
ARGV = ['-N', group_name, '-d', 'rspec test group description'].freeze
|
8
8
|
sg = AwsUtils::Ec2AddSecurityGroup.new
|
9
9
|
expect(sg.name).to eq(group_name)
|
10
10
|
end
|
@@ -89,7 +89,8 @@ describe AwsUtils::Ec2LsGrp do
|
|
89
89
|
let(:local_group_obj) do
|
90
90
|
group_obj = fog.security_groups.create(
|
91
91
|
'description' => '',
|
92
|
-
'name' => local_group_name
|
92
|
+
'name' => local_group_name
|
93
|
+
)
|
93
94
|
fog.security_groups.get_by_id(group_obj.group_id)
|
94
95
|
end
|
95
96
|
|
@@ -99,7 +100,7 @@ describe AwsUtils::Ec2LsGrp do
|
|
99
100
|
|
100
101
|
it 'searches for the group by id' do
|
101
102
|
expect(ec2lsgrp).to receive(:group).with(local_group_name)
|
102
|
-
|
103
|
+
.and_return(local_group_obj)
|
103
104
|
ec2lsgrp.run
|
104
105
|
end
|
105
106
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awsutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Herot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: byebug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rubocop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: simplecov
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -123,33 +123,103 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '1'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: aws-sdk-cloudwatchlogs
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '1'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
138
|
+
version: '1'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: aws-sdk-ec2
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
145
|
+
version: '1'
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
152
|
+
version: '1'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: aws-sdk-elasticloadbalancing
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1'
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '1'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: aws-sdk-elasticloadbalancingv2
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '1'
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '1'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: aws-sdk-route53
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '1'
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '1'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: colorize
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: 0.8.1
|
202
|
+
type: :runtime
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: 0.8.1
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: facets
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - "~>"
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '2.9'
|
216
|
+
type: :runtime
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - "~>"
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '2.9'
|
153
223
|
- !ruby/object:Gem::Dependency
|
154
224
|
name: fog-aws
|
155
225
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +234,20 @@ dependencies:
|
|
164
234
|
- - "~>"
|
165
235
|
- !ruby/object:Gem::Version
|
166
236
|
version: 0.11.0
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: highline
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - "~>"
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '2.0'
|
244
|
+
type: :runtime
|
245
|
+
prerelease: false
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - "~>"
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: '2.0'
|
167
251
|
- !ruby/object:Gem::Dependency
|
168
252
|
name: optimist
|
169
253
|
requirement: !ruby/object:Gem::Requirement
|
@@ -179,19 +263,19 @@ dependencies:
|
|
179
263
|
- !ruby/object:Gem::Version
|
180
264
|
version: '3.0'
|
181
265
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
266
|
+
name: rainbow
|
183
267
|
requirement: !ruby/object:Gem::Requirement
|
184
268
|
requirements:
|
185
|
-
- - "
|
269
|
+
- - "~>"
|
186
270
|
- !ruby/object:Gem::Version
|
187
|
-
version: '0'
|
271
|
+
version: '2.0'
|
188
272
|
type: :runtime
|
189
273
|
prerelease: false
|
190
274
|
version_requirements: !ruby/object:Gem::Requirement
|
191
275
|
requirements:
|
192
|
-
- - "
|
276
|
+
- - "~>"
|
193
277
|
- !ruby/object:Gem::Version
|
194
|
-
version: '0'
|
278
|
+
version: '2.0'
|
195
279
|
description: A set of tools for interacting with AWS
|
196
280
|
email:
|
197
281
|
- eric.rubygems@herot.com
|