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'
|
require 'vagrant-hostmanager/util'
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module HostManager
|
module HostManager
|
||||||
module Action
|
module Action
|
||||||
class UpdateHost
|
class UpdateHost
|
||||||
include HostsFile
|
|
||||||
|
|
||||||
def initialize(app, env)
|
def initialize(app, env)
|
||||||
@app = app
|
@app = app
|
||||||
@global_env = env[:global_env]
|
|
||||||
@provider = env[:provider]
|
global_env = env[:global_env]
|
||||||
@config = Util.get_config(@global_env)
|
@config = Util.get_config(global_env)
|
||||||
|
@updater = HostsFile::Updater.new(global_env, env[:provider])
|
||||||
|
|
||||||
@logger = Log4r::Logger.new('vagrant::hostmanager::update_host')
|
@logger = Log4r::Logger.new('vagrant::hostmanager::update_host')
|
||||||
end
|
end
|
||||||
|
|
||||||
def call(env)
|
def call(env)
|
||||||
if @config.hostmanager.manage_host?
|
if @config.hostmanager.manage_host?
|
||||||
env[:ui].info I18n.t('vagrant_hostmanager.action.update_host')
|
env[:ui].info I18n.t('vagrant_hostmanager.action.update_host')
|
||||||
update_host
|
@updater.update_host
|
||||||
end
|
end
|
||||||
|
|
||||||
@app.call(env)
|
@app.call(env)
|
||||||
|
@ -26,5 +27,4 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue