vagrant-hostmanager 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/README.md +5 -2
- data/lib/vagrant-hostmanager/action/update_all.rb +5 -9
- data/lib/vagrant-hostmanager/hosts_file.rb +9 -10
- data/lib/vagrant-hostmanager/plugin.rb +0 -12
- data/lib/vagrant-hostmanager/version.rb +1 -1
- metadata +7 -17
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -5,6 +5,9 @@ file on guest machines (and optionally the host). Its goal is to enable
|
|
5
5
|
resolution of multi-machine environments deployed with a cloud provider
|
6
6
|
where IP addresses are not known in advance.
|
7
7
|
|
8
|
+
*NOTE:* Version 1.1 of the plugin prematurely introduced a feature to hook into
|
9
|
+
commands other than `vagrant up` and `vagrant destroy`. Version 1.1 broke support for some providers. Version 1.2 reverts this feature until a suitable implementation supporting all providers is available.
|
10
|
+
|
8
11
|
Installation
|
9
12
|
------------
|
10
13
|
Install the plugin following the typical Vagrant 1.1 procedure:
|
@@ -18,8 +21,8 @@ command:
|
|
18
21
|
|
19
22
|
$ vagrant hostmanager
|
20
23
|
|
21
|
-
The plugin hooks into the `vagrant up
|
22
|
-
|
24
|
+
The plugin hooks into the `vagrant up` and `vagrant destroy` commands
|
25
|
+
automatically.
|
23
26
|
When a machine enters or exits the running state , all active
|
24
27
|
machines with the same provider will have their `/etc/hosts` file updated
|
25
28
|
accordingly. Set the `hostmanager.enabled` attribute to `true` in the
|
@@ -15,17 +15,13 @@ module VagrantPlugins
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def call(env)
|
18
|
-
# skip if machine is
|
19
|
-
return @app.call(env) if @machine.
|
20
|
-
# skip if machine is not
|
21
|
-
return @app.call(env) if
|
22
|
-
# skip if machine is not saved and the action is resume
|
23
|
-
return @app.call(env) if @machine.state.id != :saved && env[:machine_action] == :resume
|
24
|
-
# skip if machine is not running and the action is suspend
|
25
|
-
return @app.call(env) if @machine.state.id != :running && env[:machine_action] == :suspend
|
18
|
+
# skip if machine is already active on up action
|
19
|
+
return @app.call(env) if @machine.id && env[:machine_action] == :up
|
20
|
+
# skip if machine is not active on destroy action
|
21
|
+
return @app.call(env) if !@machine.id && env[:machine_action] == :destroy
|
26
22
|
|
27
23
|
# check config to see if the hosts file should be update automatically
|
28
|
-
return @app.call(env) unless @
|
24
|
+
return @app.call(env) unless @global_env.config_global.hostmanager.enabled?
|
29
25
|
@logger.info 'Updating /etc/hosts file automatically'
|
30
26
|
|
31
27
|
@app.call(env)
|
@@ -72,21 +72,20 @@ module VagrantPlugins
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def get_machines
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
# check if offline machines should be included in host entries
|
81
|
-
if @global_env.config_global.hostmanager.include_offline? || machine.state.id == :running
|
75
|
+
if @global_env.config_global.hostmanager.include_offline?
|
76
|
+
machines = []
|
77
|
+
@global_env.machine_names.each do |name|
|
78
|
+
begin
|
79
|
+
@global_env.machine(name, @provider)
|
82
80
|
machines << [name, @provider]
|
81
|
+
rescue Vagrant::Errors::MachineNotFound
|
83
82
|
end
|
84
|
-
rescue Vagrant::Errors::MachineNotFound
|
85
83
|
end
|
84
|
+
machines
|
85
|
+
else
|
86
|
+
@global_env.active_machines
|
86
87
|
end
|
87
|
-
machines
|
88
88
|
end
|
89
|
-
|
90
89
|
end
|
91
90
|
end
|
92
91
|
end
|
@@ -24,18 +24,6 @@ module VagrantPlugins
|
|
24
24
|
hook.prepend(Action.update_all)
|
25
25
|
end
|
26
26
|
|
27
|
-
action_hook(:hostmanager, :machine_action_halt) do |hook|
|
28
|
-
hook.prepend(Action.update_all)
|
29
|
-
end
|
30
|
-
|
31
|
-
action_hook(:hostmanager, :machine_action_resume) do |hook|
|
32
|
-
hook.prepend(Action.update_all)
|
33
|
-
end
|
34
|
-
|
35
|
-
action_hook(:hostmanager, :machine_action_suspend) do |hook|
|
36
|
-
hook.prepend(Action.update_all)
|
37
|
-
end
|
38
|
-
|
39
27
|
provisioner(:hostmanager) do
|
40
28
|
require_relative 'provisioner'
|
41
29
|
Provisioner
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-hostmanager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &9183860 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,15 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.3'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '1.3'
|
24
|
+
version_requirements: *9183860
|
30
25
|
- !ruby/object:Gem::Dependency
|
31
26
|
name: rake
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &9190520 !ruby/object:Gem::Requirement
|
33
28
|
none: false
|
34
29
|
requirements:
|
35
30
|
- - ! '>='
|
@@ -37,12 +32,7 @@ dependencies:
|
|
37
32
|
version: '0'
|
38
33
|
type: :development
|
39
34
|
prerelease: false
|
40
|
-
version_requirements:
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
35
|
+
version_requirements: *9190520
|
46
36
|
description: A Vagrant plugin that manages the /etc/hosts file within a multi-machine
|
47
37
|
environment
|
48
38
|
email:
|
@@ -92,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
82
|
version: '0'
|
93
83
|
requirements: []
|
94
84
|
rubyforge_project:
|
95
|
-
rubygems_version: 1.8.
|
85
|
+
rubygems_version: 1.8.11
|
96
86
|
signing_key:
|
97
87
|
specification_version: 3
|
98
88
|
summary: A Vagrant plugin that manages the /etc/hosts file within a multi-machine
|