vagrant-hostmanager 1.7.1 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/vagrant-hostmanager/action/update_all.rb +7 -5
- data/lib/vagrant-hostmanager/action/update_guest.rb +9 -5
- data/lib/vagrant-hostmanager/command.rb +1 -0
- data/lib/vagrant-hostmanager/config.rb +5 -0
- data/lib/vagrant-hostmanager/provisioner.rb +3 -1
- data/lib/vagrant-hostmanager/version.rb +1 -1
- data/test/Vagrantfile +1 -0
- data/vagrant-hostmanager.gemspec +2 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01e3061c0eab68257b9087d51b83fcbab0157fec
|
4
|
+
data.tar.gz: ce2fa96a34197f5e02968bdaefc208739f9e397d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 374153a2666021a7217c29df0e8ab98cef47c94895f3e55eb3b23b324e6565142f2d348c810c1a0e5e00ea1b4a18b3313867afdfff8295a5cf6b6555192bf821
|
7
|
+
data.tar.gz: 12e90ca4239877a1591e6a54276c8cefce905a471fdbb929a1520f5a0efe8d1e579e49f6e4099fb69bec9d8ec951fbcd912bb99f4257ca9ff0444111ed6b51a5
|
data/README.md
CHANGED
@@ -46,6 +46,9 @@ Vagrantfile to activate this behavior.
|
|
46
46
|
To update the host's `/etc/hosts` file, set the `hostmanager.manage_host`
|
47
47
|
attribute to `true`.
|
48
48
|
|
49
|
+
To update the guests' `/etc/hosts` file, set the `hostmanager.manage_guest`
|
50
|
+
attribute to `true`.
|
51
|
+
|
49
52
|
A machine's IP address is defined by either the static IP for a private
|
50
53
|
network configuration or by the SSH host configuration. To disable
|
51
54
|
using the private network IP address, set `config.hostmanager.ignore_private_ip`
|
@@ -66,6 +69,7 @@ Example configuration:
|
|
66
69
|
Vagrant.configure("2") do |config|
|
67
70
|
config.hostmanager.enabled = true
|
68
71
|
config.hostmanager.manage_host = true
|
72
|
+
config.hostmanager.manage_guest = true
|
69
73
|
config.hostmanager.ignore_private_ip = false
|
70
74
|
config.hostmanager.include_offline = true
|
71
75
|
config.vm.define 'example-box' do |node|
|
@@ -27,11 +27,13 @@ module VagrantPlugins
|
|
27
27
|
@app.call(env)
|
28
28
|
|
29
29
|
# update /etc/hosts file on active machines
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
if @machine.config.hostmanager.manage_guest?
|
31
|
+
env[:ui].info I18n.t('vagrant_hostmanager.action.update_guests')
|
32
|
+
@global_env.active_machines.each do |name, p|
|
33
|
+
if p == @provider
|
34
|
+
machine = @global_env.machine(name, p)
|
35
|
+
@updater.update_guest(machine)
|
36
|
+
end
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
@@ -8,18 +8,22 @@ module VagrantPlugins
|
|
8
8
|
|
9
9
|
def initialize(app, env)
|
10
10
|
@app = app
|
11
|
+
global_env = env[:global_env]
|
12
|
+
@config = Util.get_config(global_env)
|
11
13
|
@machine = env[:machine]
|
12
14
|
@updater = HostsFile::Updater.new(@machine.env, env[:provider])
|
13
15
|
@logger = Log4r::Logger.new('vagrant::hostmanager::update_guest')
|
14
16
|
end
|
15
17
|
|
16
18
|
def call(env)
|
17
|
-
|
18
|
-
:
|
19
|
-
|
20
|
-
|
19
|
+
if @config.hostmanager.manage_guest?
|
20
|
+
env[:ui].info I18n.t('vagrant_hostmanager.action.update_guest', {
|
21
|
+
:name => @machine.name
|
22
|
+
})
|
23
|
+
@updater.update_guest(@machine)
|
21
24
|
|
22
|
-
|
25
|
+
@app.call(env)
|
26
|
+
end
|
23
27
|
end
|
24
28
|
end
|
25
29
|
end
|
@@ -27,6 +27,7 @@ module VagrantPlugins
|
|
27
27
|
# update /etc/hosts file for specified guest machines
|
28
28
|
with_target_vms(argv, options) do |machine|
|
29
29
|
@env.action_runner.run(Action.update_guest, {
|
30
|
+
:global_env => @env,
|
30
31
|
:machine => machine,
|
31
32
|
:provider => options[:provider]
|
32
33
|
})
|
@@ -3,6 +3,7 @@ module VagrantPlugins
|
|
3
3
|
class Config < Vagrant.plugin('2', :config)
|
4
4
|
attr_accessor :enabled
|
5
5
|
attr_accessor :manage_host
|
6
|
+
attr_accessor :manage_guest
|
6
7
|
attr_accessor :ignore_private_ip
|
7
8
|
attr_accessor :aliases
|
8
9
|
attr_accessor :include_offline
|
@@ -11,10 +12,12 @@ module VagrantPlugins
|
|
11
12
|
alias_method :enabled?, :enabled
|
12
13
|
alias_method :include_offline?, :include_offline
|
13
14
|
alias_method :manage_host?, :manage_host
|
15
|
+
alias_method :manage_guest?, :manage_guest
|
14
16
|
|
15
17
|
def initialize
|
16
18
|
@enabled = UNSET_VALUE
|
17
19
|
@manage_host = UNSET_VALUE
|
20
|
+
@manage_guest = UNSET_VALUE
|
18
21
|
@ignore_private_ip = UNSET_VALUE
|
19
22
|
@include_offline = UNSET_VALUE
|
20
23
|
@aliases = UNSET_VALUE
|
@@ -24,6 +27,7 @@ module VagrantPlugins
|
|
24
27
|
def finalize!
|
25
28
|
@enabled = false if @enabled == UNSET_VALUE
|
26
29
|
@manage_host = false if @manage_host == UNSET_VALUE
|
30
|
+
@manage_guest = false if @manage_guest == UNSET_VALUE
|
27
31
|
@ignore_private_ip = false if @ignore_private_ip == UNSET_VALUE
|
28
32
|
@include_offline = false if @include_offline == UNSET_VALUE
|
29
33
|
@aliases = [] if @aliases == UNSET_VALUE
|
@@ -37,6 +41,7 @@ module VagrantPlugins
|
|
37
41
|
|
38
42
|
errors << validate_bool('hostmanager.enabled', @enabled)
|
39
43
|
errors << validate_bool('hostmanager.manage_host', @manage_host)
|
44
|
+
errors << validate_bool('hostmanager.manage_guest', @manage_guest)
|
40
45
|
errors << validate_bool('hostmanager.ignore_private_ip', @ignore_private_ip)
|
41
46
|
errors << validate_bool('hostmanager.include_offline', @include_offline)
|
42
47
|
errors.compact!
|
data/test/Vagrantfile
CHANGED
data/vagrant-hostmanager.gemspec
CHANGED
@@ -7,8 +7,8 @@ require 'vagrant-hostmanager/version'
|
|
7
7
|
Gem::Specification.new do |gem|
|
8
8
|
gem.name = 'vagrant-hostmanager'
|
9
9
|
gem.version = VagrantPlugins::HostManager::VERSION
|
10
|
-
gem.authors = ['Shawn Dahlen']
|
11
|
-
gem.email = ['shawn@dahlen.me']
|
10
|
+
gem.authors = ['Shawn Dahlen','Seth Reeser']
|
11
|
+
gem.email = ['shawn@dahlen.me','info@devopsgroup.io']
|
12
12
|
gem.description = %q{A Vagrant plugin that manages the /etc/hosts file within a multi-machine environment}
|
13
13
|
gem.summary = gem.description
|
14
14
|
gem.license = 'MIT'
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-hostmanager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shawn Dahlen
|
8
|
+
- Seth Reeser
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2016-
|
12
|
+
date: 2016-02-11 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -42,6 +43,7 @@ description: A Vagrant plugin that manages the /etc/hosts file within a multi-ma
|
|
42
43
|
environment
|
43
44
|
email:
|
44
45
|
- shawn@dahlen.me
|
46
|
+
- info@devopsgroup.io
|
45
47
|
executables: []
|
46
48
|
extensions: []
|
47
49
|
extra_rdoc_files: []
|