vagrant-aws-dns-synchronous 0.2.6.6 → 0.2.6.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c870d09380bf477cbd20bca530fb80beab27d12
4
- data.tar.gz: f29cde027a46fb16394fe8193f16fc67e22fb209
3
+ metadata.gz: 4fac03652b947cfd44911fe8d6509609a6c87c31
4
+ data.tar.gz: e71e64bb8b647c427c9269f5ef8d7d7e03625cde
5
5
  SHA512:
6
- metadata.gz: aa07d3b9fbfe00307ae9f29e067848148c1a4102fab261a61e886f709dde4f81317163e3af5e10df50469568aba1bd4c3c30bce4d765fe285a683f7a7cb08326
7
- data.tar.gz: 15b5f9030339c7275829a5b12ee419a5103dbe2147af3cfdba305d6a6d9dc6294545ecfe54b995a65de0abbc63fabb5ad704c16e3ae7bbb9d637f7ae22472955
6
+ metadata.gz: ed7f9aafc237a7ae49cd1a24b0514eb03de5aafab8e54605998ab8e612050048d396d968f5a96883d05a30f77aa547de68e465526827fbc1bf5f18bd3777cada
7
+ data.tar.gz: d0ae846d6ca4272047a949675506c623999ecf5791022f60e5719e25f15bcdf80cb3a92290cd858c4f1a34f63db68d57e27f0efa9d89d90725d0deb235f0ab84
data/README.md CHANGED
@@ -66,6 +66,7 @@ Vagrant.configure("2") do |config|
66
66
  * `%w(HOSTED_ZONE_ID subdomain.domain.com CNAME domain2.com)` - This will set a record of type `subdomain.domain1.com. CNAME domain2.com.`.
67
67
 
68
68
  The ip may be omitted in which case the correct ip (private/public) will be chosen based on the type of the HOSTED_ZONE_ID.
69
+ If the record type is CNAME and the value is not provided, the private/public AWS DNS name will be used instead.
69
70
 
70
71
  ## FAQ
71
72
 
@@ -18,17 +18,19 @@ module VagrantPlugins
18
18
  @aws = AwsDns::Util::AwsUtil.new(@machine.provider_config.access_key_id,
19
19
  @machine.provider_config.secret_access_key,
20
20
  @machine.provider_config.region)
21
- public_ip = @aws.get_public_ip(@machine.id)
22
- private_ip = @aws.get_private_ip(@machine.id)
21
+ instance = @aws.instance_info(@machine.id)
23
22
 
24
23
  @machine.config.dns.record_sets.each do |record_set|
25
24
  hosted_zone_id, record, type, value = record_set
25
+ zone_type = @aws.get_zone_type(hosted_zone_id)
26
26
 
27
- if @aws.is_private_zone(hosted_zone_id)
28
- yield hosted_zone_id, record, type, value || private_ip if block_given?
27
+ default_value = if type == 'CNAME'
28
+ instance.public_send("#{zone_type}_dns_name")
29
29
  else
30
- yield hosted_zone_id, record, type, value || public_ip if block_given?
30
+ instance.public_send("#{zone_type}_ip_address")
31
31
  end
32
+
33
+ yield hosted_zone_id, record, type, value || default_value if block_given?
32
34
  end
33
35
 
34
36
  @app.call(env)
@@ -20,16 +20,13 @@ module VagrantPlugins
20
20
  )
21
21
  end
22
22
 
23
- def get_public_ip(instance_id)
24
- @ec2.describe_instances({instance_ids: [instance_id]}).reservations[0].instances[0].public_ip_address
23
+ def instance_info(instance_id)
24
+ @ec2.describe_instances({instance_ids: [instance_id]}).reservations[0].instances[0]
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
27
+ def get_zone_type(hosted_zone_id)
28
+ zone = @route53.get_hosted_zone({id: '/hostedzone/' + hosted_zone_id})
29
+ zone.hosted_zone.config.private_zone ? :private : :public
33
30
  end
34
31
 
35
32
  def add_record(hosted_zone_id, record, type, value)
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module AwsDns
3
- VERSION = "0.2.6.6"
3
+ VERSION = "0.2.6.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-aws-dns-synchronous
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6.6
4
+ version: 0.2.6.7
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-12-20 00:00:00.000000000 Z
11
+ date: 2018-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk