Class: VagrantPlugins::SecuredCloud::Action::WarnNetworks

Inherits:
Object
  • Object
show all
Defined in:
lib/secured-cloud-vagrant/actions/warn_networks.rb

Overview

This can be used with “Call” built-in to check if the machine is created and branch in the middleware.

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ WarnNetworks

Returns a new instance of WarnNetworks.



11
12
13
14
15
# File 'lib/secured-cloud-vagrant/actions/warn_networks.rb', line 11

def initialize(app, env)
	@app = app
	@machine = env[:machine]
	@logger = Log4r::Logger.new('vagrant::secured_cloud::action::warn_networks')
end

Instance Method Details

#call(env) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/secured-cloud-vagrant/actions/warn_networks.rb', line 17

def call(env)

	@logger.debug("Checking Network Configurations included in Vagrantfile ...")

	if !@machine.config.vm.networks.nil? && @machine.config.vm.networks.length > 1
		env[:ui].warn(I18n.t('secured_cloud_vagrant.warnings.network_support'))
	end
	
	@app.call(env)
end