Sha256: cb4749deb2c4ce5ddabf7918b9714d38358c71af6f9963bf58a9f3603f1f986e
Contents?: true
Size: 1.78 KB
Versions: 5
Compression:
Stored size: 1.78 KB
Contents
module VagrantPlugins module VCloud module Action class ConnectVCloud def initialize(app, env) @app = app @logger = Log4r::Logger.new('vagrant_vcloud::action::connect_vcloud') end def call(env) config = env[:machine].provider_config if !config.vcloud_cnx @logger.info('Connecting to vCloud Director...') @logger.debug("config.hostname : #{config.hostname}") @logger.debug("config.username : #{config.username}") @logger.debug("config.password : <hidden>") @logger.debug("config.org_name : #{config.org_name}") # Create the vcloud-rest connection object with the configuration # information. config.vcloud_cnx = Driver::Meta.new( config.hostname, config.username, config.password, config.org_name ) @logger.info('Logging into vCloud Director...') config.vcloud_cnx.login # Check for the vCloud Director authentication token if config.vcloud_cnx.driver.auth_key @logger.info('Logged in successfully!') @logger.debug( "x-vcloud-authorization=#{config.vcloud_cnx.driver.auth_key}" ) else @logger.info("Login failed in to #{config.hostname}.") env[:ui].error("Login failed in to #{config.hostname}.") raise end else @logger.info('Already logged in, using current session') @logger.debug( "x-vcloud-authorization=#{config.vcloud_cnx.driver.auth_key}" ) end @app.call env end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems