lib/rbvmomi/vim.rb in rbvmomi-2.1.0 vs lib/rbvmomi/vim.rb in rbvmomi-2.1.1

- old
+ new

@@ -26,10 +26,11 @@ # @option opts [String] :user (root) Username. # @option opts [String] :password Password. # @option opts [String] :path (/sdk) SDK endpoint path. # @option opts [Boolean] :debug (false) If true, print SOAP traffic to stderr. # @option opts [String] :operation_id If set, use for operationID + # @option opts [Boolean] :close_on_exit (true) If true, will close connection with at_exit def self.connect opts fail unless opts.is_a? Hash fail "host option required" unless opts[:host] opts[:cookie] ||= nil opts[:user] ||= (WIN32 ? ENV['USERNAME'].dup : 'root') @@ -62,10 +63,10 @@ end rev = vim.serviceContent.about.apiVersion vim.rev = [rev, opts[:rev]].min { |a, b| Gem::Version.new(a) <=> Gem::Version.new(b) } end - at_exit { conn.close } + at_exit { conn.close } if opts.fetch(:close_on_exit, true) conn end def close serviceContent.sessionManager.Logout