vagrant-aws-dns 0.2.5 → 0.2.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
  SHA1:
3
- metadata.gz: 33527e7f8078c3d59996a2c28ce090b6810ba20a
4
- data.tar.gz: ea88949bed822bc8a880b56cee1b6a92cc7d4bb2
3
+ metadata.gz: 3f5a27fc1831c4763fa4bc70aa8ad1251fad7841
4
+ data.tar.gz: 7e7e10c246edd4176d8aef8cc12d67e049ce64a5
5
5
  SHA512:
6
- metadata.gz: a74e2c1248ba695a48357be943650d2e022e57a23f850da67a4590ff890d61d582f5f007574a0dcb92929c567e641e9ddb24e557d49ac4f57d050e85986c2f09
7
- data.tar.gz: d30ada6e3bdaed569b6f4b555801940e75725d1766e52622437d907bd9905fbca82fd0dd5be970fa07ddbf3b93cd7940a4d729ce9f7025a762f9b94619126a7f
6
+ metadata.gz: 0daa076c504c70ca81a06cda0659e592773018a2d1b62eb167f599362efc939d86a749a0ba392b368cd09cce04800905671307888b71e26a06959903099a5033
7
+ data.tar.gz: 14df8a834f94798788c9e4a5050c81995447c2f48b84e0bea0057dc2dd85a837140bcc3607d901117dd7c2a62784b4e97bbd2792a696eb892c11318f0e37e3e2
@@ -19,10 +19,16 @@ module VagrantPlugins
19
19
  @machine.provider_config.secret_access_key,
20
20
  @machine.provider_config.region)
21
21
  public_ip = @aws.get_public_ip(@machine.id)
22
+ private_ip = @aws.get_private_ip(@machine.id)
22
23
 
23
24
  @machine.config.dns.record_sets.each do |record_set|
24
25
  hosted_zone_id, record, type, value = record_set
25
- yield hosted_zone_id, record, type, value || public_ip if block_given?
26
+
27
+ if @aws.is_private_zone(hosted_zone_id)
28
+ yield hosted_zone_id, record, type, value || private_ip if block_given?
29
+ else
30
+ yield hosted_zone_id, record, type, value || public_ip if block_given?
31
+ end
26
32
  end
27
33
 
28
34
  @app.call(env)
@@ -24,6 +24,14 @@ module VagrantPlugins
24
24
  @ec2.describe_instances({instance_ids: [instance_id]}).reservations[0].instances[0].public_ip_address
25
25
  end
26
26
 
27
+ def get_private_ip(instance_id)
28
+ @ec2.describe_instances({instance_ids: [instance_id]}).reservations[0].instances[0].private_ip_address
29
+ end
30
+
31
+ def is_private_zone(hosted_zone_id)
32
+ @route53.get_hosted_zone({id: '/hostedzone/' + hosted_zone_id}).hosted_zone.config.private_zone
33
+ end
34
+
27
35
  def add_record(hosted_zone_id, record, type, value)
28
36
  change_record(hosted_zone_id, record, type, value, 'UPSERT')
29
37
  end
@@ -56,7 +64,6 @@ module VagrantPlugins
56
64
  }
57
65
  })
58
66
  end
59
-
60
67
  end
61
68
  end
62
69
  end
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module AwsDns
3
- VERSION = "0.2.5"
3
+ VERSION = "0.2.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-aws-dns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nassim Kacha
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-06 00:00:00.000000000 Z
11
+ date: 2017-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk