Remove suspend, resume, and halt hooks.
This commits removes hooks that introduced dependencies to machine state and therefore broke compatibility with all Vagrant providers.
This commit is contained in:
parent
4136b1ee7b
commit
436b171f53
|
@ -5,6 +5,9 @@ file on guest machines (and optionally the host). Its goal is to enable
|
||||||
resolution of multi-machine environments deployed with a cloud provider
|
resolution of multi-machine environments deployed with a cloud provider
|
||||||
where IP addresses are not known in advance.
|
where IP addresses are not known in advance.
|
||||||
|
|
||||||
|
*NOTE:* Version 1.1 of the plugin prematurely introduced a feature to hook into
|
||||||
|
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.
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
Install the plugin following the typical Vagrant 1.1 procedure:
|
Install the plugin following the typical Vagrant 1.1 procedure:
|
||||||
|
@ -18,8 +21,8 @@ command:
|
||||||
|
|
||||||
$ vagrant hostmanager
|
$ vagrant hostmanager
|
||||||
|
|
||||||
The plugin hooks into the `vagrant up`, `vagrant destroy`, `vagrant halt`,
|
The plugin hooks into the `vagrant up` and `vagrant destroy` commands
|
||||||
`vagrant resume` and `vagrant suspend` commands automatically.
|
automatically.
|
||||||
When a machine enters or exits the running state , all active
|
When a machine enters or exits the running state , all active
|
||||||
machines with the same provider will have their `/etc/hosts` file updated
|
machines with the same provider will have their `/etc/hosts` file updated
|
||||||
accordingly. Set the `hostmanager.enabled` attribute to `true` in the
|
accordingly. Set the `hostmanager.enabled` attribute to `true` in the
|
||||||
|
|
|
@ -15,14 +15,10 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def call(env)
|
def call(env)
|
||||||
# skip if machine is running and the action is resume or up
|
# skip if machine is already active on up action
|
||||||
return @app.call(env) if @machine.state.id == :running && [:resume, :up].include?(env[:machine_action])
|
return @app.call(env) if @machine.id && env[:machine_action] == :up
|
||||||
# skip if machine is not running and the action is destroy, halt or suspend
|
# skip if machine is not active on destroy action
|
||||||
return @app.call(env) if @machine.state.id != :running && [:destroy, :halt, :suspend].include?(env[:machine_action])
|
return @app.call(env) if !@machine.id && env[:machine_action] == :destroy
|
||||||
# skip if machine is not saved and the action is resume
|
|
||||||
return @app.call(env) if @machine.state.id != :saved && env[:machine_action] == :resume
|
|
||||||
# skip if machine is not running and the action is suspend
|
|
||||||
return @app.call(env) if @machine.state.id != :running && env[:machine_action] == :suspend
|
|
||||||
|
|
||||||
# check config to see if the hosts file should be update automatically
|
# check config to see if the hosts file should be update automatically
|
||||||
return @app.call(env) unless @global_env.config_global.hostmanager.enabled?
|
return @app.call(env) unless @global_env.config_global.hostmanager.enabled?
|
||||||
|
|
|
@ -24,18 +24,6 @@ module VagrantPlugins
|
||||||
hook.prepend(Action.update_all)
|
hook.prepend(Action.update_all)
|
||||||
end
|
end
|
||||||
|
|
||||||
action_hook(:hostmanager, :machine_action_halt) do |hook|
|
|
||||||
hook.prepend(Action.update_all)
|
|
||||||
end
|
|
||||||
|
|
||||||
action_hook(:hostmanager, :machine_action_resume) do |hook|
|
|
||||||
hook.prepend(Action.update_all)
|
|
||||||
end
|
|
||||||
|
|
||||||
action_hook(:hostmanager, :machine_action_suspend) do |hook|
|
|
||||||
hook.prepend(Action.update_all)
|
|
||||||
end
|
|
||||||
|
|
||||||
provisioner(:hostmanager) do
|
provisioner(:hostmanager) do
|
||||||
require_relative 'provisioner'
|
require_relative 'provisioner'
|
||||||
Provisioner
|
Provisioner
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module HostManager
|
module HostManager
|
||||||
VERSION = '1.1.0'
|
VERSION = '1.2.0'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue