vagrant-hostentries 0.6.3 → 0.6.4

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZmM4NjM1ZDA4MmQwYzBjZmUzMjUwMTQ0YmI2ZWVkMjZmYWFkOTA2NA==
4
+ Y2M5YmMyZjM5NjdlMmI4ZmQ2MWIxMmE2MzBkOTg1ODFmYjQ0ZTVlMw==
5
5
  data.tar.gz: !binary |-
6
- MTAxZjVkMzg3NDIxM2Y4YjI5MDE2OWZmOGI5YmRlYTU5YzM1M2U4ZQ==
6
+ Y2M5YzQxY2IxY2MzNTY5NGQwYjA2Mzk0NDZiNjJlYTIyODgzZDUyYg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NTY3YzhiNWVmZTA2MjE2ZDViNWNjZjQzNzgwNjJkODY4ZGE4ZGRiYWRlM2M4
10
- MmQyNzI0YTM2ZGM0NDdjOWUyYWNhNDJkY2VhMzI5ZmRhZTIyZGIwZjc5NWFl
11
- ZDdmMjY1OTc4ZTMwNDk5YjU3NjA4MzEzYTYxMWE4NDViY2ZjMTk=
9
+ NjY1Mjk0ZjMzZDJiYWM4YzFhYTkwMGE4OTZkN2MzMWViNjBiZTkzMDQ5MTNk
10
+ MDBkZDU5MTVlZWM2MjkyNzQyMGI2YjhkZWYzYzczMDEyYzhlMTkzMzZmMWQ4
11
+ NDJjZWZmNmVhMDY1MWY5ZWY5ZDg2ODU0Y2FmNTg4NGE2YjNkNDg=
12
12
  data.tar.gz: !binary |-
13
- ZDM2MWZkYTU4YWRhZjQ4YmY1YzVjYjI2NGE2ZjQ2OGE5MjU5NDYzM2U0MDI2
14
- ZDYxM2M2M2UyYzY2MWIxNDc4YmZmMTY2NDk1ZWI3NTE4ZTAwMGYzNmM1MGY0
15
- MzkwZTJjOTRkNzQwZTAyNGJhYjE2MGVkZDYwODBmNzY3YzhjMDM=
13
+ MjFlZTU5ODY0MTNlMWNhZjM2ZDNjNDlkYmJjMzM0ZjczYTVhYjI3MDE2ODA5
14
+ MWJmNmRjMzY5MGQ1ZGE1YWY2YTIzZjI3ZjZkZTg1YWVkZjYzMThkMTFjM2M0
15
+ NGYzMGY2NTJjNjU2MDg2ODQ2MTRmMDk4NjdlNzQ2NTNkOWY1YjU=
data/Gemfile.lock CHANGED
@@ -14,7 +14,7 @@ GIT
14
14
  PATH
15
15
  remote: .
16
16
  specs:
17
- vagrant-hostentries (0.6.3)
17
+ vagrant-hostentries (0.6.4)
18
18
 
19
19
  GEM
20
20
  remote: https://rubygems.org/
@@ -1,33 +1,37 @@
1
1
  require 'log4r'
2
2
 
3
3
  module VagrantPlugins
4
- module Hostentries
5
- module Action
6
- class UpdateHostsEntry
4
+ module Hostentries
5
+ module Action
6
+ class UpdateHostsEntry
7
7
  def initialize(app, env)
8
8
  @app = app
9
9
  @logger = Log4r::Logger.new("VagrantPlugins::Hosts")
10
10
  end
11
11
 
12
12
  def call(env)
13
- env[:host].update_hosts_entry(env[:machine].guest.capability(:read_ip_address), env[:machine].config.vm.hostname)
13
+ # Update the host system's hostfile entry for the booting guest
14
+ env[:host].update_hosts_entry(env[:machine].guest.capability(:read_ip_address), env[:machine].config.vm.hostname)
15
+
16
+ # Update each guest machines' host entry with all the other guest machines' entries
14
17
  env[:machine].env.active_machines.each do |machine|
15
- m = env[:machine].env.machine(machine[0], machine[1])
16
- if !m.guest.capability?(:update_hosts_entry)
17
- @logger.warn "Unsupported machine #{machine.config.name}"
18
- next
19
- end
20
- env[:machine].env.active_machines.each do |machine2|
21
- m2 = env[:machine].env.machine(machine2[0], machine2[1])
22
- m2_ip = m2.guest.capability(:read_ip_address)
23
- m2_hostname = m2.config.vm.hostname
24
- env[:ui].info "Adding IP: #{m2_ip} -> Hostname: #{m2_hostname}"
25
- m.guest.capability(:update_hosts_entry, m2_ip, m2_hostname)
26
- end
18
+ m = env[:machine].env.machine(machine[0], machine[1])
19
+ if !m.guest.capability?(:update_hosts_entry) || !m.methods.member? :guest
20
+ @logger.warn "Unsupported machine #{machine.config.name}"
21
+ next
22
+ end
23
+ env[:machine].env.active_machines.each do |machine2|
24
+ m2 = env[:machine].env.machine(machine2[0], machine2[1])
25
+ next unless m2.methods.member? :guest # skip machines not in service
26
+ m2_ip = m2.guest.capability(:read_ip_address)
27
+ m2_hostname = m2.config.vm.hostname
28
+ env[:ui].info "Adding IP: #{m2_ip} -> Hostname: #{m2_hostname}"
29
+ m.guest.capability(:update_hosts_entry, m2_ip, m2_hostname)
30
+ end
27
31
  end
28
32
  return @app.call(env)
29
33
  end
30
- end
31
- end
32
- end
34
+ end
35
+ end
36
+ end
33
37
  end
@@ -1,24 +1,24 @@
1
1
  module VagrantPlugins
2
- module Hostentries
3
- module Action
4
- autoload :RemoveHostsEntry, 'vagrant-hostentries/action/remove_hosts_entry'
5
- autoload :UpdateHostsEntry, 'vagrant-hostentries/action/update_hosts_entry'
2
+ module Hostentries
3
+ module Action
4
+ autoload :RemoveHostsEntry, 'vagrant-hostentries/action/remove_hosts_entry'
5
+ autoload :UpdateHostsEntry, 'vagrant-hostentries/action/update_hosts_entry'
6
6
 
7
- class << self
8
- def update_hosts_entry
9
- #@update_hosts_entry ||= ::
10
- Vagrant::Action::Builder.new.tap do |b|
11
- b.use VagrantPlugins::Hostentries::Action::UpdateHostsEntry
12
- end
13
- end
7
+ class << self
8
+ def update_hosts_entry
9
+ #@update_hosts_entry ||= ::
10
+ Vagrant::Action::Builder.new.tap do |b|
11
+ b.use VagrantPlugins::Hostentries::Action::UpdateHostsEntry
12
+ end
13
+ end
14
14
 
15
- def remove_hosts_entry
16
- @remove_hosts_entry ||= ::Vagrant::Action::Builder.new.tap do |b|
17
- b.use VagrantPlugins::Hostentries::Action::RemoveHostsEntry
18
- end
19
- end
20
- end
15
+ def remove_hosts_entry
16
+ @remove_hosts_entry ||= ::Vagrant::Action::Builder.new.tap do |b|
17
+ b.use VagrantPlugins::Hostentries::Action::RemoveHostsEntry
18
+ end
19
+ end
20
+ end
21
21
 
22
- end
23
- end
22
+ end
23
+ end
24
24
  end
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
13
13
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
14
  gem.name = "vagrant-hostentries"
15
15
  gem.require_paths = ["lib"]
16
- gem.version = "0.6.3"
16
+ gem.version = "0.6.4"
17
17
 
18
18
  gem.add_development_dependency 'bundler'
19
19
  gem.add_development_dependency 'vagrant'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-hostentries
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Geggie