Sha256: 06aebfb3e6d5af398d943650f232970f7152be8a019a552bbec9c1206a4bf86b

Contents?: true

Size: 847 Bytes

Versions: 4

Compression:

Stored size: 847 Bytes

Contents

module VagrantPlugins
  module VCloudAir
    module Action
      class DisconnectVCloudAir
        def initialize(app, env)
          @app = app
          @logger = Log4r::Logger.new(
            'vagrant_vcloudair::action::disconnect_vcloud'
          )
        end

        def call(env)
          @logger.info('Disconnecting from vCloud Air...')

          # Fetch the global vCloud Air connection handle
          cnx = env[:machine].provider_config.vcloudair_cnx.driver

          # Delete the current vCloud Air Session
          cnx.logout

          # If session key doesn't exist, we are disconnected
          if !cnx.auth_key
            @logger.info('Disconnected from vCloud Air successfully!')
          else
            fail Errors::VCloudAirGenericError, :message => e.message
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vagrant-vcloudair-0.5.3 lib/vagrant-vcloudair/action/disconnect_vcloud.rb
vagrant-vcloudair-0.5.2 lib/vagrant-vcloudair/action/disconnect_vcloud.rb
vagrant-vcloudair-0.5.1 lib/vagrant-vcloudair/action/disconnect_vcloud.rb
vagrant-vcloudair-0.5.0 lib/vagrant-vcloudair/action/disconnect_vcloud.rb