Sha256: d04f642b017640a4483204fba7e2e54417fd7980777002678596f3be52d258b7

Contents?: true

Size: 972 Bytes

Versions: 15

Compression:

Stored size: 972 Bytes

Contents

module VagrantPlugins
  module VCloud
    module Action
      class DisconnectVCloud
        def initialize(app, env)
          @app = app
          @logger = Log4r::Logger.new(
            'vagrant_vcloud::action::disconnect_vcloud'
          )
        end

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

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

            # Delete the current vCloud Director Session
            cnx.logout

            # If session key doesn't exist, we are disconnected
            if !cnx.auth_key
              @logger.info('Disconnected from vCloud Director successfully!')
            end

          rescue Exception => e
            # Raise a properly namespaced error for Vagrant
            raise Errors::VCloudError, :message => e.message
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
vagrant-vcloud-0.5.0 lib/vagrant-vcloud/action/disconnect_vcloud.rb
vagrant-vcloud-0.4.7 lib/vagrant-vcloud/action/disconnect_vcloud.rb
vagrant-vcloud-0.4.6 lib/vagrant-vcloud/action/disconnect_vcloud.rb
vagrant-vcloud-0.4.4 lib/vagrant-vcloud/action/disconnect_vcloud.rb
vagrant-vcloud-0.4.3 lib/vagrant-vcloud/action/disconnect_vcloud.rb
vagrant-vcloud-0.4.2 lib/vagrant-vcloud/action/disconnect_vcloud.rb
vagrant-vcloud-0.4.1 lib/vagrant-vcloud/action/disconnect_vcloud.rb
vagrant-vcloud-0.4.0 lib/vagrant-vcloud/action/disconnect_vcloud.rb
vagrant-vcloud-0.3.3 lib/vagrant-vcloud/action/disconnect_vcloud.rb
vagrant-vcloud-0.3.2 lib/vagrant-vcloud/action/disconnect_vcloud.rb
vagrant-vcloud-0.3.1 lib/vagrant-vcloud/action/disconnect_vcloud.rb
vagrant-vcloud-0.3.0 lib/vagrant-vcloud/action/disconnect_vcloud.rb
vagrant-vcloud-0.2.2 lib/vagrant-vcloud/action/disconnect_vcloud.rb
vagrant-vcloud-0.2.1 lib/vagrant-vcloud/action/disconnect_vcloud.rb
vagrant-vcloud-0.2.0 lib/vagrant-vcloud/action/disconnect_vcloud.rb