migrate UpdateHost action to use Updater class
This commit is contained in:
parent
90fe71540a
commit
f46b0aa984
|
@ -1,24 +1,25 @@
|
|||
require 'vagrant-hostmanager/hosts_file'
|
||||
require 'vagrant-hostmanager/hosts_file/updater'
|
||||
require 'vagrant-hostmanager/util'
|
||||
|
||||
module VagrantPlugins
|
||||
module HostManager
|
||||
module Action
|
||||
class UpdateHost
|
||||
include HostsFile
|
||||
|
||||
def initialize(app, env)
|
||||
@app = app
|
||||
@global_env = env[:global_env]
|
||||
@provider = env[:provider]
|
||||
@config = Util.get_config(@global_env)
|
||||
|
||||
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
|
||||
|
||||
def call(env)
|
||||
if @config.hostmanager.manage_host?
|
||||
env[:ui].info I18n.t('vagrant_hostmanager.action.update_host')
|
||||
update_host
|
||||
@updater.update_host
|
||||
end
|
||||
|
||||
@app.call(env)
|
||||
|
@ -26,5 +27,4 @@ module VagrantPlugins
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue