Class: URI::VsphereUrl

Inherits:
Generic
  • Object
show all
Defined in:
lib/chef/provisioning/vsphere_driver/vsphere_url.rb

Constant Summary collapse

DEFAULT_PORT =
443
DEFAULT_PATH =
'/sdk'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_config(options) ⇒ Object



8
9
10
# File 'lib/chef/provisioning/vsphere_driver/vsphere_url.rb', line 8

def self.from_config(options)
	URI("vsphere://#{options[:host]}:#{options[:port]}#{options[:path]}?use_ssl=#{options[:use_ssl]}&insecure=#{options[:insecure]}")
end

Instance Method Details

#insecureObject



21
22
23
24
25
26
27
28
# File 'lib/chef/provisioning/vsphere_driver/vsphere_url.rb', line 21

def insecure
	if query
		insecure_query = query.split('&').each.select{|q| q.start_with?('insecure=')}.first
		insecure_query == 'insecure=true'
	else
		false
	end
end

#use_sslObject



12
13
14
15
16
17
18
19
# File 'lib/chef/provisioning/vsphere_driver/vsphere_url.rb', line 12

def use_ssl
	if query
		ssl_query = query.split('&').each.select{|q| q.start_with?('use_ssl=')}.first
		ssl_query == 'use_ssl=true'
	else
		true
	end
end