class VagrantPlugins::VSphere::Action::ConnectVSphere

Public Class Methods

new(app, _env) click to toggle source
# File lib/vSphere/action/connect_vsphere.rb, line 7
def initialize(app, _env)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# 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, proxyHost: config.proxy_host,
                                                    proxyPort: config.proxy_port
    @app.call env
  rescue Errors::VSphereError
    raise
  rescue StandardError => e
    raise Errors::VSphereError.new, e.message
  end
end