class Object

Constants

BIN_LOCATION
CHECK_REFS
CURL_LOADED
ETC_LOCATION
LIB_LOCATION
MULTIPART_LOADED
ONE_LOCATION

—————————————————————————- # Set up the environment for the driver # —————————————————————————- #

REXML_FORMATTERS
VAR_LOCATION

Public Instance Methods

check_item(item, target_class) click to toggle source
# File lib/vcenter_driver.rb, line 124
def check_item(item, target_class)
    item.name if CHECK_REFS
    if target_class
        if !item.instance_of?(target_class)
            raise "Expecting type 'RbVmomi::VIM::#{target_class}'. " \
                    "Got '#{item.class} instead."
        end
    end
rescue RbVmomi::Fault => e
    raise "Reference \"#{item._ref}\" error [#{e.message}]. \
           The reference does not exist"
end
check_valid(parameter, label) click to toggle source
# File lib/vcenter_driver.rb, line 116
def check_valid(parameter, label)
    return unless parameter.nil? || parameter.empty?

    STDERR.puts error_message("The parameter '#{label}'\
                               is required for this action.")
    exit(-1)
end
error_message(message) click to toggle source

—————————————————————————- # Helper functions # —————————————————————————- #

# File lib/vcenter_driver.rb, line 108
def error_message(message)
    error_str = "ERROR MESSAGE --8<------\n"
    error_str << message
    error_str << "\nERROR MESSAGE ------>8--"

    error_str
end