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:
Shawn Dahlen 2013-08-22 17:12:33 -04:00
parent 4136b1ee7b
commit 436b171f53
4 changed files with 10 additions and 23 deletions

View File

@ -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
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
------------
Install the plugin following the typical Vagrant 1.1 procedure:
@ -18,8 +21,8 @@ command:
$ vagrant hostmanager
The plugin hooks into the `vagrant up`, `vagrant destroy`, `vagrant halt`,
`vagrant resume` and `vagrant suspend` commands automatically.
The plugin hooks into the `vagrant up` and `vagrant destroy` commands
automatically.
When a machine enters or exits the running state , all active
machines with the same provider will have their `/etc/hosts` file updated
accordingly. Set the `hostmanager.enabled` attribute to `true` in the

View File

@ -15,14 +15,10 @@ module VagrantPlugins
end
def call(env)
# skip if machine is running and the action is resume or up
return @app.call(env) if @machine.state.id == :running && [:resume, :up].include?(env[:machine_action])
# skip if machine is not running and the action is destroy, halt or suspend
return @app.call(env) if @machine.state.id != :running && [:destroy, :halt, :suspend].include?(env[:machine_action])
# 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
# skip if machine is already active on up action
return @app.call(env) if @machine.id && env[:machine_action] == :up
# skip if machine is not active on destroy action
return @app.call(env) if !@machine.id && env[:machine_action] == :destroy
# check config to see if the hosts file should be update automatically
return @app.call(env) unless @global_env.config_global.hostmanager.enabled?

View File

@ -24,18 +24,6 @@ module VagrantPlugins
hook.prepend(Action.update_all)
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
require_relative 'provisioner'
Provisioner

View File

@ -1,5 +1,5 @@
module VagrantPlugins
module HostManager
VERSION = '1.1.0'
VERSION = '1.2.0'
end
end