Class: URI::VsphereUrl
- Inherits:
-
Generic
- Object
- Generic
- URI::VsphereUrl
- Defined in:
- lib/chef/provisioning/vsphere_driver/vsphere_url.rb
Overview
Creates the vSphereURL, extended by the Generic Class
Constant Summary collapse
- DEFAULT_PORT =
Default port for connecting to the vSphere cluster Webserver
443
- DEFAULT_PATH =
Default path for connecting to the vSphere cluster URL
"/sdk".freeze
Class Method Summary collapse
-
.from_config(options) ⇒ Object
Creates the URL from options that are decided.
Instance Method Summary collapse
-
#insecure ⇒ Object
Converts URL to insecure if needed.
-
#use_ssl ⇒ Object
Converts URL to SSL if needed.
Class Method Details
.from_config(options) ⇒ Object
Creates the URL from options that are decided
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/chef/provisioning/vsphere_driver/vsphere_url.rb', line 16 def self.from_config() parts = [] parts << "vsphere://" parts << [:host] parts << ":" parts << ([:port] || DEFAULT_PORT) parts << ([:path] || DEFAULT_PATH) parts << "?use_ssl=" parts << ([:use_ssl] == false ? false : true) parts << "&insecure=" parts << ([:insecure] || false) URI parts.join end |
Instance Method Details
#insecure ⇒ Object
Converts URL to insecure if needed
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/chef/provisioning/vsphere_driver/vsphere_url.rb', line 45 def insecure if query insecure_query = query.split("&").each.select do |q| q.start_with?("insecure=") end.first insecure_query == "insecure=true" else false end end |
#use_ssl ⇒ Object
Converts URL to SSL if needed
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/chef/provisioning/vsphere_driver/vsphere_url.rb', line 32 def use_ssl if query ssl_query = query.split("&").each.select do |q| q.start_with?("use_ssl=") end.first ssl_query == "use_ssl=true" else true end end |