awful 0.0.52 → 0.0.53
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/lib/awful/security_group.rb +16 -8
- data/lib/awful/version.rb +1 -1
- 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: 36753e59ef159b9d7324d78ecba2678a44c231ee
|
4
|
+
data.tar.gz: 1d9fa838a6078bafb5b926a6c4be5c74c17b7a59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a58985a2a470ffe7bffccdf01f167264c6736cb9d2562191fccd02f6bb4ef0b691ff2d5bb3603a655e6ce8ce7070326a100296599e767c083383e221c0759d78
|
7
|
+
data.tar.gz: 9bf66255c04821000a9d6dd7964f6acad4d901ccf42ac99b7e923f08ff0d3151d05e056dd4a4626df38458a35d918d0430e538f796e01b7194e29c00725188b3
|
data/lib/awful/security_group.rb
CHANGED
@@ -6,7 +6,7 @@ module Awful
|
|
6
6
|
method_option :long, aliases: '-l', default: false, desc: 'Long listing'
|
7
7
|
def ls(name = /./)
|
8
8
|
fields = options[:long] ?
|
9
|
-
->(s) { [tag_name(s), s.group_id, s.group_name, s.vpc_id, s.description] } :
|
9
|
+
->(s) { [tag_name(s), s.group_id, s.group_name[0..50], s.vpc_id, s.description] } :
|
10
10
|
->(s) { [s.group_name] }
|
11
11
|
|
12
12
|
ec2.describe_security_groups.map(&:security_groups).flatten.select do |sg|
|
@@ -18,11 +18,21 @@ module Awful
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
|
21
|
+
no_commands do
|
22
|
+
|
23
|
+
## return first SG that matches name to id, group_name, or Name tag
|
24
|
+
def first_matching_sg(name)
|
25
|
+
field = name.match(/^sg-[\d[a-f]]{8}$/) ? :group_id : :group_name
|
26
|
+
ec2.describe_security_groups.map(&:security_groups).flatten.find do |sg|
|
27
|
+
sg.send(field).match(name) or (tag_name(sg)||'').match(name)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
desc 'dump NAME', 'dump security group with NAME [or ID] as yaml'
|
22
34
|
def dump(name)
|
23
|
-
|
24
|
-
sg.group_name == name
|
25
|
-
end.tap do |sg|
|
35
|
+
first_matching_sg(name).tap do |sg|
|
26
36
|
puts YAML.dump(stringify_keys(sg.to_hash))
|
27
37
|
end
|
28
38
|
end
|
@@ -30,9 +40,7 @@ module Awful
|
|
30
40
|
desc 'inbound NAME', 'show inbound rules for named security group'
|
31
41
|
method_option :long, aliases: '-l', default: false, desc: 'Long listing'
|
32
42
|
def inbound(name)
|
33
|
-
|
34
|
-
sg.group_name == name
|
35
|
-
end.ip_permissions.tap do |perms|
|
43
|
+
first_matching_sg(name).ip_permissions.tap do |perms|
|
36
44
|
sources = ->(perm) { perm.ip_ranges.map(&:cidr_ip) + perm.user_id_group_pairs.map(&:group_id) }
|
37
45
|
if options[:long]
|
38
46
|
perms.map do |p|
|
data/lib/awful/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awful
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.53
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ric Lister
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|