lib/vagrant-betterhosts/plugin.rb in vagrant-betterhosts-0.2.1 vs lib/vagrant-betterhosts/plugin.rb in vagrant-betterhosts-1.1.6
- old
+ new
@@ -3,10 +3,11 @@
require_relative "Action/UpdateHosts"
require_relative "Action/RemoveHosts"
module VagrantPlugins
module BetterHosts
+ # Various Vagrant hooks
class Plugin < Vagrant.plugin('2')
name 'BetterHosts'
description <<-DESC
This plugin manages the /etc/hosts file for the host machine. An entry is
created for the hostname attribute in the vm.config.
@@ -19,23 +20,27 @@
action_hook(:betterhosts, :machine_action_up) do |hook|
hook.append(Action::UpdateHosts)
end
+ action_hook(:betterhosts, :machine_action_boot) do |hook|
+ hook.append(Action::UpdateHosts)
+ end
+
action_hook(:betterhosts, :machine_action_provision) do |hook|
hook.before(Vagrant::Action::Builtin::Provision, Action::UpdateHosts)
end
action_hook(:betterhosts, :machine_action_halt) do |hook|
- hook.append(Action::RemoveHosts)
+ hook.prepend(Action::RemoveHosts)
end
action_hook(:betterhosts, :machine_action_suspend) do |hook|
- hook.append(Action::RemoveHosts)
+ hook.prepend(Action::RemoveHosts)
end
action_hook(:betterhosts, :machine_action_destroy) do |hook|
- hook.append(Action::RemoveHosts)
+ hook.prepend(Action::RemoveHosts)
end
action_hook(:betterhosts, :machine_action_reload) do |hook|
hook.prepend(Action::RemoveHosts)
hook.append(Action::UpdateHosts)