vagrant-hostmanager 1.7.1 → 1.8.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: 075560d0ced2cfb86f6b0e4688ef929ff3d7883d
4
- data.tar.gz: 0f7fcfd445d8b99f37b506c200fc2f1f1e1dfb9c
3
+ metadata.gz: 01e3061c0eab68257b9087d51b83fcbab0157fec
4
+ data.tar.gz: ce2fa96a34197f5e02968bdaefc208739f9e397d
5
5
  SHA512:
6
- metadata.gz: 48e7d74ad76e812646c25f9fdb65ca36b6077e83caaf53b28005a2e8a0daf1b4fe8006c97026354077f16dc1c27234c1319bbea2519902dba80c950d031f3f01
7
- data.tar.gz: 4f5afe7118dedf2bbae2c1f8d04c75ad5955fe356ad2e17d6b2e0410dafdb0110058c52c1df7e8243e89c831854d2ae466ee2b03e9399d51535b3365bb1a0828
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
- env[:ui].info I18n.t('vagrant_hostmanager.action.update_guests')
31
- @global_env.active_machines.each do |name, p|
32
- if p == @provider
33
- machine = @global_env.machine(name, p)
34
- @updater.update_guest(machine)
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
- env[:ui].info I18n.t('vagrant_hostmanager.action.update_guest', {
18
- :name => @machine.name
19
- })
20
- @updater.update_guest(@machine)
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
- @app.call(env)
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!
@@ -12,7 +12,9 @@ module VagrantPlugins
12
12
  end
13
13
 
14
14
  def provision
15
- @updater.update_guest(@machine)
15
+ if @config.hostmanager.manage_guest?
16
+ @updater.update_guest(@machine)
17
+ end
16
18
  if @config.hostmanager.manage_host?
17
19
  @updater.update_host
18
20
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module HostManager
3
- VERSION = '1.7.1'
3
+ VERSION = '1.8.0'
4
4
  end
5
5
  end
@@ -16,6 +16,7 @@ Vagrant.configure('2') do |config|
16
16
 
17
17
  config.hostmanager.enabled = true
18
18
  config.hostmanager.manage_host = true
19
+ config.hostmanager.manage_guest = true
19
20
 
20
21
  config.vm.define :server1 do |server|
21
22
  server.vm.hostname = 'fry'
@@ -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.7.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-01-29 00:00:00.000000000 Z
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: []