class URI::VsphereUrl

Creates the vSphereURL, extended by the Generic Class

Constants

DEFAULT_PATH

Default path for connecting to the vSphere cluster URL

DEFAULT_PORT

Default port for connecting to the vSphere cluster Webserver

Public Class Methods

from_config(options) click to toggle source

Creates the URL from options that are decided

# File lib/chef/provisioning/vsphere_driver/vsphere_url.rb, line 16
def self.from_config(options)
  parts = []
  parts << "vsphere://"
  parts << options[:host]
  parts << ":"
  parts << (options[:port] || DEFAULT_PORT)
  parts << (options[:path] || DEFAULT_PATH)
  parts << "?use_ssl="
  parts << (options[:use_ssl] == false ? false : true)
  parts << "&insecure="
  parts << (options[:insecure] || false)
  URI parts.join
end

Public Instance Methods

insecure() click to toggle source

Converts URL to insecure if needed

# 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() click to toggle source

Converts URL to SSL if needed

# 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