Class: VagrantPlugins::VCloud::Action::IsBridged

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-vcloud/action/is_bridged.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ IsBridged

Returns a new instance of IsBridged.


5
6
7
8
# File 'lib/vagrant-vcloud/action/is_bridged.rb', line 5

def initialize(app, env)
  @app = app
  @logger = Log4r::Logger.new('vagrant_vcloud::action::is_bridged')
end

Instance Method Details

#call(env) ⇒ Object


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/vagrant-vcloud/action/is_bridged.rb', line 10

def call(env)
  vapp_id = env[:machine].get_vapp_id

  cfg = env[:machine].provider_config
  cnx = cfg.vcloud_cnx.driver

  begin
    @logger.debug('Trying to get the vApp port forwarding rules')
    cnx.get_vapp_port_forwarding_rules(vapp_id)
  rescue
    @logger.debug('Setting the bridged_network environment var to true')
    env[:bridged_network] = true
  end

  @app.call env
end