traceroute53 0.1.1 → 0.1.2

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: d55232ad71eb5f5decdc7eb2c619ceb1474b3f36131da40ee319142cfefa2fbc
4
- data.tar.gz: 59fecd8ce6c98b5ba84f242b54a0e02f133a69cfb1b759b5668f487a61e01b19
3
+ metadata.gz: 46c7a0ad8543b7757ba846d2f84f431364d17d97fcfc7f19bf4629c57ac2d91b
4
+ data.tar.gz: 5abf1885fb224a19aa858b7ecb221a9e3a751db0412f856f355e654e9d60e651
5
5
  SHA512:
6
- metadata.gz: 2b75ae1d67d4b603e7181a3495a6922fcba215e65c6ceb1aca9777a2b08bc8c06a1be371f265830778b3092aea304eca4e16c6ea45fb507495074f870627b85b
7
- data.tar.gz: 1d69b8b9457c473c6c405abc16d48affef8cd9ab8f8258e665035f3006adbe5ca094a6e7b89fb08701dbf03df66966b3a706b58cffe1c8acb88ab066f2646c7e
6
+ metadata.gz: d57b5cf0e312ea84927b3f6c556231dcba7dee9ed9298ddc8fe4db1051ed2b35dd5318c97a87913b47c31b4b8e6a57c112d5b2574137204a8c3ded3914b9398d
7
+ data.tar.gz: f3599dd5fadfc557494ff03002f14e92e02bf21d9e5c787c18cc7260a7dbffc9f85c4bde0d7202b4c1bf384a0bfb29c2c11ca92e40a21c0d6d6b3a79944ebdea
data/.gitignore CHANGED
@@ -6,6 +6,7 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ Gemfile.lock
9
10
 
10
11
  # rspec failure tracking
11
12
  .rspec_status
data/README.md CHANGED
@@ -18,7 +18,7 @@ gem install traceroute53
18
18
  traceroute53 <domain>
19
19
  ```
20
20
 
21
- To pass credentials, [set environment variables](https://docs.aws.amazon.com/sdk-for-ruby/v3/developer-guide/setup-config.html#aws-ruby-sdk-credentials-environment) or speicfy `--profile=PROFILE` option.
21
+ To pass credentials, [set environment variables](https://docs.aws.amazon.com/sdk-for-ruby/v3/developer-guide/setup-config.html#aws-ruby-sdk-credentials-environment) or specify `--profile=PROFILE` option.
22
22
 
23
23
  ### An example for healthy domain
24
24
 
@@ -42,7 +42,7 @@ group_ids[0]sg[1]ip[1]: port:nil ["sg-f8f8f8f8"]
42
42
  group_ids[0]sg[1]ip[2]: port:22 ["sg-33886655"]
43
43
  ```
44
44
 
45
- ### An example for unhealthy domain
45
+ ### An example for mismatched security groups
46
46
 
47
47
  In this example Route53's hosted zone correctly have dns resource, which has correct dns\_name, listener, target group but its 2nd security group's Permission set is empty.
48
48
 
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  # Trace route53 and Load Balancers related to the given domain
3
- require 'aws-sdk'
3
+ require 'aws-sdk-route53'
4
+ require 'aws-sdk-elasticloadbalancingv2'
5
+ require 'aws-sdk-ec2'
4
6
  require 'optparse'
5
7
 
6
8
  def list_hosted_zones(client)
@@ -154,19 +156,25 @@ def main
154
156
  # p hosted_zone
155
157
  puts "hosted zone: #{hosted_zone.name}"
156
158
 
157
- records = list_resource_record_sets(client, hosted_zone)
158
- records.select!{|record| record.name == domain_dot}
159
- if records.empty?
160
- STDERR.puts "resource record set not found in #{hosted_zone} for #{domain}"
161
- exit 1
162
- end
163
- if records.size != 1
164
- STDERR.puts records.inspect
165
- STDERR.puts "more than one resource record set in #{hosted_zone} for #{domain}"
166
- exit 1
159
+ record_sets = list_resource_record_sets(client, hosted_zone)
160
+ while true
161
+ records = record_sets.select{|record| record.name == domain_dot}
162
+ if records.empty?
163
+ STDERR.puts "resource record set not found in #{hosted_zone} for #{domain}"
164
+ exit 1
165
+ end
166
+ if records.size != 1
167
+ STDERR.puts records.inspect
168
+ STDERR.puts "more than one resource record set in #{hosted_zone} for #{domain}"
169
+ exit 1
170
+ end
171
+ dns_name = records[0].alias_target.dns_name
172
+ puts "dns name: #{dns_name}"
173
+ if /([a-z0-9\-]+)\.elb\.amazonaws.com\.\z/ =~ dns_name
174
+ break
175
+ end
176
+ domain_dot = dns_name
167
177
  end
168
- dns_name = records[0].alias_target.dns_name
169
- puts "dns name: #{dns_name}"
170
178
  dns_name.sub!(/\Adualstack\./, '')
171
179
  dns_name.chomp!('.')
172
180
 
@@ -1,3 +1,3 @@
1
1
  module Traceroute53
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -36,7 +36,9 @@ Gem::Specification.new do |spec|
36
36
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
37
  spec.require_paths = ["lib"]
38
38
 
39
- spec.add_dependency "aws-sdk", "~> 3"
39
+ spec.add_dependency 'aws-sdk-route53', "~> 3"
40
+ spec.add_dependency 'aws-sdk-elasticloadbalancingv2', "~> 3"
41
+ spec.add_dependency 'aws-sdk-ec2', "~> 3"
40
42
  spec.add_development_dependency "bundler", "~> 1.17"
41
43
  spec.add_development_dependency "rake", "~> 10.0"
42
44
  spec.add_development_dependency "rspec", "~> 3.0"
metadata CHANGED
@@ -1,17 +1,45 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: traceroute53
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - NARUSE, Yui
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-13 00:00:00.000000000 Z
11
+ date: 2019-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: aws-sdk
14
+ name: aws-sdk-route53
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: aws-sdk-elasticloadbalancingv2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: aws-sdk-ec2
15
43
  requirement: !ruby/object:Gem::Requirement
16
44
  requirements:
17
45
  - - "~>"