facter 4.0.51 → 4.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/docs/generate_cli.rb +7 -0
- data/lib/facter.rb +71 -58
- data/lib/facter/config.rb +2 -0
- data/lib/facter/custom_facts/core/aggregate.rb +9 -0
- data/lib/facter/custom_facts/core/execution/base.rb +7 -3
- data/lib/facter/custom_facts/core/execution/popen3.rb +13 -1
- data/lib/facter/custom_facts/core/execution/posix.rb +2 -2
- data/lib/facter/custom_facts/core/execution/windows.rb +1 -1
- data/lib/facter/custom_facts/core/resolvable.rb +11 -0
- data/lib/facter/custom_facts/util/collection.rb +5 -0
- data/lib/facter/custom_facts/util/directory_loader.rb +1 -1
- data/lib/facter/custom_facts/util/normalization.rb +7 -2
- data/lib/facter/custom_facts/util/resolution.rb +2 -0
- data/lib/facter/custom_facts/util/windows_root.rb +2 -1
- data/lib/facter/facts/aix/processors/cores.rb +16 -0
- data/lib/facter/facts/aix/processors/threads.rb +16 -0
- data/lib/facter/facts/amzn/lsbdistcodename.rb +16 -0
- data/lib/facter/facts/amzn/lsbdistdescription.rb +16 -0
- data/lib/facter/facts/amzn/lsbdistid.rb +16 -0
- data/lib/facter/facts/amzn/os/distro/codename.rb +24 -0
- data/lib/facter/facts/amzn/os/distro/description.rb +21 -0
- data/lib/facter/facts/amzn/os/distro/id.rb +21 -0
- data/lib/facter/facts/amzn/os/distro/release.rb +32 -0
- data/lib/facter/facts/freebsd/is_virtual.rb +1 -5
- data/lib/facter/facts/freebsd/virtual.rb +1 -2
- data/lib/facter/facts/linux/az_metadata.rb +23 -0
- data/lib/facter/facts/linux/cloud/provider.rb +20 -0
- data/lib/facter/facts/linux/dhcp_servers.rb +2 -2
- data/lib/facter/facts/linux/ec2_metadata.rb +1 -5
- data/lib/facter/facts/linux/ec2_userdata.rb +1 -5
- data/lib/facter/facts/linux/hypervisors/xen.rb +1 -4
- data/lib/facter/facts/linux/interfaces.rb +1 -1
- data/lib/facter/facts/linux/ipaddress6_interfaces.rb +1 -1
- data/lib/facter/facts/linux/ipaddress_interfaces.rb +1 -1
- data/lib/facter/facts/linux/is_virtual.rb +1 -5
- data/lib/facter/facts/linux/macaddress_interfaces.rb +1 -1
- data/lib/facter/facts/linux/mtu_interfaces.rb +1 -1
- data/lib/facter/facts/linux/netmask6_interfaces.rb +1 -1
- data/lib/facter/facts/linux/netmask_interfaces.rb +1 -1
- data/lib/facter/facts/linux/network6_interfaces.rb +1 -1
- data/lib/facter/facts/linux/network_interfaces.rb +1 -1
- data/lib/facter/facts/linux/networking/dhcp.rb +1 -1
- data/lib/facter/facts/linux/networking/domain.rb +1 -1
- data/lib/facter/facts/linux/networking/fqdn.rb +1 -1
- data/lib/facter/facts/linux/networking/hostname.rb +1 -1
- data/lib/facter/facts/linux/networking/interfaces.rb +1 -1
- data/lib/facter/facts/linux/networking/ip.rb +1 -1
- data/lib/facter/facts/linux/networking/ip6.rb +1 -1
- data/lib/facter/facts/linux/networking/mac.rb +1 -1
- data/lib/facter/facts/linux/networking/mtu.rb +1 -1
- data/lib/facter/facts/linux/networking/netmask.rb +1 -1
- data/lib/facter/facts/linux/networking/netmask6.rb +1 -1
- data/lib/facter/facts/linux/networking/network.rb +1 -1
- data/lib/facter/facts/linux/networking/network6.rb +1 -1
- data/lib/facter/facts/linux/networking/primary.rb +1 -1
- data/lib/facter/facts/linux/networking/scope6.rb +1 -1
- data/lib/facter/facts/linux/processors/cores.rb +16 -0
- data/lib/facter/facts/linux/processors/threads.rb +16 -0
- data/lib/facter/facts/linux/scope6_interfaces.rb +1 -1
- data/lib/facter/facts/linux/virtual.rb +1 -2
- data/lib/facter/facts/macosx/os/macosx/version.rb +15 -4
- data/lib/facter/facts/macosx/processors/cores.rb +16 -0
- data/lib/facter/facts/macosx/processors/threads.rb +16 -0
- data/lib/facter/facts/rhel/lsbdistcodename.rb +16 -0
- data/lib/facter/facts/rhel/lsbdistdescription.rb +16 -0
- data/lib/facter/facts/rhel/lsbdistid.rb +16 -0
- data/lib/facter/facts/rhel/os/distro/codename.rb +2 -4
- data/lib/facter/facts/rhel/os/distro/description.rb +2 -4
- data/lib/facter/facts/rhel/os/distro/id.rb +2 -4
- data/lib/facter/facts/rhel/os/distro/release.rb +13 -12
- data/lib/facter/facts/sles/lsbdistcodename.rb +16 -0
- data/lib/facter/facts/sles/lsbdistdescription.rb +16 -0
- data/lib/facter/facts/sles/lsbdistid.rb +16 -0
- data/lib/facter/facts/sles/os/distro/codename.rb +3 -4
- data/lib/facter/facts/sles/os/distro/description.rb +2 -5
- data/lib/facter/facts/sles/os/distro/id.rb +6 -5
- data/lib/facter/facts/sles/os/distro/release.rb +17 -12
- data/lib/facter/facts/solaris/hypervisors/ldom.rb +1 -1
- data/lib/facter/facts/solaris/hypervisors/zone.rb +1 -1
- data/lib/facter/facts/solaris/mountpoints.rb +1 -1
- data/lib/facter/facts/solaris/processors/cores.rb +16 -0
- data/lib/facter/facts/solaris/processors/threads.rb +16 -0
- data/lib/facter/facts/ubuntu/lsbdistrelease.rb +2 -2
- data/lib/facter/facts/windows/az_metadata.rb +23 -0
- data/lib/facter/facts/windows/cloud/provider.rb +21 -0
- data/lib/facter/facts/windows/ec2_metadata.rb +1 -1
- data/lib/facter/facts/windows/ec2_userdata.rb +1 -1
- data/lib/facter/facts/windows/gce.rb +1 -1
- data/lib/facter/facts/windows/hypervisors/hyperv.rb +1 -1
- data/lib/facter/facts/windows/hypervisors/kvm.rb +2 -1
- data/lib/facter/facts/windows/hypervisors/virtualbox.rb +2 -2
- data/lib/facter/facts/windows/hypervisors/vmware.rb +1 -1
- data/lib/facter/facts/windows/hypervisors/xen.rb +3 -1
- data/lib/facter/facts/windows/is_virtual.rb +15 -0
- data/lib/facter/facts/windows/{virtualization/is_virtual.rb → processors/cores.rb} +4 -4
- data/lib/facter/facts/windows/{virtualization/virtual.rb → processors/threads.rb} +4 -4
- data/lib/facter/facts/windows/virtual.rb +15 -0
- data/lib/facter/framework/cli/cli.rb +17 -19
- data/lib/facter/framework/config/config_reader.rb +2 -0
- data/lib/facter/framework/config/fact_groups.rb +25 -2
- data/lib/facter/framework/core/cache_manager.rb +7 -3
- data/lib/facter/framework/core/fact/external/external_fact_manager.rb +0 -1
- data/lib/facter/framework/core/fact/internal/internal_fact_manager.rb +41 -39
- data/lib/facter/framework/core/fact_filter.rb +5 -15
- data/lib/facter/framework/core/fact_loaders/external_fact_loader.rb +9 -6
- data/lib/facter/framework/core/fact_loaders/fact_loader.rb +39 -37
- data/lib/facter/framework/core/fact_manager.rb +84 -14
- data/lib/facter/framework/core/file_loader.rb +1 -1
- data/lib/facter/framework/core/options.rb +1 -2
- data/lib/facter/framework/core/options/config_file_options.rb +7 -0
- data/lib/facter/framework/core/options/option_store.rb +4 -4
- data/lib/facter/framework/formatters/formatter_helper.rb +3 -5
- data/lib/facter/framework/parsers/query_parser.rb +5 -12
- data/lib/facter/models/fact_collection.rb +48 -5
- data/lib/facter/models/resolved_fact.rb +2 -3
- data/lib/facter/models/searched_fact.rb +2 -3
- data/lib/facter/resolvers/aix/ffi/ffi_helper.rb +1 -1
- data/lib/facter/resolvers/aix/processors.rb +4 -0
- data/lib/facter/resolvers/az.rb +39 -0
- data/lib/facter/resolvers/base_resolver.rb +2 -2
- data/lib/facter/resolvers/dmi_decode.rb +0 -1
- data/lib/facter/resolvers/ec2.rb +8 -1
- data/lib/facter/resolvers/linux/hostname.rb +126 -0
- data/lib/facter/resolvers/linux/networking.rb +124 -0
- data/lib/facter/resolvers/macosx/mountpoints.rb +14 -1
- data/lib/facter/resolvers/macosx/processor.rb +16 -1
- data/lib/facter/resolvers/mountpoints.rb +16 -8
- data/lib/facter/resolvers/networking.rb +3 -2
- data/lib/facter/resolvers/partitions.rb +1 -1
- data/lib/facter/resolvers/processors_lscpu.rb +44 -0
- data/lib/facter/resolvers/redhat_release.rb +28 -12
- data/lib/facter/resolvers/ruby.rb +1 -1
- data/lib/facter/resolvers/selinux.rb +5 -7
- data/lib/facter/resolvers/solaris/ffi/functions.rb +1 -1
- data/lib/facter/resolvers/solaris/ffi/structs.rb +12 -0
- data/lib/facter/resolvers/solaris/mountpoints.rb +22 -16
- data/lib/facter/resolvers/solaris/networking.rb +20 -5
- data/lib/facter/resolvers/solaris/processors.rb +7 -0
- data/lib/facter/resolvers/solaris/zone.rb +0 -1
- data/lib/facter/resolvers/windows/ffi/identity_ffi.rb +5 -0
- data/lib/facter/resolvers/windows/ffi/kernel_ffi.rb +1 -1
- data/lib/facter/resolvers/windows/identity.rb +1 -6
- data/lib/facter/resolvers/windows/processors.rb +41 -4
- data/lib/facter/resolvers/windows/uptime.rb +3 -22
- data/lib/facter/resolvers/windows/virtualization.rb +46 -44
- data/lib/facter/resolvers/xen.rb +6 -1
- data/lib/facter/templates/man.erb +13 -5
- data/lib/facter/util/facts/posix/virtual_detector.rb +74 -0
- data/lib/facter/util/facts/unit_converter.rb +2 -2
- data/lib/facter/util/linux/dhcp.rb +86 -0
- data/lib/facter/util/linux/if_inet6.rb +73 -0
- data/lib/facter/util/linux/routing_table.rb +60 -0
- data/lib/facter/util/linux/socket_parser.rb +114 -0
- data/lib/facter/util/resolvers/ffi/hostname.rb +70 -0
- data/lib/facter/util/resolvers/http.rb +7 -1
- data/lib/facter/util/resolvers/networking/primary_interface.rb +11 -5
- data/lib/facter/util/utils.rb +18 -1
- data/lib/facter/version.rb +1 -1
- metadata +77 -13
- data/lib/facter/facts/linux/cloud.rb +0 -15
- data/lib/facter/framework/core/fact_augmenter.rb +0 -37
- data/lib/facter/resolvers/cloud.rb +0 -39
- data/lib/facter/resolvers/networking_linux.rb +0 -296
- data/lib/facter/util/facts/virtual_detector.rb +0 -90
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facts
|
4
|
+
module Sles
|
5
|
+
class Lsbdistid
|
6
|
+
FACT_NAME = 'lsbdistid'
|
7
|
+
TYPE = :legacy
|
8
|
+
|
9
|
+
def call_the_resolver
|
10
|
+
fact_value = Facter::Resolvers::LsbRelease.resolve(:distributor_id)
|
11
|
+
|
12
|
+
Facter::ResolvedFact.new(FACT_NAME, fact_value, :legacy)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -6,13 +6,12 @@ module Facts
|
|
6
6
|
module Distro
|
7
7
|
class Codename
|
8
8
|
FACT_NAME = 'os.distro.codename'
|
9
|
-
ALIASES = 'lsbdistcodename'
|
10
9
|
|
11
10
|
def call_the_resolver
|
12
|
-
fact_value = Facter::Resolvers::
|
11
|
+
fact_value = Facter::Resolvers::OsRelease.resolve(:version_codename)
|
12
|
+
fact_value = 'n/a' if !fact_value || fact_value.empty?
|
13
13
|
|
14
|
-
|
15
|
-
Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
|
14
|
+
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|
@@ -6,13 +6,10 @@ module Facts
|
|
6
6
|
module Distro
|
7
7
|
class Description
|
8
8
|
FACT_NAME = 'os.distro.description'
|
9
|
-
ALIASES = 'lsbdistdescription'
|
10
9
|
|
11
10
|
def call_the_resolver
|
12
|
-
fact_value = Facter::Resolvers::
|
13
|
-
|
14
|
-
[Facter::ResolvedFact.new(FACT_NAME, fact_value),
|
15
|
-
Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
|
11
|
+
fact_value = Facter::Resolvers::OsRelease.resolve(:pretty_name)
|
12
|
+
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
16
13
|
end
|
17
14
|
end
|
18
15
|
end
|
@@ -6,13 +6,14 @@ module Facts
|
|
6
6
|
module Distro
|
7
7
|
class Id
|
8
8
|
FACT_NAME = 'os.distro.id'
|
9
|
-
ALIASES = 'lsbdistid'
|
10
9
|
|
11
10
|
def call_the_resolver
|
12
|
-
fact_value = Facter::Resolvers::
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
fact_value = if Facter::Resolvers::OsRelease.resolve(:version_id).start_with?('12')
|
12
|
+
'SUSE LINUX'
|
13
|
+
else
|
14
|
+
'SUSE'
|
15
|
+
end
|
16
|
+
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
@@ -9,20 +9,25 @@ module Facts
|
|
9
9
|
ALIASES = %w[lsbdistrelease lsbmajdistrelease lsbminordistrelease].freeze
|
10
10
|
|
11
11
|
def call_the_resolver
|
12
|
-
|
13
|
-
|
12
|
+
version = Facter::Resolvers::OsRelease.resolve(:version_id)
|
13
|
+
fact_value = build_fact_list(version)
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
15
|
+
[Facter::ResolvedFact.new(FACT_NAME, fact_value),
|
16
|
+
Facter::ResolvedFact.new(ALIASES[0], fact_value[:full], :legacy),
|
17
|
+
Facter::ResolvedFact.new(ALIASES[1], fact_value[:major], :legacy),
|
18
|
+
Facter::ResolvedFact.new(ALIASES[2], fact_value[:minor], :legacy)]
|
19
|
+
end
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
def build_fact_list(version)
|
22
|
+
if version.include?('.')
|
23
|
+
{
|
24
|
+
full: version,
|
25
|
+
major: version.split('.').first,
|
26
|
+
minor: version.split('.').last
|
27
|
+
}
|
28
|
+
else
|
29
|
+
{ full: version, major: version, minor: nil }
|
30
|
+
end
|
26
31
|
end
|
27
32
|
end
|
28
33
|
end
|
@@ -17,7 +17,7 @@ module Facts
|
|
17
17
|
fact_value = %i[
|
18
18
|
chassis_serial control_domain domain_name
|
19
19
|
domain_uuid role_control role_io role_root role_service
|
20
|
-
].map! { |key| [key, Facter::Resolvers::Solaris::Ldom.resolve(key)] }.to_h
|
20
|
+
].map! { |key| [key, Facter::Utils.try_to_bool(Facter::Resolvers::Solaris::Ldom.resolve(key))] }.to_h
|
21
21
|
|
22
22
|
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
23
23
|
end
|
@@ -6,7 +6,7 @@ module Facts
|
|
6
6
|
FACT_NAME = 'mountpoints'
|
7
7
|
|
8
8
|
def call_the_resolver
|
9
|
-
mountpoints = Facter::Resolvers::Mountpoints.resolve(FACT_NAME.to_sym)
|
9
|
+
mountpoints = Facter::Resolvers::Solaris::Mountpoints.resolve(FACT_NAME.to_sym)
|
10
10
|
return Facter::ResolvedFact.new(FACT_NAME, nil) unless mountpoints
|
11
11
|
|
12
12
|
fact = {}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facts
|
4
|
+
module Solaris
|
5
|
+
module Processors
|
6
|
+
class Cores
|
7
|
+
FACT_NAME = 'processors.cores'
|
8
|
+
|
9
|
+
def call_the_resolver
|
10
|
+
fact_value = Facter::Resolvers::Solaris::Processors.resolve(:cores_per_socket)
|
11
|
+
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facts
|
4
|
+
module Solaris
|
5
|
+
module Processors
|
6
|
+
class Threads
|
7
|
+
FACT_NAME = 'processors.threads'
|
8
|
+
|
9
|
+
def call_the_resolver
|
10
|
+
fact_value = Facter::Resolvers::Solaris::Processors.resolve(:threads_per_core)
|
11
|
+
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -15,8 +15,8 @@ module Facts
|
|
15
15
|
version = fact_value.split('.')
|
16
16
|
|
17
17
|
[Facter::ResolvedFact.new(FACT_NAME, fact_value, :legacy),
|
18
|
-
Facter::ResolvedFact.new(ALIASES[0], version[0], :legacy),
|
19
|
-
Facter::ResolvedFact.new(ALIASES[1], version[
|
18
|
+
Facter::ResolvedFact.new(ALIASES[0], "#{version[0]}.#{version[1]}", :legacy),
|
19
|
+
Facter::ResolvedFact.new(ALIASES[1], version[2], :legacy)]
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facts
|
4
|
+
module Windows
|
5
|
+
class AzMetadata
|
6
|
+
FACT_NAME = 'az_metadata'
|
7
|
+
|
8
|
+
def call_the_resolver
|
9
|
+
return Facter::ResolvedFact.new(FACT_NAME, nil) unless azure_hypervisor?
|
10
|
+
|
11
|
+
fact_value = Facter::Resolvers::Az.resolve(:metadata)
|
12
|
+
|
13
|
+
Facter::ResolvedFact.new(FACT_NAME, fact_value&.empty? ? nil : fact_value)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def azure_hypervisor?
|
19
|
+
Facter::Resolvers::Windows::Virtualization.resolve(:virtual) == 'hyperv'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facts
|
4
|
+
module Windows
|
5
|
+
module Cloud
|
6
|
+
class Provider
|
7
|
+
FACT_NAME = 'cloud.provider'
|
8
|
+
|
9
|
+
def call_the_resolver
|
10
|
+
virtual = Facter::Resolvers::Windows::Virtualization.resolve(:virtual)
|
11
|
+
provider = case virtual
|
12
|
+
when 'hyperv'
|
13
|
+
'azure' unless Facter::Resolvers::Az.resolve(:metadata).empty?
|
14
|
+
end
|
15
|
+
|
16
|
+
Facter::ResolvedFact.new(FACT_NAME, provider)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -6,7 +6,7 @@ module Facts
|
|
6
6
|
FACT_NAME = 'gce'
|
7
7
|
|
8
8
|
def call_the_resolver
|
9
|
-
virtualization = Facter::Resolvers::Virtualization.resolve(:virtual)
|
9
|
+
virtualization = Facter::Resolvers::Windows::Virtualization.resolve(:virtual)
|
10
10
|
|
11
11
|
fact_value = virtualization&.include?('gce') ? Facter::Resolvers::Gce.resolve(:metadata) : nil
|
12
12
|
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
@@ -15,7 +15,7 @@ module Facts
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def hyperv?
|
18
|
-
Facter::Resolvers::Virtualization.resolve(:virtual) == 'hyperv' ||
|
18
|
+
Facter::Resolvers::Windows::Virtualization.resolve(:virtual) == 'hyperv' ||
|
19
19
|
Facter::Resolvers::DMIBios.resolve(:manufacturer).include?('Microsoft')
|
20
20
|
end
|
21
21
|
end
|
@@ -17,7 +17,8 @@ module Facts
|
|
17
17
|
def kvm?
|
18
18
|
product_name = Facter::Resolvers::DMIComputerSystem.resolve(:name)
|
19
19
|
|
20
|
-
(Facter::Resolvers::Virtualization.resolve(:virtual) == 'kvm' ||
|
20
|
+
(Facter::Resolvers::Windows::Virtualization.resolve(:virtual) == 'kvm' ||
|
21
|
+
Facter::Resolvers::NetKVM.resolve(:kvm)) &&
|
21
22
|
product_name != 'VirtualBox' && !product_name.match(/^Parallels/)
|
22
23
|
end
|
23
24
|
|
@@ -15,12 +15,12 @@ module Facts
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def virtualbox?
|
18
|
-
Facter::Resolvers::Virtualization.resolve(:virtual) == 'virtualbox' ||
|
18
|
+
Facter::Resolvers::Windows::Virtualization.resolve(:virtual) == 'virtualbox' ||
|
19
19
|
Facter::Resolvers::DMIComputerSystem.resolve(:name) == 'VirtualBox'
|
20
20
|
end
|
21
21
|
|
22
22
|
def populate_version_and_revision
|
23
|
-
oem_strings = Facter::Resolvers::Virtualization.resolve(:oem_strings)
|
23
|
+
oem_strings = Facter::Resolvers::Windows::Virtualization.resolve(:oem_strings)
|
24
24
|
return unless oem_strings
|
25
25
|
|
26
26
|
version = revision = ''
|
@@ -15,7 +15,7 @@ module Facts
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def vmware?
|
18
|
-
Facter::Resolvers::Virtualization.resolve(:virtual) == 'vmware' ||
|
18
|
+
Facter::Resolvers::Windows::Virtualization.resolve(:virtual) == 'vmware' ||
|
19
19
|
Facter::Resolvers::DMIBios.resolve(:manufacturer) == 'VMware, Inc.'
|
20
20
|
end
|
21
21
|
end
|
@@ -7,7 +7,9 @@ module Facts
|
|
7
7
|
FACT_NAME = 'hypervisors.xen'
|
8
8
|
|
9
9
|
def call_the_resolver
|
10
|
-
|
10
|
+
if Facter::Resolvers::Windows::Virtualization.resolve(:virtual) == 'xen'
|
11
|
+
fact_value = { context: hvm? ? 'hvm' : 'pv' }
|
12
|
+
end
|
11
13
|
|
12
14
|
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
13
15
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facts
|
4
|
+
module Windows
|
5
|
+
class IsVirtual
|
6
|
+
FACT_NAME = 'is_virtual'
|
7
|
+
|
8
|
+
def call_the_resolver
|
9
|
+
fact_value = Facter::Resolvers::Windows::Virtualization.resolve(:is_virtual)
|
10
|
+
|
11
|
+
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
module Facts
|
4
4
|
module Windows
|
5
|
-
module
|
6
|
-
class
|
7
|
-
FACT_NAME = '
|
5
|
+
module Processors
|
6
|
+
class Cores
|
7
|
+
FACT_NAME = 'processors.cores'
|
8
8
|
|
9
9
|
def call_the_resolver
|
10
|
-
fact_value = Facter::Resolvers::
|
10
|
+
fact_value = Facter::Resolvers::Processors.resolve(:cores_per_socket)
|
11
11
|
|
12
12
|
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
13
13
|
end
|
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
module Facts
|
4
4
|
module Windows
|
5
|
-
module
|
6
|
-
class
|
7
|
-
FACT_NAME = '
|
5
|
+
module Processors
|
6
|
+
class Threads
|
7
|
+
FACT_NAME = 'processors.threads'
|
8
8
|
|
9
9
|
def call_the_resolver
|
10
|
-
fact_value = Facter::Resolvers::
|
10
|
+
fact_value = Facter::Resolvers::Processors.resolve(:threads_per_core)
|
11
11
|
|
12
12
|
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
13
13
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facts
|
4
|
+
module Windows
|
5
|
+
class Virtual
|
6
|
+
FACT_NAME = 'virtual'
|
7
|
+
|
8
|
+
def call_the_resolver
|
9
|
+
fact_value = Facter::Resolvers::Windows::Virtualization.resolve(:virtual)
|
10
|
+
|
11
|
+
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -97,6 +97,11 @@ module Facter
|
|
97
97
|
type: :boolean,
|
98
98
|
desc: 'Resolve facts sequentially'
|
99
99
|
|
100
|
+
class_option :puppet,
|
101
|
+
type: :boolean,
|
102
|
+
aliases: '-p',
|
103
|
+
desc: 'Load the Puppet libraries, thus allowing Facter to load Puppet-specific facts.'
|
104
|
+
|
100
105
|
desc '--man', 'Display manual.', hide: true
|
101
106
|
map ['--man'] => :man
|
102
107
|
def man(*args)
|
@@ -111,6 +116,7 @@ module Facter
|
|
111
116
|
|
112
117
|
desc 'query', 'Default method', hide: true
|
113
118
|
def query(*args)
|
119
|
+
Facter.puppet_facts if options[:puppet]
|
114
120
|
output, status = Facter.to_user_output(@options, *args)
|
115
121
|
puts output
|
116
122
|
|
@@ -126,7 +132,7 @@ module Facter
|
|
126
132
|
Facter.values(@options, args)
|
127
133
|
end
|
128
134
|
|
129
|
-
desc '--version, -v', 'Print the version'
|
135
|
+
desc '--version, -v', 'Print the version'
|
130
136
|
map ['--version', '-v'] => :version
|
131
137
|
def version(*_args)
|
132
138
|
puts Facter::VERSION
|
@@ -134,9 +140,9 @@ module Facter
|
|
134
140
|
|
135
141
|
desc '--list-block-groups', 'List block groups'
|
136
142
|
map ['--list-block-groups'] => :list_block_groups
|
137
|
-
def list_block_groups
|
143
|
+
def list_block_groups
|
138
144
|
options = @options.map { |(k, v)| [k.to_sym, v] }.to_h
|
139
|
-
Facter::Options.init_from_cli(options
|
145
|
+
Facter::Options.init_from_cli(options)
|
140
146
|
|
141
147
|
block_groups = Facter::FactGroups.new.groups.to_yaml.lines[1..-1].join
|
142
148
|
block_groups.gsub!(/:\s*\n/, "\n")
|
@@ -146,9 +152,9 @@ module Facter
|
|
146
152
|
|
147
153
|
desc '--list-cache-groups', 'List cache groups'
|
148
154
|
map ['--list-cache-groups'] => :list_cache_groups
|
149
|
-
def list_cache_groups
|
155
|
+
def list_cache_groups
|
150
156
|
options = @options.map { |(k, v)| [k.to_sym, v] }.to_h
|
151
|
-
Facter::Options.init_from_cli(options
|
157
|
+
Facter::Options.init_from_cli(options)
|
152
158
|
|
153
159
|
cache_groups = Facter::FactGroups.new.groups.to_yaml.lines[1..-1].join
|
154
160
|
cache_groups.gsub!(/:\s*\n/, "\n")
|
@@ -156,19 +162,7 @@ module Facter
|
|
156
162
|
puts cache_groups
|
157
163
|
end
|
158
164
|
|
159
|
-
desc '--
|
160
|
-
map ['--puppet', '-p'] => :puppet
|
161
|
-
def puppet(*args)
|
162
|
-
Facter.puppet_facts
|
163
|
-
|
164
|
-
output, status = Facter.to_user_output(@options, *args)
|
165
|
-
puts output
|
166
|
-
|
167
|
-
status = 1 if Facter::Log.errors?
|
168
|
-
exit status
|
169
|
-
end
|
170
|
-
|
171
|
-
desc 'help', 'Help for all arguments'
|
165
|
+
desc '--help, -h', 'Help for all arguments'
|
172
166
|
def help(*args)
|
173
167
|
help_string = +''
|
174
168
|
help_string << help_header(args)
|
@@ -205,7 +199,11 @@ module Facter
|
|
205
199
|
Cli.commands
|
206
200
|
.select { |_k, command_class| command_class.instance_of?(Thor::Command) }
|
207
201
|
.each do |_k, command|
|
208
|
-
help_command_options << build_option(
|
202
|
+
help_command_options << build_option(
|
203
|
+
command['name'],
|
204
|
+
[command['usage'].split(',')[1]],
|
205
|
+
command['description']
|
206
|
+
)
|
209
207
|
end
|
210
208
|
|
211
209
|
help_command_options
|