Class: VagrantPlugins::HostManager::Action::UpdateHost

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-hostmanager/action/update_host.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ UpdateHost

Returns a new instance of UpdateHost.



9
10
11
12
13
14
15
16
17
# File 'lib/vagrant-hostmanager/action/update_host.rb', line 9

def initialize(app, env)
  @app = app
  
  global_env = env[:global_env]
  @config = Util.get_config(global_env)
  @updater = HostsFile::Updater.new(global_env, env[:provider])
  
  @logger = Log4r::Logger.new('vagrant::hostmanager::update_host')
end

Instance Method Details

#call(env) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/vagrant-hostmanager/action/update_host.rb', line 19

def call(env)
  if @config.hostmanager.manage_host?
    env[:ui].info I18n.t('vagrant_hostmanager.action.update_host')
    @updater.update_host
  end

  @app.call(env)
end