Replaced deprecated config_global with vagrantfile.config
This commit is contained in:
		
							parent
							
								
									56ce9f895d
								
							
						
					
					
						commit
						c6219655f5
					
				|  | @ -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) | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 januzis
						januzis