traceroute53 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9f8790052215d8ef69f6e6325c3d5059b1054ed6f9a054f82a0dda981745d4a
4
- data.tar.gz: d0bdacbd902fd5f93bf26c8856011bf85a5999559aef891bfb7d2276b60606a3
3
+ metadata.gz: 2366ea9ef30a2d88826cc6601ffae1c4f87cc14a275473375e19ded8c9771ea9
4
+ data.tar.gz: 8b95a5fd70d36a1a8fa26d846304f83a52ac61107a0a323b5aff5b82b1565845
5
5
  SHA512:
6
- metadata.gz: 949b3b799411e364591db69280f06c624c1465fa7a6bd0ce2151639eed20a468e178583cf9e4ec042199213a96002c1e2e54fed2fcfdf1d2b07744f7992175d2
7
- data.tar.gz: 44194772619f51331da68188dfd2b6fd4b475fda21e7904b72c9369efadf43958eec45aaf51c125cdaed9e21d30775191665137c5b6132e4fb229bc64c1a3d8e
6
+ metadata.gz: b3661175cef71d2b88432e4e15f4667257a13f2f3586b822e505cc838a3f9ee1f095fb27fd895171289a4bb82498a41bda19ef3e0a20e7a433364dbd48cd3f9c
7
+ data.tar.gz: 96aa5bbe750855f4bd0c4222c0fa13a5573cfb2f00cb749afdb60badef01172c6f369a7ff943aae56a8890ac9a4e810d6cfc22433ed960e962bcfcecc95d56ad
data/exe/traceroute53 CHANGED
@@ -59,12 +59,11 @@ def describe_load_balancers(client, name)
59
59
  load_balancers
60
60
  end
61
61
 
62
- def describe_load_balancersv2(client, name)
62
+ def describe_load_balancersv2(client)
63
63
  marker = nil
64
64
  load_balancers = []
65
65
  loop do
66
66
  resp = client.describe_load_balancers({
67
- names: [name],
68
67
  marker: marker,
69
68
  })
70
69
  load_balancers.concat resp.load_balancers
@@ -190,7 +189,7 @@ def main
190
189
 
191
190
  record_sets = list_resource_record_sets(client, hosted_zone)
192
191
  while true
193
- records = record_sets.select{|record| record.name == domain_dot}
192
+ records = record_sets.select{|r| r.name == domain_dot}
194
193
  if records.empty?
195
194
  STDERR.puts "resource record set not found in #{hosted_zone} for #{domain}"
196
195
  exit 1
@@ -200,12 +199,30 @@ def main
200
199
  STDERR.puts "more than one resource record set in #{hosted_zone} for #{domain}"
201
200
  exit 1
202
201
  end
203
- dns_name = records[0].alias_target.dns_name
204
- puts "dns name: #{dns_name}"
205
- if /\.elb\.(?:[a-z0-9\-]+\.)?amazonaws.com\.\z/ =~ dns_name
206
- break
202
+ record = records[0]
203
+ if record.alias_target
204
+ # The record is an AWS resource
205
+ dns_name = record.alias_target.dns_name
206
+ puts "dns name: #{dns_name}"
207
+ # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/Route53/Types/AliasTarget.html
208
+ if /\.elb\.(?:[a-z0-9\-]+\.)?amazonaws.com\.\z/ =~ dns_name
209
+ break
210
+ elsif /\.amazonaws.com\.\z/ =~ dns_name
211
+ STDERR.puts record.inspect
212
+ STDERR.puts "unsupported AWS resource '#{dns_name}'; pull request is welcome https://github.com/nurse/traceroute53"
213
+ exit 1
214
+ else
215
+ # assune Another Route 53 resource record set
216
+ domain_dot = dns_name
217
+ end
218
+ elsif record.type == 'CNAME'
219
+ puts "resource_records: #{record.resource_records.map(&:value)}"
220
+ domain_dot = record.resource_records[0].value
221
+ else
222
+ STDERR.puts record.inspect
223
+ STDERR.puts "unsupported record; pull request is welcome https://github.com/nurse/traceroute53"
224
+ exit 1
207
225
  end
208
- domain_dot = dns_name
209
226
  end
210
227
  dns_name.sub!(/\Adualstack\./, '')
211
228
  dns_name.chomp!('.')
@@ -226,7 +243,7 @@ def main
226
243
  region: region,
227
244
  profile: profile,
228
245
  )
229
- load_balancers = describe_load_balancersv2(client, name)
246
+ load_balancers = describe_load_balancersv2(client)
230
247
  # it raises LoadBalancerNotFound exception if not found
231
248
  load_balancer = load_balancers.find{|lb| lb.dns_name == dns_name}
232
249
  puts "load balancer: #{load_balancer.load_balancer_name} #{load_balancer.security_groups}"
@@ -1,3 +1,3 @@
1
1
  module Traceroute53
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: traceroute53
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - NARUSE, Yui
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-30 00:00:00.000000000 Z
11
+ date: 2022-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-route53
@@ -135,7 +135,7 @@ licenses:
135
135
  metadata:
136
136
  homepage_uri: https://github.com/nurse/traceroute53
137
137
  source_code_uri: https://github.com/nurse/traceroute53
138
- post_install_message:
138
+ post_install_message:
139
139
  rdoc_options: []
140
140
  require_paths:
141
141
  - lib
@@ -150,8 +150,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  requirements: []
153
- rubygems_version: 3.0.3
154
- signing_key:
153
+ rubygems_version: 3.3.7
154
+ signing_key:
155
155
  specification_version: 4
156
156
  summary: A tool to investigate Route53, ELB, EC2 and Security Groups
157
157
  test_files: []