Class: VagrantPlugins::GoodHosts::Action::RemoveHosts

Inherits:
BaseAction
  • Object
show all
Defined in:
lib/vagrant-goodhosts/Action/RemoveHosts.rb

Overview

Remove hosts

Instance Method Summary collapse

Methods inherited from BaseAction

#call, #initialize

Methods included from GoodHosts

#add_goodhost_entries, #add_host_entries, #append_hostsnames_by_ips, #check_hostnames_to_add, #disable_clean, #generate_hostnames_by_ips, #get_clean_parameter_by_system, #get_cli, #get_hostnames, #get_ips, #get_os_binary, #print_readme, #remove_goodhost_entries, #remove_host_entries

Constructor Details

This class inherits a constructor from VagrantPlugins::GoodHosts::Action::BaseAction

Instance Method Details

#run(env) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/vagrant-goodhosts/Action/RemoveHosts.rb', line 7

def run(env)
  machine_action = env[:machine_action]

  return unless @machine.id
  return unless [:destroy, :halt, :suspend].include? machine_action

  if ([:halt, :suspend].include? machine_action) && (false == @machine.config.goodhosts.remove_on_suspend)
    @ui.info "[vagrant-goodhosts] Removing hosts on suspend disabled"
  else
    remove_host_entries
  end
end