module Chef::Knife::Cloud::VcenterServiceHelpers

Module that creates the helpers for this gem

Public Instance Methods

check_for_missing_config_values!(*keys) click to toggle source

rubocop:disable Style/GuardClause Checks for any missing values

@param [Object] keys makes sure that the values are all not nil

# File lib/chef/knife/cloud/vcenter_service_helpers.rb, line 56
def check_for_missing_config_values!(*keys)
  missing = keys.select { |x| config[x].nil? }

  unless missing.empty?
    ui.error(format("The following required parameters are missing: %s", missing.join(", ")))
    exit(1)
  end
end
create_service_instance() click to toggle source

Creates the object for vCenterService

# File lib/chef/knife/cloud/vcenter_service_helpers.rb, line 33
def create_service_instance
  Chef::Knife::Cloud::VcenterService.new(username: config[:vcenter_username],
                                         password: config[:vcenter_password],
                                         host: config[:vcenter_host],
                                         verify_ssl: verify_ssl?)
end
validate!() click to toggle source

Validate the options and fail out if something isn't there

# File lib/chef/knife/cloud/vcenter_service_helpers.rb, line 48
def validate!
  check_for_missing_config_values!(:vcenter_username, :vcenter_password, :vcenter_host)
end
verify_ssl?() click to toggle source

Do we have valid SSL?

# File lib/chef/knife/cloud/vcenter_service_helpers.rb, line 42
def verify_ssl?
  !config[:vcenter_disable_ssl_verify]
end