lib/rbvmomi/vim.rb in rbvmomi-1.2.2 vs lib/rbvmomi/vim.rb in rbvmomi-1.2.3
- old
+ new
@@ -25,17 +25,20 @@
opts[:ssl] = true unless opts.member? :ssl or opts[:"no-ssl"]
opts[:insecure] ||= false
opts[:port] ||= (opts[:ssl] ? 443 : 80)
opts[:path] ||= '/sdk'
opts[:ns] ||= 'urn:vim25'
- opts[:rev] = '4.0'
+ rev_given = opts[:rev] != nil
+ opts[:rev] = '4.0' unless rev_given
opts[:debug] = (!ENV['RBVMOMI_DEBUG'].empty? rescue false) unless opts.member? :debug
new(opts).tap do |vim|
vim.serviceContent.sessionManager.Login :userName => opts[:user], :password => opts[:password]
- rev = vim.serviceContent.about.apiVersion
- vim.rev = [rev, '4.1'].min
+ unless rev_given
+ rev = vim.serviceContent.about.apiVersion
+ vim.rev = [rev, '4.1'].min
+ end
end
end
# Return the ServiceInstance
#
@@ -63,9 +66,14 @@
end
# Alias to serviceContent.searchIndex
def searchIndex
serviceContent.searchIndex
+ end
+
+ # @private
+ def pretty_print pp
+ pp.text "VIM(#{@opts[:host]})"
end
@extension_dirs = [File.join(File.dirname(__FILE__), "vim")]
# Directories to search for extensions