Class: VagrantPlugins::Hosts::Action::RemoveHostsEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-hosts/action/remove_hosts_entry.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ RemoveHostsEntry

Returns a new instance of RemoveHostsEntry.



5
6
7
8
# File 'lib/vagrant-hosts/action/remove_hosts_entry.rb', line 5

def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new("VagrantPlugins::Hosts")
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/vagrant-hosts/action/remove_hosts_entry.rb', line 10

def call(env)
	env[:host].remove_hosts_entry(env[:machine].config.vm.hostname)
  env[:machine].env.active_machines.each do |machine|
  	if !machine.guest.capability?(:remove_hosts_entry)
  		@logger.warn "Unsupported machine #{machine.config.name}"
  		next
  	end
  	env[:machine].env.active_machines.each do |m|
  		m_hostname = m.config.hostname
  	  machine.guest.capability(:remove_hosts_entry, m_hostname)
  	end
  end
  return @app.call(env)
end