Sha256: 6bef273937c88f46ffcd9090841cc7731dcb1d6c3314f455b271b3fa0aab44ae

Contents?: true

Size: 737 Bytes

Versions: 1

Compression:

Stored size: 737 Bytes

Contents

module VagrantPlugins
  module VCenter
    module Action
      # This class disconnects the vagrant-vcenter provider from vCenter.
      class DisconnectvCenter
        def initialize(app, env)
          @app = app
          @logger = Log4r::Logger.new(
            'vagrant_vcenter::action::disconnect_vcenter'
          )
        end

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

          cfg = env[:machine].provider_config

          if !cfg.vcenter_cnx
            @logger.info('No session active')
          else
            cfg.vcenter_cnx.close
            @logger.info('Succesfully disconnected from vCenter...')
          end

          @app.call env
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-vcenter-0.3.3 lib/vagrant-vcenter/action/disconnect_vcenter.rb