Sha256: 57fffe8b94f9c1071343ef9007b8d403b238da6c16bd643fcd5de6718c65d07c

Contents?: true

Size: 822 Bytes

Versions: 83

Compression:

Stored size: 822 Bytes

Contents

# A module to gather running Xen Domains
#
module Facter::Util::Xendomains
  XEN_COMMANDS = ['/usr/sbin/xl', '/usr/sbin/xm']

  def self.xen_command
    if File.file?('/usr/lib/xen-common/bin/xen-toolstack')
      xen_toolstack_cmd = Facter::Util::Resolution.exec('/usr/lib/xen-common/bin/xen-toolstack')
      if xen_toolstack_cmd
        xen_toolstack_cmd.chomp
      else
        nil
      end
    else
      XEN_COMMANDS.find { |cmd| Facter::Util::Resolution.which(cmd) }
    end
  end

  def self.get_domains
    command = self.xen_command
    if command
      if domains_list = Facter::Util::Resolution.exec("#{command} list 2>/dev/null")
        domains = domains_list.split("\n").reject { |line| line =~ /^(Name|Domain-0)/ }
        domains.map { |line| line.split(/\s/)[0] }.join(',')
      end
    end
  end
end

Version data entries

83 entries across 83 versions & 2 rubygems

Version Path
bolt-0.17.0 vendored/facter/lib/facter/util/xendomains.rb
bolt-0.16.4 vendored/facter/lib/facter/util/xendomains.rb
bolt-0.16.3 vendored/facter/lib/facter/util/xendomains.rb
bolt-0.16.2 vendored/facter/lib/facter/util/xendomains.rb
bolt-0.16.1 vendored/facter/lib/facter/util/xendomains.rb
bolt-0.16.0 vendored/facter/lib/facter/util/xendomains.rb
bolt-0.15.0 vendored/facter/lib/facter/util/xendomains.rb
bolt-0.14.0 vendored/facter/lib/facter/util/xendomains.rb
bolt-0.13.0 vendored/facter/lib/facter/util/xendomains.rb
bolt-0.12.0 vendored/facter/lib/facter/util/xendomains.rb
bolt-0.11.0 vendored/facter/lib/facter/util/xendomains.rb
bolt-0.10.0 vendored/facter/lib/facter/util/xendomains.rb
bolt-0.9.0 vendored/facter/lib/facter/util/xendomains.rb
bolt-0.8.0 vendored/facter/lib/facter/util/xendomains.rb
bolt-0.7.0 vendored/facter/lib/facter/util/xendomains.rb
bolt-0.6.1 vendored/facter/lib/facter/util/xendomains.rb
bolt-0.6.0 vendored/facter/lib/facter/util/xendomains.rb
bolt-0.5.1 vendored/facter/lib/facter/util/xendomains.rb
bolt-0.5.0 vendored/facter/lib/facter/util/xendomains.rb
facter-2.5.1 lib/facter/util/xendomains.rb