class Fog::Libvirt::Util::URI

Attributes

uri[R]

Public Class Methods

new(uri) click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 10
def initialize(uri)
  @parsed_uri=::URI.parse(uri)
  @uri=uri
  return self
end

Public Instance Methods

command() click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 69
def command
  value("command")
end
driver() click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 30
def driver
  scheme=@parsed_uri.scheme
  return nil if scheme.nil?

  return scheme.split(/\+/).first
end
host() click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 53
def host
  @parsed_uri.host
end
keyfile() click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 77
def keyfile
  value("keyfile")
end
name() click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 65
def name
  value("name")
end
netcat() click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 81
def netcat
  value("netcat")
end
no_tty?() click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 100
def no_tty?
  no_tty=value("no_tty")

  return false if no_tty.nil?

  if no_tty=="0"
    return false
  else
    return true
  end
end
no_verify?() click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 85
def no_verify?
  no_verify=value("no_verify")
  return false if no_verify.nil?

  if no_verify.to_s=="0"
    return false
  else
    return true
  end
end
password() click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 61
def password
  @parsed_uri.password
end
pkipath() click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 116
def pkipath
  value("pkipath")
end
port() click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 57
def port
  @parsed_uri.port
end
remote?() click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 45
def remote?
  return !transport.nil?
end
scheme() click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 26
def scheme
  return @parsed_uri.scheme
end
socket() click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 73
def socket
  value("socket")
end
ssh_enabled?() click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 37
def ssh_enabled?
  if remote?
    return transport.include?("ssh")
  else
    return false
  end
end
transport() click to toggle source

Transport will be part of the scheme The part after the plus sign f.i. qemu+ssh

# File lib/fog/libvirt/models/compute/util/uri.rb, line 19
def transport
  scheme=@parsed_uri.scheme
  return nil if scheme.nil?

  return scheme.split(/\+/)[1]
end
tty?() click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 112
def tty?
  return !no_tty?
end
user() click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 49
def user
  @parsed_uri.user
end
verify?() click to toggle source
# File lib/fog/libvirt/models/compute/util/uri.rb, line 96
def verify?
  return !no_verify?
end

Private Instance Methods

value(name) click to toggle source

A libvirt URI allows you to specify extra params libvirt.org/remote.html

# File lib/fog/libvirt/models/compute/util/uri.rb, line 123
def value(name)
  unless @parsed_uri.query.nil?
    params=CGI.parse(@parsed_uri.query)
    if params.key?(name)
      return params[name].first
    else
      return nil
    end
  else
    return nil
  end
end