Class: OvirtSDK4::Probe

Inherits:
Object
  • Object
show all
Defined in:
lib/ovirtsdk4/probe.rb

Overview

This class is used to probe the engine to find which API versions it supports.

Constant Summary collapse

ENGINE_CERTIFICATE_PATH =
'/ovirt-engine/services/pki-resource?resource=engine-certificate&format=OPENSSH-PUBKEY'.freeze

Class Method Summary collapse

Class Method Details

.exists?(opts) ⇒ Boolean

This class method receives a set of options that define the server to probe and returns a boolean value that represents whether an oVirt instance was detected.

Parameters:

  • opts (Hash)

    The options used to create the probe.

Options Hash (opts):

  • :host (String)

    The name or IP address of the host to probe.

  • :port (Integer) — default: 443

    The port number to probe.

  • :log (String)

    The logger where the log messages will be written.

  • :debug (Boolean) — default: false

    A boolean flag indicating if debug output should be generated. If the values is true and the log parameter isn’t nil then the data sent to and received from the server will be written to the log. Be aware that user names and passwords will also be written, so handle with care.

  • :proxy_url (String)

    A string containing the protocol, address and port number of the proxy server to use to connect to the server. For example, in order to use the HTTP proxy proxy.example.com that is listening on port 3128 the value should be http://proxy.example.com:3128. This is optional, and if not given the connection will go directly to the server specified in the url parameter.

  • :timeout (Integer) — default: 0

    Set a connection timeout, in seconds. If the value is 0 no timeout is set.

Returns:

  • (Boolean)

    Boolean value, true if an oVirt instance was detected.


98
99
100
101
102
103
104
105
106
107
# File 'lib/ovirtsdk4/probe.rb', line 98

def self.exists?(opts)
  probe = nil
  begin
    opts[:insecure] = true
    probe = Probe.new(opts)
    probe.exists?
  ensure
    probe.close if probe
  end
end

.probe(opts) ⇒ Array<ProbeResult>

This class method receives a set of options that define the server to probe and returns an arrays of objects of the OvirtSDK4::ProbeResult class containing the results of the probe.

Parameters:

  • opts (Hash)

    The options used to create the probe.

Options Hash (opts):

  • :host (String)

    The name or IP address of the host to probe.

  • :port (Integer) — default: 443

    The port number to probe.

  • :username (String)

    The name of the user, something like [email protected].

  • :password (String)

    The password of the user.

  • :insecure (Boolean) — default: false

    A boolean flag that indicates if the server TLS certificate and host name should be checked.

  • :ca_file (String)

    The name of a PEM file containing the trusted CA certificates. The certificate presented by the server will be verified using these CA certificates. If not set then the system wide CA certificates store is used.

  • :log (String)

    The logger where the log messages will be written.

  • :debug (Boolean) — default: false

    A boolean flag indicating if debug output should be generated. If the values is true and the log parameter isn’t nil then the data sent to and received from the server will be written to the log. Be aware that user names and passwords will also be written, so handle with care.

  • :proxy_url (String)

    A string containing the protocol, address and port number of the proxy server to use to connect to the server. For example, in order to use the HTTP proxy proxy.example.com that is listening on port 3128 the value should be http://proxy.example.com:3128. This is optional, and if not given the connection will go directly to the server specified in the url parameter.

  • :proxy_username (String)

    The name of the user to authenticate to the proxy server.

  • :proxy_password (String)

    The password of the user to authenticate to the proxy server.

Returns:

  • (Array<ProbeResult>)

    An array of objects of the OvirtSDK4::ProbeResult class.


60
61
62
63
64
65
66
67
68
# File 'lib/ovirtsdk4/probe.rb', line 60

def self.probe(opts)
  probe = nil
  begin
    probe = Probe.new(opts)
    probe.probe
  ensure
    probe.close if probe
  end
end