vagrant-dns 1.0.0 → 1.1.0

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: e10dc6e9ae63d965ec678d7bb481a48cfb81fa1f
4
- data.tar.gz: 673770b40b4723277f9db600302018a0b7f7a201
3
+ metadata.gz: 1b5a5f6e14ebc5f918008c61685cfbf769596db1
4
+ data.tar.gz: 2c3dfff6cf22d3960c4dcc12e783577a4e232cfe
5
5
  SHA512:
6
- metadata.gz: 79631a6d0a2c2c909bb076ab5c94fcaba0765cfc0d5fad27363d5b39813807c22800c8a2334e86db514901f63ff522ae6053a47f81beb8fff575fd0e66faa3fd
7
- data.tar.gz: 1ee7d0ea094ba2909b4a2e6eccf5949e5d87eae2e7044f50959da5083dfdcf8e1e2e48061f21073d26874bf28d963981bed0c631c3ffe54d698d4eb4e4b5d5cc
6
+ metadata.gz: 6193969e02c212e396979e3cd69be02be51b86145cea153e65acea7511db177bfe4b1c75ddc3b49a80fc4dd3f63557c49da54ec935dd792c8f8f7b060dcd6b09
7
+ data.tar.gz: 3fdcefc945ecbc726e58d69c967e336ede6bd5392c89c0ba6d121ec5635f55975b3641f1c9c7526fc32fcddc4e8295ac1bef5d2c5d3ed2c69505e6f3b0cce203
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  test/acceptance/artifacts
18
18
  tmp
19
+ testdrive/.vagrant
@@ -1,3 +1,11 @@
1
+ # 1.1.0
2
+
3
+ * Fixes handling of networks without static IP, such as DHCP. [GH-37], [GH-39], [GH-50]
4
+ * Add support for boxes with `public_network` and static IP.
5
+ * Breaking: No longer falls back to `127.0.0.1` when no IP could be found.
6
+ * Log messages will now be tagged with the related box (vm) and `[vagrant-dns]`
7
+ * Develepment targets Vagrant 1.9.3
8
+
1
9
  # 1.0.0
2
10
 
3
11
  * 🎉Release as 1.0 [GH-34]
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'https://rubygems.org'
2
- ruby '2.0.0'
2
+ ruby(ENV['TEST_RUBY_VERSION'] || '~> 2.2.5')
3
3
 
4
- ENV['TEST_VAGRANT_VERSION'] ||= '~> v1.7.4'
4
+ ENV['TEST_VAGRANT_VERSION'] ||= 'v1.9.3'
5
5
 
6
6
  # Using the :plugins group causes Vagrant to automagially load auto_network
7
7
  # during acceptance tests.
@@ -31,22 +31,34 @@ module VagrantDNS
31
31
  end
32
32
 
33
33
  def register_patterns!
34
- registry = YAML.load(File.read(config_file)) if File.exists?(config_file)
35
- registry ||= {}
36
34
  opts = dns_options(vm)
35
+
37
36
  patterns = opts[:patterns] || default_patterns(opts)
38
- networks = opts[:networks]
39
- network = {}
40
- networks.each do |nw|
41
- network = nw if nw.first == :private_network
37
+ if patterns.empty?
38
+ vm.ui.warn '[vagrant-dns] TLD but no host_name given. No patterns will be configured.'
39
+ return
42
40
  end
43
41
 
44
- if ! network.empty?
45
- ip = network.last[:ip]
46
- else
47
- ip = '127.0.0.1'
42
+ network = opts[:networks].find do |nw|
43
+ nw.first == :private_network && nw.last[:ip]
44
+ end
45
+
46
+ unless network
47
+ network = opts[:networks].find do |nw|
48
+ nw.first == :public_network && nw.last[:ip]
49
+ end
48
50
  end
49
51
 
52
+ unless network
53
+ vm.ui.warn '[vagrant-dns] Could not find any static network IP. No patterns will be configured.'
54
+ return
55
+ end
56
+
57
+ ip = network.last[:ip]
58
+
59
+ registry = YAML.load(File.read(config_file)) if File.exists?(config_file)
60
+ registry ||= {}
61
+
50
62
  patterns.each do |p|
51
63
  p = p.source if p.respond_to? :source # Regexp#to_s is unusable
52
64
  registry[p] = ip
@@ -66,7 +78,6 @@ module VagrantDNS
66
78
  if opts[:host_name]
67
79
  opts[:tlds].map { |tld| /^.*#{opts[:host_name]}.#{tld}$/ }
68
80
  else
69
- warn 'TLD but no host_name given. No patterns will be configured.'
70
81
  []
71
82
  end
72
83
  end
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module Dns
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
8
8
  gem.summary = %q{vagrant-dns manages DNS records of vagrant machines}
9
9
  gem.homepage = ""
10
10
 
11
- gem.files = `git ls-files`.split($\)
11
+ gem.files = `git ls-files`.split($\).reject { |f| f.match(%r{^(test|testdrive)/}) }
12
12
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
13
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
14
  gem.name = "vagrant-dns"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-dns
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Gilcher
@@ -9,48 +9,48 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-20 00:00:00.000000000 Z
12
+ date: 2017-04-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: daemons
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rubydns
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: 1.0.2
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: 1.0.2
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: 2.14.0
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: 2.14.0
56
56
  description: vagrant-dns is a vagrant plugin that manages DNS records associated with
@@ -62,7 +62,7 @@ executables: []
62
62
  extensions: []
63
63
  extra_rdoc_files: []
64
64
  files:
65
- - .gitignore
65
+ - ".gitignore"
66
66
  - CHANGELOG.md
67
67
  - Gemfile
68
68
  - LICENSE
@@ -78,10 +78,6 @@ files:
78
78
  - lib/vagrant-dns/service.rb
79
79
  - lib/vagrant-dns/version.rb
80
80
  - tasks/acceptance.rake
81
- - test/acceptance/dns/dns_spec.rb
82
- - test/acceptance/skeletons/dns/Vagrantfile
83
- - testdrive/Vagrantfile
84
- - testdrive/bin/vagrant
85
81
  - vagrant-dns.gemspec
86
82
  - vagrant-spec.config.rb
87
83
  homepage: ''
@@ -93,20 +89,18 @@ require_paths:
93
89
  - lib
94
90
  required_ruby_version: !ruby/object:Gem::Requirement
95
91
  requirements:
96
- - - '>='
92
+ - - ">="
97
93
  - !ruby/object:Gem::Version
98
94
  version: '0'
99
95
  required_rubygems_version: !ruby/object:Gem::Requirement
100
96
  requirements:
101
- - - '>='
97
+ - - ">="
102
98
  - !ruby/object:Gem::Version
103
99
  version: '0'
104
100
  requirements: []
105
101
  rubyforge_project:
106
- rubygems_version: 2.4.8
102
+ rubygems_version: 2.4.5.1
107
103
  signing_key:
108
104
  specification_version: 4
109
105
  summary: vagrant-dns manages DNS records of vagrant machines
110
- test_files:
111
- - test/acceptance/dns/dns_spec.rb
112
- - test/acceptance/skeletons/dns/Vagrantfile
106
+ test_files: []
@@ -1,72 +0,0 @@
1
- shared_examples 'provider/dns' do |provider, options|
2
-
3
- if !File.file?(options[:box])
4
- raise ArgumentError,
5
- "A box file #{options[:box]} must be downloaded for provider: #{provider}. Try: rake acceptance:setup"
6
- end
7
-
8
- include_context 'acceptance'
9
-
10
- let(:box_ip) { '10.10.10.101' }
11
- let(:tld) { 'spec' }
12
- let(:name) { 'single.testbox.spec' }
13
-
14
- before do
15
- ENV['VAGRANT_DEFAULT_PROVIDER'] = provider
16
- environment.skeleton('dns')
17
- end
18
-
19
- describe 'installation' do
20
- it 'creates and removes resolver link' do
21
- assert_execute('vagrant', 'dns', '--install', '--with-sudo')
22
- assert_execute('ls', "/etc/resolver/#{tld}")
23
-
24
- assert_execute('vagrant', 'dns', '--uninstall', '--with-sudo')
25
- result = execute('ls', "/etc/resolver/#{tld}")
26
- expect(result).to_not exit_with(0)
27
- end
28
- end
29
-
30
- describe 'running' do
31
- before do
32
- assert_execute('vagrant', 'box', 'add', 'box', options[:box])
33
- assert_execute('vagrant', 'dns', '--install', '--with-sudo')
34
- assert_execute('vagrant', 'up', "--provider=#{provider}")
35
- end
36
-
37
- after do
38
- # Ensure any VMs that survived tests are cleaned up.
39
- assert_execute('vagrant', 'destroy', '--force', log: false)
40
- assert_execute('vagrant', 'dns', '--uninstall', '--with-sudo')
41
- end
42
-
43
- it 'auto-starts the DNS daemon' do
44
- assert_execute('pgrep', '-lf', 'vagrant-dns')
45
- end
46
-
47
- it 'registered as a resolver' do
48
- expected_output = <<-TXT
49
- domain : #{tld}
50
- nameserver[0] : 127.0.0.1
51
- port : 5333
52
- flags : Request A records, Request AAAA records
53
- reach : Reachable,Local Address
54
- TXT
55
-
56
- result = assert_execute('scutil', '--dns')
57
- expect(result.stdout).to include(expected_output)
58
- end
59
-
60
- it 'responds to host-names' do
61
- result = assert_execute('dscacheutil', '-q', 'host', '-a', 'name', "#{name}")
62
- expect(result.stdout).to include("ip_address: #{box_ip}")
63
-
64
- result = assert_execute('dscacheutil', '-q', 'host', '-a', 'name', "www.#{name}")
65
- expect(result.stdout).to include("ip_address: #{box_ip}")
66
-
67
- result = execute('dscacheutil', '-q', 'host', '-a', 'name', "notthere.#{tld}")
68
- expect(result.stdout).to_not include("ip_address: #{box_ip}")
69
- end
70
- end
71
-
72
- end
@@ -1,12 +0,0 @@
1
- # -*- mode: ruby -*-
2
- # vi: set ft=ruby :
3
-
4
- Vagrant.configure("2") do |config|
5
- config.vm.box = "box"
6
- config.vm.network :private_network, ip: '10.10.10.101'
7
-
8
- config.dns.tld = 'spec'
9
- config.dns.patterns = /^.*single.testbox.spec$/
10
-
11
- VagrantDNS::Config.listen = [[:udp, "0.0.0.0", 5333]]
12
- end
@@ -1,21 +0,0 @@
1
- # -*- mode: ruby -*-
2
- # vi: set ft=ruby :
3
-
4
- Vagrant.configure("2") do |config|
5
- # All Vagrant configuration is done here. The most common configuration
6
- # options are documented and commented below. For a complete reference,
7
- # please see the online documentation at vagrantup.com.
8
-
9
- # Every Vagrant virtual environment requires a box to build off of.
10
- config.vm.box = 'precise32'
11
- config.vm.box_url = 'http://files.vagrantup.com/precise32.box'
12
-
13
- config.dns.tld = "test"
14
- config.dns.patterns = /^.*machine.test$/
15
-
16
- config.vm.hostname = "machine"
17
- config.vm.network :private_network, ip: "33.33.33.60"
18
-
19
-
20
- VagrantDNS::Config.listen = [[:udp, "0.0.0.0", 5300]]
21
- end
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env bash
2
- TESTDRIVE=${VAGRANT_DEV:-$(dirname "$(cd "$(dirname "$0")" && pwd)")}
3
-
4
- VAGRANT_DEFAULT_PROVIDER=virtualbox \
5
- VAGRANT_HOME=${TESTDRIVE}/.vagrant.d \
6
- bundle exec vagrant $@