vagrant-hostentries 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile.lock +1 -1
- data/lib/vagrant-hostentries/action/update_hosts_entry.rb +23 -19
- data/lib/vagrant-hostentries/action.rb +19 -19
- data/vagrant-hostentries.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2M5YmMyZjM5NjdlMmI4ZmQ2MWIxMmE2MzBkOTg1ODFmYjQ0ZTVlMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Y2M5YzQxY2IxY2MzNTY5NGQwYjA2Mzk0NDZiNjJlYTIyODgzZDUyYg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjY1Mjk0ZjMzZDJiYWM4YzFhYTkwMGE4OTZkN2MzMWViNjBiZTkzMDQ5MTNk
|
10
|
+
MDBkZDU5MTVlZWM2MjkyNzQyMGI2YjhkZWYzYzczMDEyYzhlMTkzMzZmMWQ4
|
11
|
+
NDJjZWZmNmVhMDY1MWY5ZWY5ZDg2ODU0Y2FmNTg4NGE2YjNkNDg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjFlZTU5ODY0MTNlMWNhZjM2ZDNjNDlkYmJjMzM0ZjczYTVhYjI3MDE2ODA5
|
14
|
+
MWJmNmRjMzY5MGQ1ZGE1YWY2YTIzZjI3ZjZkZTg1YWVkZjYzMThkMTFjM2M0
|
15
|
+
NGYzMGY2NTJjNjU2MDg2ODQ2MTRmMDk4NjdlNzQ2NTNkOWY1YjU=
|
data/Gemfile.lock
CHANGED
@@ -1,33 +1,37 @@
|
|
1
1
|
require 'log4r'
|
2
2
|
|
3
3
|
module VagrantPlugins
|
4
|
-
|
5
|
-
|
6
|
-
|
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
|
-
|
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
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
|
-
|
31
|
-
|
32
|
-
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
33
37
|
end
|
@@ -1,24 +1,24 @@
|
|
1
1
|
module VagrantPlugins
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
23
|
-
|
22
|
+
end
|
23
|
+
end
|
24
24
|
end
|
data/vagrant-hostentries.gemspec
CHANGED
@@ -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.
|
16
|
+
gem.version = "0.6.4"
|
17
17
|
|
18
18
|
gem.add_development_dependency 'bundler'
|
19
19
|
gem.add_development_dependency 'vagrant'
|