Sha256: 833c5b2212a7ca932d8beb2ba196cdf270dbb2243e35a6309fed081667e7d463

Contents?: true

Size: 958 Bytes

Versions: 3

Compression:

Stored size: 958 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

3 entries across 3 versions & 1 rubygems

Version Path
vagrant-vcloud-0.1.2 lib/vagrant-vcloud/action/disconnect_vcloud.rb
vagrant-vcloud-0.1.1 lib/vagrant-vcloud/action/disconnect_vcloud.rb
vagrant-vcloud-0.1.0 lib/vagrant-vcloud/action/disconnect_vcloud.rb