awful 0.0.80 → 0.0.81
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/awful/route53.rb +20 -7
- 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: 1a9405b380fa06ab1bd50740ad5831e107a66caa
|
4
|
+
data.tar.gz: 71e8d90a5d2d6b03784a6cddcf9b739d388a28fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93ac568edb2335d5cdfff269ec2f94114e93a8ab55d10928935343d33046b0e0579bc476fe8353824491063ade92da957acb311e5dd17fb2ed5780596afa76a5
|
7
|
+
data.tar.gz: fb2822a01616f3abbf052a2f9e1035ff25b2809ec839c6c0c22108191cfb10db0405656597604a835a819d0604d6823add75de330314f796cec62fb10e25441f
|
data/lib/awful/route53.rb
CHANGED
@@ -43,19 +43,32 @@ module Awful
|
|
43
43
|
end
|
44
44
|
|
45
45
|
desc 'records ZONE', 'list records for given ZONE'
|
46
|
-
method_option :long,
|
46
|
+
method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'Long listing'
|
47
|
+
method_option :type, aliases: '-t', type: :array, default: nil, desc: 'List of record types to match'
|
48
|
+
method_option :name, aliases: '-n', type: :array, default: nil, desc: 'List of names to match'
|
49
|
+
method_option :max_items, aliases: '-m', type: :numeric, default: nil, desc: 'Max number of records to check'
|
47
50
|
def records(zone)
|
48
|
-
|
51
|
+
## match on given record types
|
52
|
+
include_type = options[:type] ? ->(type) { options[:type].include?(type) } : ->(_) { true }
|
53
|
+
|
54
|
+
## match on given record names
|
55
|
+
names = options.fetch('name', []).map { |name| name.gsub(/([^\.])$/, '\1.') } # append . to names if missing
|
56
|
+
include_name = options[:name] ? ->(name) { names.include?(name) } : ->(_) { true }
|
57
|
+
|
58
|
+
route53.list_resource_record_sets(
|
59
|
+
hosted_zone_id: get_zone_by_name(zone),
|
60
|
+
max_items: options[:max_items]
|
61
|
+
).resource_record_sets.select do |rrset|
|
62
|
+
include_type.call(rrset.type) and include_name.call(rrset.name)
|
63
|
+
end.tap do |records|
|
49
64
|
if options[:long]
|
50
|
-
records.map
|
65
|
+
print_table records.map { |r|
|
51
66
|
dns_name = r.alias_target.nil? ? [] : ['ALIAS ' + r.alias_target.dns_name]
|
52
67
|
values = r.resource_records.map(&:value)
|
53
68
|
[r.name, r.type, (dns_name + values).join(', ')]
|
54
|
-
|
55
|
-
print_table list.sort
|
56
|
-
end
|
69
|
+
}
|
57
70
|
else
|
58
|
-
puts records.map(&:name)
|
71
|
+
puts records.map(&:name)
|
59
72
|
end
|
60
73
|
end
|
61
74
|
end
|
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.81
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ric Lister
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|