Replaced deprecated config_global with vagrantfile.config

This commit is contained in:
januzis 2014-03-12 11:51:14 +01:00
parent 56ce9f895d
commit c6219655f5
4 changed files with 28 additions and 4 deletions

View File

@ -11,6 +11,14 @@ module VagrantPlugins
@machine = env[:machine]
@global_env = @machine.env
@provider = @machine.provider_name
# config_global is deprecated from v1.5
if Gem::Version.new(::Vagrant::VERSION) >= Gem::Version.new('1.5')
@config = @global_env.vagrantfile.config
else
@config = @global_env.config_global
end
@logger = Log4r::Logger.new('vagrant::hostmanager::update_all')
end
@ -21,7 +29,7 @@ module VagrantPlugins
return @app.call(env) if !@machine.id && env[:machine_action] == :destroy
# check config to see if the hosts file should be update automatically
return @app.call(env) unless @global_env.config_global.hostmanager.enabled?
return @app.call(env) unless @config.hostmanager.enabled?
@logger.info 'Updating /etc/hosts file automatically'
@app.call(env)

View File

@ -10,11 +10,19 @@ module VagrantPlugins
@app = app
@global_env = env[:global_env]
@provider = env[:provider]
# config_global is deprecated from v1.5
if Gem::Version.new(::Vagrant::VERSION) >= Gem::Version.new('1.5')
@config = @global_env.vagrantfile.config
else
@config = @global_env.config_global
end
@logger = Log4r::Logger.new('vagrant::hostmanager::update_host')
end
def call(env)
if @global_env.config_global.hostmanager.manage_host?
if @config.hostmanager.manage_host?
env[:ui].info I18n.t('vagrant_hostmanager.action.update_host')
update_host
end

View File

@ -101,7 +101,7 @@ module VagrantPlugins
end
def get_machines
if @global_env.config_global.hostmanager.include_offline?
if @config.hostmanager.include_offline?
machines = @global_env.machine_names
else
machines = @global_env.active_machines

View File

@ -7,11 +7,19 @@ module VagrantPlugins
super(machine, config)
@global_env = machine.env
@provider = machine.provider_name
# config_global is deprecated from v1.5
if Gem::Version.new(::Vagrant::VERSION) >= Gem::Version.new('1.5')
@config = @global_env.vagrantfile.config
else
@config = @global_env.config_global
end
end
def provision
update_guest(@machine)
if @global_env.config_global.hostmanager.manage_host?
if @config.hostmanager.manage_host?
update_host
end
end