vagrant-hosts 1.1.4 → 1.1.5
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.
- data/CHANGELOG +14 -0
- data/lib/vagrant-hosts/provisioner/hostname.rb +2 -2
- data/lib/vagrant-hosts/provisioner/linux.rb +18 -6
- data/lib/vagrant-hosts/version.rb +1 -1
- metadata +2 -2
data/CHANGELOG
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
=========
|
3
3
|
|
4
|
+
1.1.5
|
5
|
+
-----
|
6
|
+
|
7
|
+
2013-09-06
|
8
|
+
|
9
|
+
This is a backwards compatible bugfix release.
|
10
|
+
|
11
|
+
* (GH-11) Assign `config.vm.hostname` to 127.0.1.1 if available
|
12
|
+
* (GH-10, GH-13) Normalize hostnames and aliases.
|
13
|
+
* Add `change_host_name` shim support for Vagrant 1.3
|
14
|
+
|
15
|
+
Thanks to Charlie Sharpsteen for pretty much authoring this entire release.
|
16
|
+
|
17
|
+
|
4
18
|
1.1.4
|
5
19
|
-----
|
6
20
|
|
@@ -16,9 +16,9 @@ module VagrantHosts::Provisioner::Hostname
|
|
16
16
|
# @param name [String] The new hostname to apply on the guest
|
17
17
|
def change_host_name(name)
|
18
18
|
case Vagrant::VERSION
|
19
|
-
when
|
19
|
+
when /^1\.1/
|
20
20
|
@machine.guest.change_host_name(name)
|
21
|
-
when
|
21
|
+
when /^1\.2/, /^1\.3/
|
22
22
|
@machine.guest.capability(:change_host_name, name)
|
23
23
|
else
|
24
24
|
raise UnknownVersion, :vagrant_version => Vagrant::VERSION
|
@@ -49,10 +49,25 @@ class VagrantHosts::Provisioner::Linux
|
|
49
49
|
all_hosts
|
50
50
|
end
|
51
51
|
|
52
|
+
# Builds an array containing hostname and aliases for a given machine.
|
53
|
+
def hostnames_for_machine machine
|
54
|
+
# Cast any Symbols to Strings
|
55
|
+
machine_name = machine.name.to_s
|
56
|
+
hostname = machine.config.vm.hostname || machine_name
|
57
|
+
|
58
|
+
hostnames = [hostname]
|
59
|
+
# If the hostname is a fqdn, add the first component as an alias.
|
60
|
+
hostnames << hostname.split('.').first if hostname.index('.')
|
61
|
+
# Also add the machine name as an alias.
|
62
|
+
hostnames << machine_name unless hostnames.include? machine_name
|
63
|
+
|
64
|
+
hostnames
|
65
|
+
end
|
66
|
+
|
52
67
|
def local_hosts
|
53
68
|
[
|
54
69
|
['127.0.0.1', ['localhost']],
|
55
|
-
['127.0.1.1',
|
70
|
+
['127.0.1.1', hostnames_for_machine(@machine)],
|
56
71
|
]
|
57
72
|
end
|
58
73
|
|
@@ -60,13 +75,10 @@ class VagrantHosts::Provisioner::Linux
|
|
60
75
|
hosts = []
|
61
76
|
|
62
77
|
all_machines.each do |m|
|
63
|
-
|
64
|
-
m_hostname = m.config.vm.hostname
|
65
|
-
|
66
|
-
m_networks.each do |(net_type, opts)|
|
78
|
+
m.config.vm.networks.each do |(net_type, opts)|
|
67
79
|
next unless net_type == :private_network
|
68
80
|
addr = opts[:ip]
|
69
|
-
hosts << [addr,
|
81
|
+
hosts << [addr, hostnames_for_machine(m)]
|
70
82
|
end
|
71
83
|
end
|
72
84
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-hosts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-06 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! ' Manage static DNS entries and configuration for Vagrant guests.
|
15
15
|
|