Class: VagrantPlugins::VSphere::Action::ConnectVSphere

Inherits:
Object
  • Object
show all
Defined in:
lib/vSphere/action/connect_vsphere.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ ConnectVSphere

Returns a new instance of ConnectVSphere.



7
8
9
# File 'lib/vSphere/action/connect_vsphere.rb', line 7

def initialize(app, env)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/vSphere/action/connect_vsphere.rb', line 11

def call(env)
  config = env[:machine].provider_config

  begin
    env[:vSphere_connection] = RbVmomi::VIM.connect host: config.host, user: config.user, password: config.password, insecure: config.insecure
    @app.call env
  rescue Exception => e
    puts e.backtrace
    raise VagrantPlugins::VSphere::Errors::VSphereError, :message => e.message
  end
end