vagrant-dns 1.1.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +77 -14
- data/DEVELOPMENT.md +23 -0
- data/Gemfile +6 -7
- data/PLATFORM_SUPPORT.md +2 -2
- data/README.md +82 -8
- data/lib/vagrant-dns.rb +33 -5
- data/lib/vagrant-dns/command.rb +39 -16
- data/lib/vagrant-dns/config.rb +61 -9
- data/lib/vagrant-dns/configurator.rb +45 -12
- data/lib/vagrant-dns/middlewares/config_down.rb +20 -0
- data/lib/vagrant-dns/middlewares/config_up.rb +20 -0
- data/lib/vagrant-dns/middlewares/restart.rb +21 -0
- data/lib/vagrant-dns/registry.rb +60 -0
- data/lib/vagrant-dns/service.rb +24 -11
- data/lib/vagrant-dns/version.rb +2 -4
- data/tasks/acceptance.rake +30 -12
- data/vagrant-dns.gemspec +7 -3
- data/vagrant-spec.config.rb +7 -5
- metadata +35 -16
- data/lib/vagrant-dns/restart_middleware.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55d0e6f7cc3427342989a00be7f483e305bf346e
|
4
|
+
data.tar.gz: 5736ee829fe8700bb53645e3ad8449d330277029
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5135212305291f8c7fc655545ff4dcf76a1f8c040c0aab0d70ee5d090fdee6767a0fb5f71a8391448cb72bad890b75d31840aa6483155e15e84e9b0e4c5bb794
|
7
|
+
data.tar.gz: a961387709f85227bcf2792f75c4913ddb666bd1620a6fbeb869ad467ed9edb5c520835ce48e7d01a71cc49c3ba39ac9e58aba77bb23a75417b7a5e1de22d4cb
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,67 @@
|
|
1
|
-
|
1
|
+
## 2.2.1
|
2
|
+
|
3
|
+
### Fixes:
|
4
|
+
|
5
|
+
* Prevent action hooks (restarting dns server) from running multiple times [GH-67]
|
6
|
+
|
7
|
+
## 2.2.0
|
8
|
+
|
9
|
+
### New Feautres:
|
10
|
+
|
11
|
+
* Add global config for time-to-live via `VagrantDNS::Config.ttl`
|
12
|
+
|
13
|
+
### Fixes:
|
14
|
+
|
15
|
+
* Fixes acceptance tests for macOS High Sierra (10.13) to cope with `scutil`s new output format
|
16
|
+
* Adds the log-time missing `license` gem config
|
17
|
+
|
18
|
+
### Breaking Changes:
|
19
|
+
|
20
|
+
* Removes the global and vm config `ipv4only`. It was nver been used.
|
21
|
+
|
22
|
+
### Changes:
|
23
|
+
|
24
|
+
* Resources will now respond with a low TTL (time-to-live) of 5 minutes (300 seconds) instead of the old 24 hours by default. Use `VagrantDNS::Config.ttl = 86400` to reset to the old behaviour.
|
25
|
+
* Internal changes on how the dns pattern config is read and written. (Now using `YAML::Store`)
|
26
|
+
* Acceptance tests run against vagrant v2.1.4
|
27
|
+
* Acceptance tests run against Ubuntu 18.04
|
28
|
+
|
29
|
+
### New Feautres:
|
30
|
+
|
31
|
+
* Adds a check for the VMs configured TLDs to not be included in the [Public Suffix List](https://publicsuffix.org/)
|
32
|
+
|
33
|
+
## 2.1.0
|
34
|
+
|
35
|
+
### Breaking, internal changes:
|
36
|
+
|
37
|
+
* The version moved from `Vagrant::DNS::VERSION` to `VagrantDNS::VERSION`, removing an accidental highjack of the `Vagrant` namespace.
|
38
|
+
* The `VagrantDNS::RestartMiddleware` got split up into `VagrantDNS::Middlewares::ConfigUp`, `VagrantDNS::Middlewares::ConfigDown` and `VagrantDNS::Middlewares::Restart`
|
39
|
+
|
40
|
+
### Fixes:
|
41
|
+
|
42
|
+
* Fixes cli short argument `-S` for `--stop` (collided with `--start`'s `-s`)
|
43
|
+
|
44
|
+
### New Feautres:
|
45
|
+
|
46
|
+
* Adds new cli command `--status` to display process running status and PID
|
47
|
+
* Adds new cli command `--list` to display current (persisted) config
|
48
|
+
* Adds auto-cleanup: Removes registered dns pattern from config when destroying the box. It will, however, be re-created when some box in the project gets re/started or one of vagrant dns `--install`, `--start` or `--restart` is executed.
|
49
|
+
|
50
|
+
### Changes:
|
51
|
+
|
52
|
+
* The cli command `--stop` no longer re-builds configuration.
|
53
|
+
|
54
|
+
## 2.0.0
|
55
|
+
|
56
|
+
* Upgrades RubyDNS to `2.0` release
|
57
|
+
|
58
|
+
## 2.0.0.rc1
|
59
|
+
|
60
|
+
* Upgrades RubyDNS to `2.0.0.pre.rc2`, which removes it's dependency on `celluloid`/`celluloid-dns` 🎉
|
61
|
+
* Requires Vagrant >= 1.9.6 which ships with ruby 2.3.4 (RubyDNS requires ruby >= 2.2.6)
|
62
|
+
* Development note: Upgraded to vagrant-share HEAD (d558861f)
|
63
|
+
|
64
|
+
## 1.1.0
|
2
65
|
|
3
66
|
* Fixes handling of networks without static IP, such as DHCP. [GH-37], [GH-39], [GH-50]
|
4
67
|
* Add support for boxes with `public_network` and static IP.
|
@@ -6,12 +69,12 @@
|
|
6
69
|
* Log messages will now be tagged with the related box (vm) and `[vagrant-dns]`
|
7
70
|
* Develepment targets Vagrant 1.9.3
|
8
71
|
|
9
|
-
|
72
|
+
## 1.0.0
|
10
73
|
|
11
74
|
* 🎉Release as 1.0 [GH-34]
|
12
75
|
* Fixes compatibility to Vagrant 1.7.4 by using RubyDNS ~> 1.0.2 [GH-38]
|
13
76
|
|
14
|
-
|
77
|
+
## 0.6.0
|
15
78
|
|
16
79
|
This is a intermediate release towards v1.0.0
|
17
80
|
|
@@ -22,16 +85,16 @@ This is a intermediate release towards v1.0.0
|
|
22
85
|
* Add acceptance test using vagrant-spec
|
23
86
|
* Moved sample `Vagrantfile` into `/testdrive` which also contains a small wrapper script `bin/vagrant` to move "vagrant home" into a sandbox.
|
24
87
|
|
25
|
-
|
88
|
+
## 0.5.0
|
26
89
|
|
27
90
|
* Use `osascript` to install system files, which require root privileges. [GH-18], [GH-22]
|
28
91
|
* internal cleanups (@ringods)
|
29
92
|
|
30
|
-
|
93
|
+
## v0.4.1
|
31
94
|
|
32
95
|
* Fixes an issue with not configured private networks [GH-21], [GH-19]
|
33
96
|
|
34
|
-
|
97
|
+
## v0.4.0
|
35
98
|
|
36
99
|
**This version is not compatible to vagrant < 1.2**
|
37
100
|
|
@@ -40,33 +103,33 @@ This is a intermediate release towards v1.0.0
|
|
40
103
|
* Fixes an issue where user-space files got created as root [GH-12]
|
41
104
|
* Adds command line option `--purge` which deletes the created config file (not only the system symlink to it) [GH-3]
|
42
105
|
|
43
|
-
|
106
|
+
## v0.3.0
|
44
107
|
|
45
108
|
* Using RubyDNS ~> 0.5.3
|
46
109
|
|
47
|
-
|
110
|
+
## v0.2.5
|
48
111
|
|
49
112
|
* Using RubyDNS 0.4.x
|
50
113
|
|
51
|
-
|
114
|
+
## v0.2.4
|
52
115
|
|
53
116
|
* Enable passthrough in DNS service. Helpful if you insist to hook a standard tld like .io.
|
54
117
|
|
55
|
-
|
118
|
+
## v0.2.3
|
56
119
|
|
57
120
|
* Remove unneeded iteraton in installers/mac.rb. (thanks to JonathanTron for reporting)
|
58
121
|
* Fix crash when no tld option was given.
|
59
122
|
|
60
|
-
|
123
|
+
## v0.2.2
|
61
124
|
|
62
125
|
* Default to 127.0.0.1 when no network option is given
|
63
126
|
* Warn if no default pattern is configured because TLD is given, but no host_name
|
64
127
|
|
65
|
-
|
128
|
+
## v0.2.1
|
66
129
|
|
67
130
|
* Fix a crash when /etc/resolver is not present
|
68
131
|
|
69
|
-
|
132
|
+
## v0.2.0
|
70
133
|
|
71
134
|
* Deactivate ipv6 support (was broken anyways)
|
72
135
|
* Add multiple patterns support
|
@@ -76,7 +139,7 @@ This is a intermediate release towards v1.0.0
|
|
76
139
|
* Uses one central server now
|
77
140
|
* The DNS server is now reconfigured on every run
|
78
141
|
|
79
|
-
|
142
|
+
## v0.1.0
|
80
143
|
|
81
144
|
* Initial Release
|
82
145
|
* Support for A and AAAA configuration
|
data/DEVELOPMENT.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Development Guidelines
|
2
|
+
|
3
|
+
TODO: Expand this section :)
|
4
|
+
|
5
|
+
The `Gemfile` uses two environment variables, `TEST_RUBY_VERSION` and `TEST_VAGRANT_VERSION` to control which version of ruby and vagrant are used during local development.
|
6
|
+
|
7
|
+
## Running Acceptance Tests
|
8
|
+
|
9
|
+
This project uses `vagrant-spec` to run acceptance tests.
|
10
|
+
See `test/acceptance/dns` for spec files and `test/acceptance/skeletons/*` for Vagrantfiles.
|
11
|
+
See `tasks/acceptance.rake` for the basic setup of vagrant-spec. This file also defines which base box is used.
|
12
|
+
Specs will take quite some time and run in GUI mode (due to some weirdness either in vagrant-spec and/or VirtualBox) which will render your machine basically unusable.
|
13
|
+
|
14
|
+
```bash
|
15
|
+
# List available tasks:
|
16
|
+
bundle exec rake -D acceptance
|
17
|
+
|
18
|
+
# Setup specs (download box artifacts)
|
19
|
+
bundle exec rake acceptance:setup:virtualbox
|
20
|
+
|
21
|
+
# Run tests
|
22
|
+
rake acceptance:virtualbox
|
23
|
+
```
|
data/Gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
-
ruby(ENV['TEST_RUBY_VERSION'] || '~> 2.
|
2
|
+
ruby(ENV['TEST_RUBY_VERSION'] || '~> 2.4.4')
|
3
3
|
|
4
|
-
ENV['TEST_VAGRANT_VERSION'] ||= '
|
4
|
+
ENV['TEST_VAGRANT_VERSION'] ||= 'v2.1.4'
|
5
5
|
|
6
6
|
# Using the :plugins group causes Vagrant to automagially load auto_network
|
7
7
|
# during acceptance tests.
|
@@ -11,16 +11,15 @@ end
|
|
11
11
|
|
12
12
|
group :test, :development do
|
13
13
|
if ENV['TEST_VAGRANT_VERSION'] == 'HEAD'
|
14
|
-
gem 'vagrant', :
|
14
|
+
gem 'vagrant', :git => 'https://github.com/hashicorp/vagrant', :branch => 'main'
|
15
15
|
else
|
16
|
-
gem 'vagrant', :
|
16
|
+
gem 'vagrant', :git => 'https://github.com/hashicorp/vagrant', :tag => ENV['TEST_VAGRANT_VERSION']
|
17
17
|
end
|
18
|
-
gem 'rubydns', '~>
|
18
|
+
gem 'rubydns', '~> 2.0.0'
|
19
19
|
end
|
20
20
|
|
21
21
|
group :test do
|
22
|
-
|
23
|
-
gem 'vagrant-spec', :github => 'mitchellh/vagrant-spec', :ref => 'aae28ee'
|
22
|
+
gem 'vagrant-spec', :git => 'https://github.com/hashicorp/vagrant-spec', :branch => 'main'
|
24
23
|
gem 'rake'
|
25
24
|
end
|
26
25
|
|
data/PLATFORM_SUPPORT.md
CHANGED
@@ -14,7 +14,7 @@ This document aims to be a guide to implementing support for other platforms.
|
|
14
14
|
How Vagrant-DNS currently works
|
15
15
|
===============================
|
16
16
|
|
17
|
-
In a nutshell, Vagrant-DNS starts a DNS server on a non-privileged port (5300 by default) and makes sure that the host operating system knows this server. If possible, it only does so for a specific, free, TLD (.
|
17
|
+
In a nutshell, Vagrant-DNS starts a DNS server on a non-privileged port (5300 by default) and makes sure that the host operating system knows this server. If possible, it only does so for a specific, free, TLD (.test). As a fallback, it also supports pass-through, if you really want to play with ICANN domains.
|
18
18
|
|
19
19
|
The DNS server runs on all platforms.
|
20
20
|
|
@@ -58,4 +58,4 @@ Quite frankly, I have not enough understanding on how to implement this properly
|
|
58
58
|
General Notes
|
59
59
|
=============
|
60
60
|
|
61
|
-
mDNS is not an option. It doesn't support subdomains and most implementations do not support multiple servers per machine. Thats sad, as all platforms come with good solutions for it.
|
61
|
+
mDNS is not an option. It doesn't support subdomains and most implementations do not support multiple servers per machine. Thats sad, as all platforms come with good solutions for it.
|
data/README.md
CHANGED
@@ -6,6 +6,10 @@
|
|
6
6
|
|
7
7
|
$ vagrant plugin install vagrant-dns
|
8
8
|
|
9
|
+
**Attention: As of v2.0.0, vagrant-dns requires vagrant >= 1.9.6** (because it ships with a more modern version of ruby)
|
10
|
+
If you get an error like `rubydns requires Ruby version >= 2.2.6.` while installing, you probably need to upgrade vagrant.
|
11
|
+
Alternatively, you can install an older version of vagrant-dns like this: `vagrant plugin install --plugin-version="<2" vagrant-dns`
|
12
|
+
|
9
13
|
## Usage
|
10
14
|
|
11
15
|
In addition to your networking config, configure a toplevel domain and a `hostname` for your machine. Optionally, configure a set of free matching patterns. Global configuration options can be given through the `VagrantDNS::Config` object:
|
@@ -14,11 +18,11 @@ In addition to your networking config, configure a toplevel domain and a `hostna
|
|
14
18
|
Vagrant.configure("2") do |config|
|
15
19
|
#...
|
16
20
|
|
17
|
-
config.dns.tld = "
|
21
|
+
config.dns.tld = "test"
|
18
22
|
|
19
23
|
config.vm.hostname = "machine"
|
20
24
|
|
21
|
-
config.dns.patterns = [
|
25
|
+
config.dns.patterns = [/^(\w+\.)*mysite\.test$/, /^(\w+\.)*myothersite\.test$/]
|
22
26
|
|
23
27
|
config.vm.network :private_network, ip: "33.33.33.60"
|
24
28
|
end
|
@@ -33,7 +37,7 @@ Then, register the DNS server as a resolver:
|
|
33
37
|
$ vagrant dns --install
|
34
38
|
```
|
35
39
|
|
36
|
-
On OS X, this will create a file `/etc/resolver/
|
40
|
+
On OS X, this will create a file `/etc/resolver/test`, which tells OS X to resolve the TLD `.test` by using the nameserver given in this file. You will have to rerun --install every time a tld is added.
|
37
41
|
|
38
42
|
You can delete this file by running:
|
39
43
|
|
@@ -41,7 +45,7 @@ You can delete this file by running:
|
|
41
45
|
$ vagrant dns --uninstall
|
42
46
|
```
|
43
47
|
|
44
|
-
To also delete the created config file for this TLD (`~/.vagrant.d/tmp/dns/resolver/
|
48
|
+
To also delete the created config file for this TLD (`~/.vagrant.d/tmp/dns/resolver/test` in our example) run:
|
45
49
|
|
46
50
|
|
47
51
|
```bash
|
@@ -60,12 +64,12 @@ And test it:
|
|
60
64
|
$ scutil --dns
|
61
65
|
...
|
62
66
|
resolver #8
|
63
|
-
domain :
|
67
|
+
domain : test
|
64
68
|
nameserver[0] : 127.0.0.1
|
65
69
|
port : 5300
|
66
70
|
...
|
67
|
-
$ dscacheutil -q host -a name test.machine.
|
68
|
-
name: test.machine.
|
71
|
+
$ dscacheutil -q host -a name test.machine.test
|
72
|
+
name: test.machine.test
|
69
73
|
ip_address: 33.33.33.10
|
70
74
|
```
|
71
75
|
|
@@ -83,6 +87,47 @@ $ vagrant dns --stop
|
|
83
87
|
|
84
88
|
The DNS server will start automatically once the first VM is started.
|
85
89
|
|
90
|
+
You can list the currently configured dns patterns using:
|
91
|
+
|
92
|
+
```bash
|
93
|
+
$ vagrant dns --list
|
94
|
+
```
|
95
|
+
|
96
|
+
(Keep in mind, that it's not guaranteed that the running server uses exactly this configuration - for example, when manually editing it.)
|
97
|
+
The output looks somewhat like this:
|
98
|
+
|
99
|
+
```
|
100
|
+
/^.*mysite.test$/ => 33.33.33.60
|
101
|
+
/^.*myothersite.test$/ => 33.33.33.60
|
102
|
+
```
|
103
|
+
|
104
|
+
Where the first part of each line is a [regular expression](https://ruby-doc.org/core-2.3.0/Regexp.html) and the second part is the mapped IPv4. (` => ` is just a separator)
|
105
|
+
|
106
|
+
## Multi VM config
|
107
|
+
|
108
|
+
We can use [multivm](https://www.vagrantup.com/docs/multi-machine/) configuration and have dns names for host.
|
109
|
+
|
110
|
+
* Use below given vagrant config
|
111
|
+
```ruby
|
112
|
+
BOX_IMAGE = "ubuntu/xenial64"
|
113
|
+
WORKER_COUNT = 2
|
114
|
+
Vagrant.configure("2") do |config|
|
115
|
+
(1..WORKER_COUNT).each do |i|
|
116
|
+
config.vm.define "worker#{i}" do |subconfig|
|
117
|
+
subconfig.dns.tld = "test"
|
118
|
+
subconfig.vm.hostname = "vagrant"
|
119
|
+
subconfig.dns.patterns = "worker#{i}.mysite.test"
|
120
|
+
subconfig.vm.box = BOX_IMAGE
|
121
|
+
subconfig.vm.network "private_network", ip: "10.240.0.#{i+15}"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
```
|
126
|
+
* `vagrant up`
|
127
|
+
* Execute : `vagrant dns --install`
|
128
|
+
* Test via: `ping worker2.mysite.box` or `worker1.mysite.box`
|
129
|
+
|
130
|
+
|
86
131
|
## VM options
|
87
132
|
|
88
133
|
* `vm.dns.tld`: Set the tld for the given virtual machine. No default.
|
@@ -92,7 +137,36 @@ The DNS server will start automatically once the first VM is started.
|
|
92
137
|
## Global Options
|
93
138
|
|
94
139
|
* `VagrantDNS::Config.listen`: an Array of Arrays describing interfaces to bind to. Defaults to `[[:udp, "127.0.0.1", 5300]]`.
|
140
|
+
* `VagrantDNS::Config.ttl`: The time-to-live in seconds for all resources. Defaults to `300` (5 minutes).
|
95
141
|
* `VagrantDNS::Config.auto_run`: (re)start and reconfigure the server every time a machine is started. On by default.
|
142
|
+
* `VagrantDNS::Config.check_public_suffix`: Check if you are going to configure a [Public Suffix](https://publicsuffix.org/) (like a Top Level Domain) in a VMs `tld(s)` config, which could mess up your local dev machines DNS config. Possible configuration values are:
|
143
|
+
- `false`: Disables the feature.
|
144
|
+
- `"warn"`: Check and print a warning. (Still creates a resolver config and potentionally messes up your DNS) **At the moment, this is the default** because lots of projetcs used to use `"dev"` as a TLD, but this got registered by google and is now a public suffix.
|
145
|
+
- `"error"`: Check and prevent the box from starting. (Does not create the resolver config, it will also prevent the box from starting.)
|
146
|
+
|
147
|
+
## Using custom domains from inside the VM (VirtualBox only)
|
148
|
+
|
149
|
+
If you need to be able to resolve custom domains managed by this plugin from inside your virtual machine, add the following
|
150
|
+
setting to your `Vagrantfile`:
|
151
|
+
|
152
|
+
```ruby
|
153
|
+
Vagrant.configure(2) do |config|
|
154
|
+
# ...
|
155
|
+
config.vm.provider "virtualbox" do |vm_config, override|
|
156
|
+
vm_config.customize [
|
157
|
+
"modifyvm", :id,
|
158
|
+
"--natdnshostresolver1", "on",
|
159
|
+
# some systems also need this:
|
160
|
+
# "--natdnshostresolver2", "on"
|
161
|
+
]
|
162
|
+
end
|
163
|
+
end
|
164
|
+
```
|
165
|
+
|
166
|
+
By default, the Virtualbox NAT engine offers the same DNS servers to the guest that are configured on the host. With the above
|
167
|
+
setting, however, the NAT engine will act as a DNS proxy
|
168
|
+
(see [Virtualbox docs](https://www.virtualbox.org/manual/ch09.html#nat-adv-dns)). That way, queries for your custom domains
|
169
|
+
from inside the guest will also be handled by the DNS server run by the plugin.
|
96
170
|
|
97
171
|
## Issues
|
98
172
|
|
@@ -100,4 +174,4 @@ The DNS server will start automatically once the first VM is started.
|
|
100
174
|
* No IPv6 support
|
101
175
|
* OS X only (please read: [Platform
|
102
176
|
Support](https://github.com/BerlinVagrant/vagrant-dns/blob/master/PLATFORM_SUPPORT.md) before ranting about this).
|
103
|
-
* Not visible inside the box
|
177
|
+
* Not automatically visible inside the box (special configuration of your guest system or provider needed)
|
data/lib/vagrant-dns.rb
CHANGED
@@ -1,15 +1,32 @@
|
|
1
1
|
require "vagrant-dns/version"
|
2
2
|
require "vagrant-dns/config"
|
3
3
|
|
4
|
+
require "vagrant-dns/registry"
|
4
5
|
require "vagrant-dns/service"
|
5
6
|
require "vagrant-dns/installers/mac"
|
6
|
-
require "vagrant-dns/restart_middleware"
|
7
7
|
require "vagrant-dns/configurator"
|
8
|
+
require "vagrant-dns/middlewares/config_up"
|
9
|
+
require "vagrant-dns/middlewares/config_down"
|
10
|
+
require "vagrant-dns/middlewares/restart"
|
8
11
|
|
9
12
|
module VagrantDNS
|
10
13
|
|
11
|
-
|
14
|
+
# @private
|
15
|
+
def self.hooks
|
16
|
+
@hooks ||= []
|
17
|
+
end
|
12
18
|
|
19
|
+
# @private
|
20
|
+
def self.hooked(name)
|
21
|
+
hooks << name
|
22
|
+
end
|
23
|
+
|
24
|
+
# @private
|
25
|
+
def self.hooked?(name)
|
26
|
+
hooks.include?(name)
|
27
|
+
end
|
28
|
+
|
29
|
+
class Plugin < Vagrant.plugin("2")
|
13
30
|
name "vagrant-dns"
|
14
31
|
|
15
32
|
config "dns" do
|
@@ -21,12 +38,23 @@ module VagrantDNS
|
|
21
38
|
Command
|
22
39
|
end
|
23
40
|
|
24
|
-
%w{
|
25
|
-
action_hook(
|
26
|
-
|
41
|
+
%w{machine_action_up machine_action_reload}.each do |action|
|
42
|
+
action_hook("restart_vagarant_dns_on_#{action}", action) do |hook|
|
43
|
+
unless VagrantDNS.hooked?(action)
|
44
|
+
hook.append VagrantDNS::Middlewares::ConfigUp
|
45
|
+
hook.append VagrantDNS::Middlewares::Restart
|
46
|
+
VagrantDNS.hooked(action)
|
47
|
+
end
|
27
48
|
end
|
28
49
|
end
|
29
50
|
|
51
|
+
action_hook("remove_vagrant_dns_config", "machine_action_destroy") do |hook|
|
52
|
+
unless VagrantDNS.hooked?("remove_vagrant_dns_config")
|
53
|
+
hook.append VagrantDNS::Middlewares::ConfigDown
|
54
|
+
hook.append VagrantDNS::Middlewares::Restart
|
55
|
+
VagrantDNS.hooked("remove_vagrant_dns_config")
|
56
|
+
end
|
57
|
+
end
|
30
58
|
end
|
31
59
|
|
32
60
|
end
|
data/lib/vagrant-dns/command.rb
CHANGED
@@ -11,35 +11,56 @@ module VagrantDNS
|
|
11
11
|
def execute
|
12
12
|
options = {}
|
13
13
|
opts = OptionParser.new do |opts|
|
14
|
-
opts.banner = "Usage: vagrant dns [vm-name] [-i|--install] [-u|--uninstall] [--with-sudo] [--pruge] [-s|--start] [-S|--stop] [-r|--restart] [-o|--ontop]"
|
14
|
+
opts.banner = "Usage: vagrant dns [vm-name] [-i|--install] [-u|--uninstall] [--with-sudo] [--pruge] [-s|--start] [-S|--stop] [-r|--restart] [--status] [-l|--list] [-o|--ontop]"
|
15
15
|
opts.separator ""
|
16
16
|
|
17
17
|
opts.on("--install", "-i", "Install DNS config for machine domain") do
|
18
18
|
options[:install] = true
|
19
|
+
options[:build_config] = true
|
20
|
+
options[:manage_installation] = true
|
19
21
|
end
|
20
22
|
|
21
23
|
opts.on("--uninstall", "-u", "Uninstall DNS config for machine domain") do
|
22
24
|
options[:uninstall] = true
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
options[:installer_opts] = { exec_style: :sudo }
|
25
|
+
options[:build_config] = false
|
26
|
+
options[:manage_installation] = true
|
27
|
+
options[:stop] = true
|
27
28
|
end
|
28
29
|
|
29
30
|
opts.on("--purge", "Uninstall DNS config and remove DNS configurations of all machines.") do
|
30
31
|
options[:purge] = true
|
32
|
+
options[:build_config] = false
|
33
|
+
options[:manage_installation] = true
|
34
|
+
options[:stop] = true
|
31
35
|
end
|
32
36
|
|
33
37
|
opts.on("--start", "-s", "Start the DNS service") do
|
34
38
|
options[:start] = true
|
39
|
+
options[:build_config] = true
|
35
40
|
end
|
36
41
|
|
37
|
-
opts.on("--stop", "-
|
42
|
+
opts.on("--stop", "-S", "Stop the DNS service") do
|
38
43
|
options[:stop] = true
|
44
|
+
options[:build_config] = false
|
39
45
|
end
|
40
46
|
|
41
47
|
opts.on("--restart", "-r", "Restart the DNS service") do
|
42
48
|
options[:restart] = true
|
49
|
+
options[:build_config] = true
|
50
|
+
end
|
51
|
+
|
52
|
+
opts.on("--status", "Show DNS service running status and PID.") do
|
53
|
+
options[:status] = true
|
54
|
+
options[:build_config] = false
|
55
|
+
end
|
56
|
+
|
57
|
+
opts.on("--list", "-l", "Show the current DNS service config. This works in conjunction with --start --stop --restart --status.") do
|
58
|
+
options[:show_config] = true
|
59
|
+
options[:build_config] = false
|
60
|
+
end
|
61
|
+
|
62
|
+
opts.on("--with-sudo", "In conjunction with `--install`, `--uninstall`, `--purge`: Run using `sudo` instead of `osascript`. Useful for automated scripts running as sudoer.") do
|
63
|
+
options[:installer_opts] = { exec_style: :sudo }
|
43
64
|
end
|
44
65
|
|
45
66
|
opts.on("--ontop", "-o", "Start the DNS service on top. Debugging only, this blocks Vagrant!") do
|
@@ -52,15 +73,10 @@ module VagrantDNS
|
|
52
73
|
|
53
74
|
vms = argv unless argv.empty?
|
54
75
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
build_config(vms, options)
|
60
|
-
manage_service(vms, options)
|
61
|
-
manage_installation(vms, options) if options[:install]
|
62
|
-
end
|
63
|
-
|
76
|
+
build_config(vms, options) if options[:build_config]
|
77
|
+
manage_service(vms, options)
|
78
|
+
manage_installation(vms, options) if options[:manage_installation]
|
79
|
+
show_config(vms, options) if options[:show_config]
|
64
80
|
end
|
65
81
|
|
66
82
|
protected
|
@@ -91,11 +107,18 @@ module VagrantDNS
|
|
91
107
|
service.stop!
|
92
108
|
elsif options[:restart]
|
93
109
|
service.restart! :ontop => options[:ontop]
|
110
|
+
elsif options[:status]
|
111
|
+
service.status!
|
94
112
|
end
|
95
113
|
end
|
96
114
|
|
115
|
+
def show_config(vms, options)
|
116
|
+
service = VagrantDNS::Service.new(tmp_path)
|
117
|
+
service.show_config
|
118
|
+
end
|
119
|
+
|
97
120
|
def build_config(vms, options)
|
98
|
-
with_target_vms(vms) { |vm| VagrantDNS::Configurator.new(vm, tmp_path).
|
121
|
+
with_target_vms(vms) { |vm| VagrantDNS::Configurator.new(vm, tmp_path).up! }
|
99
122
|
end
|
100
123
|
|
101
124
|
def tmp_path
|
data/lib/vagrant-dns/config.rb
CHANGED
@@ -3,27 +3,60 @@ require 'logger'
|
|
3
3
|
module VagrantDNS
|
4
4
|
class Config < Vagrant.plugin(2, :config)
|
5
5
|
class << self
|
6
|
-
attr_accessor :listen, :logger, :
|
6
|
+
attr_accessor :listen, :ttl, :logger, :auto_run, :check_public_suffix
|
7
7
|
|
8
8
|
def listen
|
9
9
|
@listen ||= [[:udp, "127.0.0.1", 5300]]
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
13
|
-
@
|
12
|
+
def ttl
|
13
|
+
@ttl ||= 300
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def auto_run
|
17
17
|
return true if @auto_run.nil?
|
18
18
|
@auto_run
|
19
19
|
end
|
20
|
+
|
21
|
+
def check_public_suffix
|
22
|
+
return "warn" if @check_public_suffix.nil?
|
23
|
+
@check_public_suffix
|
24
|
+
end
|
25
|
+
|
26
|
+
def validate_tlds(vm)
|
27
|
+
return [true, nil] unless check_public_suffix
|
28
|
+
|
29
|
+
require "public_suffix"
|
30
|
+
|
31
|
+
# Don't include private domains in the list, we are only interested in TLDs and such
|
32
|
+
list = PublicSuffix::List.parse(
|
33
|
+
File.read(PublicSuffix::List::DEFAULT_LIST_PATH),
|
34
|
+
private_domains: false
|
35
|
+
)
|
36
|
+
|
37
|
+
failed_tlds = vm.config.dns.tlds.select { |tld| list.find(tld, default: false) }
|
38
|
+
|
39
|
+
err = if failed_tlds.any?
|
40
|
+
"tlds include a public suffix: #{failed_tlds.join(', ')}"
|
41
|
+
end
|
42
|
+
|
43
|
+
if err && check_public_suffix.to_s == "error"
|
44
|
+
[false, err]
|
45
|
+
elsif err
|
46
|
+
[true, err]
|
47
|
+
else
|
48
|
+
[true, nil]
|
49
|
+
end
|
50
|
+
end
|
20
51
|
end
|
21
52
|
|
22
|
-
attr_accessor :records
|
53
|
+
attr_accessor :records
|
54
|
+
attr_reader :tlds, :patterns
|
23
55
|
|
24
56
|
def pattern=(pattern)
|
25
|
-
|
57
|
+
@patterns = (pattern ? Array(pattern) : pattern)
|
26
58
|
end
|
59
|
+
alias_method :patterns=, :pattern=
|
27
60
|
|
28
61
|
def tld=(tld)
|
29
62
|
@tlds = Array(tld)
|
@@ -36,12 +69,31 @@ module VagrantDNS
|
|
36
69
|
# explicit hash, to get symbols in hash keys
|
37
70
|
def to_hash
|
38
71
|
{
|
39
|
-
:patterns =>
|
72
|
+
:patterns => patterns,
|
40
73
|
:records => records,
|
41
|
-
:tlds => tlds
|
42
|
-
:ipv4only => ipv4only
|
74
|
+
:tlds => tlds
|
43
75
|
}
|
44
76
|
end
|
77
|
+
|
78
|
+
def validate(machine)
|
79
|
+
errors = _detected_errors
|
80
|
+
|
81
|
+
errors = validate_check_public_suffix(errors, machine)
|
82
|
+
|
83
|
+
{ "vagrant_dns" => errors }
|
84
|
+
end
|
85
|
+
|
86
|
+
def validate_check_public_suffix(errors, machine)
|
87
|
+
valid, err = self.class.validate_tlds(machine)
|
88
|
+
|
89
|
+
if !valid
|
90
|
+
errors << err
|
91
|
+
elsif err
|
92
|
+
machine.ui.warn(err)
|
93
|
+
end
|
94
|
+
|
95
|
+
errors
|
96
|
+
end
|
45
97
|
end
|
46
98
|
end
|
47
99
|
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'fileutils'
|
2
|
-
require 'yaml'
|
3
2
|
|
4
3
|
module VagrantDNS
|
5
4
|
class Configurator
|
@@ -10,13 +9,28 @@ module VagrantDNS
|
|
10
9
|
@tmp_path = tmp_path
|
11
10
|
end
|
12
11
|
|
13
|
-
def
|
12
|
+
def up!
|
13
|
+
return unless validate_tlds
|
14
14
|
regenerate_resolvers!
|
15
15
|
ensure_deamon_env!
|
16
16
|
register_patterns!
|
17
17
|
end
|
18
18
|
|
19
|
+
def down!
|
20
|
+
unregister_patterns!
|
21
|
+
end
|
22
|
+
|
19
23
|
private
|
24
|
+
def validate_tlds
|
25
|
+
valid, err = VagrantDNS::Config.validate_tlds(vm)
|
26
|
+
if !valid
|
27
|
+
vm.ui.error(err)
|
28
|
+
elsif err
|
29
|
+
vm.ui.warn(err)
|
30
|
+
end
|
31
|
+
valid
|
32
|
+
end
|
33
|
+
|
20
34
|
def regenerate_resolvers!
|
21
35
|
FileUtils.mkdir_p(resolver_folder)
|
22
36
|
|
@@ -56,15 +70,38 @@ module VagrantDNS
|
|
56
70
|
|
57
71
|
ip = network.last[:ip]
|
58
72
|
|
59
|
-
registry =
|
60
|
-
registry
|
73
|
+
registry = Registry.new(tmp_path)
|
74
|
+
registry.transaction do
|
75
|
+
patterns.each do |pattern|
|
76
|
+
registry[pattern] = ip
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def unregister_patterns!
|
82
|
+
opts = dns_options(vm)
|
61
83
|
|
62
|
-
patterns
|
63
|
-
|
64
|
-
|
84
|
+
patterns = opts[:patterns] || default_patterns(opts)
|
85
|
+
if patterns.empty?
|
86
|
+
vm.ui.warn '[vagrant-dns] TLD but no host_name given. No patterns will be removed.'
|
87
|
+
return
|
65
88
|
end
|
66
89
|
|
67
|
-
|
90
|
+
registry = Registry.new(tmp_path)
|
91
|
+
registry.transaction do
|
92
|
+
unless registry.any?
|
93
|
+
vm.ui.warn '[vagrant-dns] Configuration missing or empty. No patterns will be removed.'
|
94
|
+
registry.abort
|
95
|
+
end
|
96
|
+
|
97
|
+
patterns.each do |pattern|
|
98
|
+
if (ip = registry.delete(pattern))
|
99
|
+
vm.ui.info "[vagrant-dns] Removing pattern: #{pattern} for ip: #{ip}"
|
100
|
+
else
|
101
|
+
vm.ui.info "[vagrant-dns] Pattern: #{pattern} was not in config."
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
68
105
|
end
|
69
106
|
|
70
107
|
def dns_options(vm)
|
@@ -97,9 +134,5 @@ FILE
|
|
97
134
|
def ensure_deamon_env!
|
98
135
|
FileUtils.mkdir_p(File.join(tmp_path, "daemon"))
|
99
136
|
end
|
100
|
-
|
101
|
-
def config_file
|
102
|
-
File.join(tmp_path, "config")
|
103
|
-
end
|
104
137
|
end
|
105
138
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module VagrantDNS
|
2
|
+
module Middlewares
|
3
|
+
class ConfigDown
|
4
|
+
def initialize(app, env)
|
5
|
+
@app = app
|
6
|
+
@env = env
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
@env = env
|
11
|
+
vm = env[:machine]
|
12
|
+
if VagrantDNS::Config.auto_run
|
13
|
+
tmp_path = File.join(vm.env.tmp_path, "dns")
|
14
|
+
VagrantDNS::Configurator.new(vm, tmp_path).down!
|
15
|
+
end
|
16
|
+
@app.call(env)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module VagrantDNS
|
2
|
+
module Middlewares
|
3
|
+
class ConfigUp
|
4
|
+
def initialize(app, env)
|
5
|
+
@app = app
|
6
|
+
@env = env
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
@env = env
|
11
|
+
vm = env[:machine]
|
12
|
+
if VagrantDNS::Config.auto_run
|
13
|
+
tmp_path = File.join(vm.env.tmp_path, "dns")
|
14
|
+
VagrantDNS::Configurator.new(vm, tmp_path).up!
|
15
|
+
end
|
16
|
+
@app.call(env)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module VagrantDNS
|
2
|
+
module Middlewares
|
3
|
+
class Restart
|
4
|
+
def initialize(app, env)
|
5
|
+
@app = app
|
6
|
+
@env = env
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
@env = env
|
11
|
+
vm = env[:machine]
|
12
|
+
if VagrantDNS::Config.auto_run
|
13
|
+
tmp_path = File.join(vm.env.tmp_path, "dns")
|
14
|
+
VagrantDNS::Service.new(tmp_path).restart!
|
15
|
+
env[:ui].info "Restarted DNS Service"
|
16
|
+
end
|
17
|
+
@app.call(env)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'yaml/store'
|
2
|
+
require 'forwardable'
|
3
|
+
|
4
|
+
module VagrantDNS
|
5
|
+
# This is the dns pattern registry (aka "config")
|
6
|
+
# It basically delegates everything to a YAML::Store but handles the conversion
|
7
|
+
# of Regexp dns-patterns into YAML string keys and reverse.
|
8
|
+
class Registry
|
9
|
+
extend Forwardable
|
10
|
+
|
11
|
+
def initialize(tmp_path)
|
12
|
+
@store = YAML::Store.new(File.join(tmp_path, "config"), true)
|
13
|
+
end
|
14
|
+
|
15
|
+
def_delegators :@store, :transaction, :abort, :commit
|
16
|
+
|
17
|
+
# This method is only valid in a #transaction and it cannot be read-only. It will raise PStore::Error if called at any other time.
|
18
|
+
def [](name)
|
19
|
+
name = name.source if name.respond_to? :source
|
20
|
+
@store[name]
|
21
|
+
end
|
22
|
+
|
23
|
+
# This method is only valid in a #transaction and it cannot be read-only. It will raise PStore::Error if called at any other time.
|
24
|
+
def []=(name, value)
|
25
|
+
name = name.source if name.respond_to? :source
|
26
|
+
@store[name] = value
|
27
|
+
end
|
28
|
+
|
29
|
+
def delete(name)
|
30
|
+
name = name.source if name.respond_to? :source
|
31
|
+
@store.delete(name)
|
32
|
+
end
|
33
|
+
|
34
|
+
# This method is only valid in a #transaction and it cannot be read-only. It will raise PStore::Error if called at any other time.
|
35
|
+
def root?(name)
|
36
|
+
name = name.source if name.respond_to? :source
|
37
|
+
@store.root?(name)
|
38
|
+
end
|
39
|
+
alias_method :key?, :root?
|
40
|
+
|
41
|
+
# This method is only valid in a #transaction and it cannot be read-only. It will raise PStore::Error if called at any other time.
|
42
|
+
def roots
|
43
|
+
@store.roots.map { |name| Regexp.new(name) }
|
44
|
+
end
|
45
|
+
alias_method :keys, :roots
|
46
|
+
|
47
|
+
# This method is only valid in a #transaction and it cannot be read-only. It will raise PStore::Error if called at any other time.
|
48
|
+
def any?
|
49
|
+
@store.roots.any?
|
50
|
+
end
|
51
|
+
|
52
|
+
def to_hash
|
53
|
+
@store.transaction(true) do
|
54
|
+
@store.roots.each_with_object({}) do |name, a|
|
55
|
+
a[Regexp.new(name)] = @store[name]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/lib/vagrant-dns/service.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'daemons'
|
2
2
|
|
3
|
-
|
4
3
|
module VagrantDNS
|
5
4
|
class Service
|
6
5
|
attr_accessor :tmp_path
|
@@ -22,18 +21,24 @@ module VagrantDNS
|
|
22
21
|
run!(run_options)
|
23
22
|
end
|
24
23
|
|
24
|
+
def status!
|
25
|
+
run_options = {:ARGV => ["status"]}.merge(runopts)
|
26
|
+
run!(run_options)
|
27
|
+
end
|
28
|
+
|
25
29
|
def run!(run_options)
|
26
30
|
Daemons.run_proc("vagrant-dns", run_options) do
|
27
31
|
require 'rubydns'
|
28
|
-
require '
|
32
|
+
require 'async/dns/system'
|
29
33
|
|
30
|
-
registry =
|
31
|
-
std_resolver = RubyDNS::Resolver.new(
|
34
|
+
registry = Registry.new(tmp_path).to_hash
|
35
|
+
std_resolver = RubyDNS::Resolver.new(Async::DNS::System.nameservers)
|
36
|
+
ttl = VagrantDNS::Config.ttl
|
32
37
|
|
33
|
-
RubyDNS::run_server(
|
38
|
+
RubyDNS::run_server(VagrantDNS::Config.listen) do
|
34
39
|
registry.each do |pattern, ip|
|
35
|
-
match(
|
36
|
-
transaction.respond!(ip)
|
40
|
+
match(pattern, Resolv::DNS::Resource::IN::A) do |transaction, match_data|
|
41
|
+
transaction.respond!(ip, ttl: ttl)
|
37
42
|
end
|
38
43
|
end
|
39
44
|
|
@@ -52,6 +57,18 @@ module VagrantDNS
|
|
52
57
|
start!(start_opts)
|
53
58
|
end
|
54
59
|
|
60
|
+
def show_config
|
61
|
+
registry = Registry.new(tmp_path).to_hash
|
62
|
+
|
63
|
+
if registry.any?
|
64
|
+
registry.each do |pattern, ip|
|
65
|
+
puts format("%s => %s", pattern.inspect, ip)
|
66
|
+
end
|
67
|
+
else
|
68
|
+
puts "Configuration missing or empty."
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
55
72
|
def runopts
|
56
73
|
daemon_dir = File.join(tmp_path, "daemon")
|
57
74
|
{
|
@@ -61,9 +78,5 @@ module VagrantDNS
|
|
61
78
|
:log_dir => daemon_dir
|
62
79
|
}
|
63
80
|
end
|
64
|
-
|
65
|
-
def config_file
|
66
|
-
File.join(tmp_path, "config")
|
67
|
-
end
|
68
81
|
end
|
69
82
|
end
|
data/lib/vagrant-dns/version.rb
CHANGED
data/tasks/acceptance.rake
CHANGED
@@ -1,25 +1,43 @@
|
|
1
|
+
require "tmpdir"
|
2
|
+
|
1
3
|
namespace :acceptance do
|
4
|
+
def tmp_dir_path
|
5
|
+
@tmp_dir_path ||= ENV["VS_TEMP"] || Dir.mktmpdir('vagrant-dns-spec')
|
6
|
+
end
|
7
|
+
|
2
8
|
ARTIFACT_DIR = File.join('test', 'acceptance', 'artifacts')
|
9
|
+
|
3
10
|
TEST_BOXES = {
|
4
|
-
|
11
|
+
# Ubuntu 16.04 https://app.vagrantup.com/ubuntu/boxes/xenial64.json
|
12
|
+
# :virtualbox => "https://vagrantcloud.com/ubuntu/boxes/xenial64/versions/20180511.0.0/providers/virtualbox.box"
|
13
|
+
# Ubuntu 18.04 https://app.vagrantup.com/ubuntu/boxes/bionic64.json
|
14
|
+
:virtualbox => "https://vagrantcloud.com/ubuntu/boxes/bionic64/versions/20180709.0.0/providers/virtualbox.box"
|
5
15
|
}
|
6
16
|
|
7
|
-
|
8
|
-
|
17
|
+
TEST_BOXES.each do |provider, box_url|
|
18
|
+
# Declare file download tasks
|
19
|
+
directory ARTIFACT_DIR
|
20
|
+
|
9
21
|
file File.join(ARTIFACT_DIR, "#{provider}.box") => ARTIFACT_DIR do |path|
|
10
22
|
puts 'Downloading: ' + box_url
|
11
23
|
Kernel.system 'curl', '-L', '-o', path.to_s, box_url
|
12
24
|
end
|
13
|
-
end
|
14
25
|
|
15
|
-
|
16
|
-
|
26
|
+
desc "Run acceptance tests for #{provider}"
|
27
|
+
task provider => :"setup:#{provider}" do |task|
|
28
|
+
box_path = File.expand_path(File.join('..', '..', ARTIFACT_DIR, "#{provider}.box"), __FILE__)
|
29
|
+
puts "TMPDIR: #{tmp_dir_path}"
|
30
|
+
Kernel.system(
|
31
|
+
{
|
32
|
+
"VS_PROVIDER" => provider.to_s,
|
33
|
+
"VS_BOX_PATH" => box_path,
|
34
|
+
"TMPDIR" => tmp_dir_path
|
35
|
+
},
|
36
|
+
"bundle", "exec", "vagrant-spec", "test"
|
37
|
+
)
|
38
|
+
end
|
17
39
|
|
18
|
-
|
19
|
-
|
20
|
-
command = 'vagrant-spec test'
|
21
|
-
puts command
|
22
|
-
puts
|
23
|
-
exec(command)
|
40
|
+
desc "downloads test boxes and other artifacts for #{provider}"
|
41
|
+
task :"setup:#{provider}" => File.join(ARTIFACT_DIR, "#{provider}.box")
|
24
42
|
end
|
25
43
|
end
|
data/vagrant-dns.gemspec
CHANGED
@@ -7,16 +7,20 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.description = %q{vagrant-dns is a vagrant plugin that manages DNS records associated with local machines.}
|
8
8
|
gem.summary = %q{vagrant-dns manages DNS records of vagrant machines}
|
9
9
|
gem.homepage = ""
|
10
|
+
gem.license = "MIT"
|
10
11
|
|
11
12
|
gem.files = `git ls-files`.split($\).reject { |f| f.match(%r{^(test|testdrive)/}) }
|
12
13
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
14
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
15
|
gem.name = "vagrant-dns"
|
15
16
|
gem.require_paths = ["lib"]
|
16
|
-
gem.version =
|
17
|
+
gem.version = VagrantDNS::VERSION
|
18
|
+
|
19
|
+
gem.required_ruby_version = '>= 2.2.6'
|
17
20
|
|
18
21
|
gem.add_dependency "daemons"
|
19
|
-
gem.add_dependency "rubydns", '~>
|
22
|
+
gem.add_dependency "rubydns", '~> 2.0.0'
|
23
|
+
gem.add_dependency "public_suffix"
|
20
24
|
|
21
|
-
gem.add_development_dependency 'rspec'
|
25
|
+
gem.add_development_dependency 'rspec'
|
22
26
|
end
|
data/vagrant-spec.config.rb
CHANGED
@@ -7,9 +7,11 @@ Vagrant::Spec::Acceptance.configure do |c|
|
|
7
7
|
c.component_paths = [acceptance_dir.to_s]
|
8
8
|
c.skeleton_paths = [(acceptance_dir + 'skeletons').to_s]
|
9
9
|
|
10
|
-
c.provider '
|
11
|
-
box:
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
c.provider ENV['VS_PROVIDER'],
|
11
|
+
box: ENV['VS_BOX_PATH'],
|
12
|
+
skeleton_path: c.skeleton_paths
|
13
|
+
|
14
|
+
# there seems no other way to set additional environment variables
|
15
|
+
# see: https://github.com/mitchellh/vagrant-spec/pull/17
|
16
|
+
c.instance_variable_set(:@env, c.env.merge('VBOX_USER_HOME' => "{{homedir}}"))
|
15
17
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-dns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Gilcher
|
8
8
|
- Robert Schulze
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-01-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: daemons
|
@@ -31,28 +31,42 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 2.0.0
|
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
|
-
version:
|
41
|
+
version: 2.0.0
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: public_suffix
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
42
56
|
- !ruby/object:Gem::Dependency
|
43
57
|
name: rspec
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
45
59
|
requirements:
|
46
|
-
- - "
|
60
|
+
- - ">="
|
47
61
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
62
|
+
version: '0'
|
49
63
|
type: :development
|
50
64
|
prerelease: false
|
51
65
|
version_requirements: !ruby/object:Gem::Requirement
|
52
66
|
requirements:
|
53
|
-
- - "
|
67
|
+
- - ">="
|
54
68
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
69
|
+
version: '0'
|
56
70
|
description: vagrant-dns is a vagrant plugin that manages DNS records associated with
|
57
71
|
local machines.
|
58
72
|
email:
|
@@ -64,6 +78,7 @@ extra_rdoc_files: []
|
|
64
78
|
files:
|
65
79
|
- ".gitignore"
|
66
80
|
- CHANGELOG.md
|
81
|
+
- DEVELOPMENT.md
|
67
82
|
- Gemfile
|
68
83
|
- LICENSE
|
69
84
|
- PLATFORM_SUPPORT.md
|
@@ -74,16 +89,20 @@ files:
|
|
74
89
|
- lib/vagrant-dns/config.rb
|
75
90
|
- lib/vagrant-dns/configurator.rb
|
76
91
|
- lib/vagrant-dns/installers/mac.rb
|
77
|
-
- lib/vagrant-dns/
|
92
|
+
- lib/vagrant-dns/middlewares/config_down.rb
|
93
|
+
- lib/vagrant-dns/middlewares/config_up.rb
|
94
|
+
- lib/vagrant-dns/middlewares/restart.rb
|
95
|
+
- lib/vagrant-dns/registry.rb
|
78
96
|
- lib/vagrant-dns/service.rb
|
79
97
|
- lib/vagrant-dns/version.rb
|
80
98
|
- tasks/acceptance.rake
|
81
99
|
- vagrant-dns.gemspec
|
82
100
|
- vagrant-spec.config.rb
|
83
101
|
homepage: ''
|
84
|
-
licenses:
|
102
|
+
licenses:
|
103
|
+
- MIT
|
85
104
|
metadata: {}
|
86
|
-
post_install_message:
|
105
|
+
post_install_message:
|
87
106
|
rdoc_options: []
|
88
107
|
require_paths:
|
89
108
|
- lib
|
@@ -91,16 +110,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
110
|
requirements:
|
92
111
|
- - ">="
|
93
112
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
113
|
+
version: 2.2.6
|
95
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
115
|
requirements:
|
97
116
|
- - ">="
|
98
117
|
- !ruby/object:Gem::Version
|
99
118
|
version: '0'
|
100
119
|
requirements: []
|
101
|
-
rubyforge_project:
|
102
|
-
rubygems_version: 2.
|
103
|
-
signing_key:
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 2.6.14.4
|
122
|
+
signing_key:
|
104
123
|
specification_version: 4
|
105
124
|
summary: vagrant-dns manages DNS records of vagrant machines
|
106
125
|
test_files: []
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module VagrantDNS
|
2
|
-
class RestartMiddleware
|
3
|
-
def initialize(app, env)
|
4
|
-
@app = app
|
5
|
-
@env = env
|
6
|
-
end
|
7
|
-
|
8
|
-
def call(env)
|
9
|
-
@env = env
|
10
|
-
vm = env[:machine]
|
11
|
-
if VagrantDNS::Config.auto_run
|
12
|
-
tmp_path = File.join(vm.env.tmp_path, "dns")
|
13
|
-
VagrantDNS::Configurator.new(vm, tmp_path).run!
|
14
|
-
VagrantDNS::Service.new(tmp_path).restart!
|
15
|
-
env[:ui].info "Restarted DNS Service"
|
16
|
-
end
|
17
|
-
|
18
|
-
@app.call(env)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|