Module: Facter::Util::Facts
- Defined in:
- lib/facter/util/facts/facts_utils.rb,
lib/facter/util/facts/uptime_parser.rb,
lib/facter/util/facts/unit_converter.rb,
lib/facter/util/facts/posix/virtual_detector.rb,
lib/facter/util/facts/windows_release_finder.rb
Overview
Defined Under Namespace
Modules: Posix
Classes: UnitConverter, UptimeParser, WindowsReleaseFinder
Constant Summary
collapse
- HYPERVISORS_HASH =
{ 'VMware' => 'vmware', 'VirtualBox' => 'virtualbox', 'Parallels' => 'parallels',
'KVM' => 'kvm', 'Virtual Machine' => 'hyperv', 'RHEV Hypervisor' => 'rhev',
'oVirt Node' => 'ovirt', 'HVM domU' => 'xenhvm', 'Bochs' => 'bochs', 'OpenBSD' => 'vmm',
'BHYVE' => 'bhyve' }.freeze
- PHYSICAL_HYPERVISORS =
%w[physical xen0 vmware_server vmware_workstation openvzhn vserver_host].freeze
- REDHAT_FAMILY =
%w[redhat rhel fedora centos scientific ascendos cloudlinux psbm
oraclelinux ovs oel amazon xenserver xcp-ng virtuozzo photon mariner azurelinux].freeze
- DEBIAN_FAMILY =
%w[debian ubuntu huaweios linuxmint devuan kde].freeze
- SUSE_FAMILY =
%w[sles sled suse].freeze
- GENTOO_FAMILY =
['gentoo'].freeze
- ARCH_FAMILY =
%w[arch manjaro].freeze
- MANDRAKE_FAMILY =
%w[mandrake mandriva mageia].freeze
- FAMILY_HASH =
{ 'RedHat' => REDHAT_FAMILY, 'Debian' => DEBIAN_FAMILY, 'Suse' => SUSE_FAMILY,
'Gentoo' => GENTOO_FAMILY, 'Archlinux' => ARCH_FAMILY, 'Mandrake' => MANDRAKE_FAMILY }.freeze
Class Method Summary
collapse
Class Method Details
.discover_family(os) ⇒ Object
23
24
25
26
|
# File 'lib/facter/util/facts/facts_utils.rb', line 23
def discover_family(os)
FAMILY_HASH.each { |key, array_value| return key if array_value.any? { |os_flavour| os =~ /#{os_flavour}/i } }
os
end
|
.release_hash_from_matchdata(data) ⇒ Object
40
41
42
43
44
|
# File 'lib/facter/util/facts/facts_utils.rb', line 40
def release_hash_from_matchdata(data)
return if data.nil? || data[1].nil?
release_hash_from_string(data[1].to_s)
end
|
.release_hash_from_string(output, include_patch: false) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/facter/util/facts/facts_utils.rb', line 28
def release_hash_from_string(output, include_patch: false)
return unless output
versions = output.split('.')
{}.tap do |release|
release['full'] = output
release['major'] = versions[0]
release['minor'] = versions[1] if versions[1]
release['patch'] = versions[2] if versions[2] && include_patch
end
end
|