facter 4.0.31 → 4.0.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/facter/custom_facts/util/directory_loader.rb +13 -1
- data/lib/facter/fact_groups.conf +140 -1
- data/lib/facter/facts/aix/disks.rb +17 -2
- data/lib/facter/facts/aix/networking/scope6.rb +3 -1
- data/lib/facter/facts/aix/scope6_interfaces.rb +0 -2
- data/lib/facter/facts/aix/serialnumber.rb +20 -0
- data/lib/facter/facts/aix/ssh.rb +3 -1
- data/lib/facter/facts/aix/sshalgorithmkey.rb +17 -0
- data/lib/facter/facts/aix/sshfp_algorithm.rb +20 -0
- data/lib/facter/facts/bsd/load_averages.rb +1 -1
- data/lib/facter/facts/debian/os/distro/release.rb +6 -1
- data/lib/facter/facts/freebsd/augeas/version.rb +19 -0
- data/lib/facter/facts/freebsd/dmi/bios/release_date.rb +19 -0
- data/lib/facter/facts/freebsd/dmi/bios/vendor.rb +19 -0
- data/lib/facter/facts/freebsd/dmi/bios/version.rb +19 -0
- data/lib/facter/facts/freebsd/dmi/manufacturer.rb +17 -0
- data/lib/facter/facts/freebsd/dmi/product/name.rb +19 -0
- data/lib/facter/facts/freebsd/dmi/product/serial_number.rb +19 -0
- data/lib/facter/facts/freebsd/dmi/product/uuid.rb +19 -0
- data/lib/facter/facts/freebsd/facterversion.rb +14 -0
- data/lib/facter/facts/freebsd/identity/gid.rb +16 -0
- data/lib/facter/facts/{solaris/solaris_zones/current.rb → freebsd/identity/group.rb} +6 -6
- data/lib/facter/facts/freebsd/identity/privileged.rb +16 -0
- data/lib/facter/facts/freebsd/identity/uid.rb +16 -0
- data/lib/facter/facts/freebsd/identity/user.rb +17 -0
- data/lib/facter/facts/freebsd/kernel.rb +14 -0
- data/lib/facter/facts/freebsd/kernelrelease.rb +14 -0
- data/lib/facter/facts/freebsd/memory/swap/available.rb +21 -0
- data/lib/facter/facts/freebsd/memory/swap/available_bytes.rb +20 -0
- data/lib/facter/facts/freebsd/memory/swap/capacity.rb +18 -0
- data/lib/facter/facts/freebsd/memory/swap/encrypted.rb +19 -0
- data/lib/facter/facts/freebsd/memory/swap/total.rb +21 -0
- data/lib/facter/facts/freebsd/memory/swap/total_bytes.rb +20 -0
- data/lib/facter/facts/freebsd/memory/swap/used.rb +20 -0
- data/lib/facter/facts/freebsd/memory/swap/used_bytes.rb +18 -0
- data/lib/facter/facts/freebsd/memory/system/available.rb +21 -0
- data/lib/facter/facts/freebsd/memory/system/available_bytes.rb +20 -0
- data/lib/facter/facts/freebsd/memory/system/capacity.rb +18 -0
- data/lib/facter/facts/freebsd/memory/system/total.rb +21 -0
- data/lib/facter/facts/freebsd/memory/system/total_bytes.rb +20 -0
- data/lib/facter/facts/freebsd/memory/system/used.rb +20 -0
- data/lib/facter/facts/freebsd/memory/system/used_bytes.rb +18 -0
- data/lib/facter/facts/freebsd/mountpoints.rb +21 -0
- data/lib/facter/facts/freebsd/netmask6_interfaces.rb +20 -0
- data/lib/facter/facts/freebsd/netmask_interfaces.rb +20 -0
- data/lib/facter/facts/freebsd/network6_interfaces.rb +20 -0
- data/lib/facter/facts/freebsd/network_interfaces.rb +20 -0
- data/lib/facter/facts/freebsd/networking/dhcp.rb +17 -0
- data/lib/facter/facts/freebsd/networking/domain.rb +18 -0
- data/lib/facter/facts/freebsd/networking/fqdn.rb +18 -0
- data/lib/facter/facts/freebsd/networking/hostname.rb +18 -0
- data/lib/facter/facts/freebsd/networking/interfaces.rb +17 -0
- data/lib/facter/facts/freebsd/networking/ip.rb +18 -0
- data/lib/facter/facts/freebsd/networking/ip6.rb +18 -0
- data/lib/facter/facts/freebsd/networking/mac.rb +18 -0
- data/lib/facter/facts/freebsd/networking/mtu.rb +17 -0
- data/lib/facter/facts/freebsd/networking/netmask.rb +18 -0
- data/lib/facter/facts/freebsd/networking/netmask6.rb +18 -0
- data/lib/facter/facts/freebsd/networking/network.rb +18 -0
- data/lib/facter/facts/freebsd/networking/network6.rb +18 -0
- data/lib/facter/facts/freebsd/networking/primary.rb +17 -0
- data/lib/facter/facts/freebsd/networking/scope6.rb +17 -0
- data/lib/facter/facts/freebsd/os/architecture.rb +18 -0
- data/lib/facter/facts/freebsd/os/hardware.rb +18 -0
- data/lib/facter/facts/freebsd/os/name.rb +18 -0
- data/lib/facter/facts/{bsd/bsd_example_fact.rb → freebsd/path.rb} +5 -4
- data/lib/facter/facts/freebsd/processors/isa.rb +17 -0
- data/lib/facter/facts/freebsd/puppet_version.rb +15 -0
- data/lib/facter/facts/freebsd/ruby/platform.rb +18 -0
- data/lib/facter/facts/freebsd/ruby/sitedir.rb +18 -0
- data/lib/facter/facts/freebsd/ruby/version.rb +18 -0
- data/lib/facter/facts/freebsd/ssh.rb +26 -0
- data/lib/facter/facts/freebsd/sshalgorithmkey.rb +17 -0
- data/lib/facter/facts/freebsd/sshfp_algorithm.rb +20 -0
- data/lib/facter/facts/freebsd/system_uptime/days.rb +18 -0
- data/lib/facter/facts/freebsd/system_uptime/hours.rb +18 -0
- data/lib/facter/facts/freebsd/system_uptime/seconds.rb +18 -0
- data/lib/facter/facts/freebsd/system_uptime/uptime.rb +18 -0
- data/lib/facter/facts/freebsd/timezone.rb +15 -0
- data/lib/facter/facts/freebsd/zfs_featurenumbers.rb +14 -0
- data/lib/facter/facts/freebsd/zfs_version.rb +14 -0
- data/lib/facter/facts/freebsd/zpool_featureflags.rb +14 -0
- data/lib/facter/facts/freebsd/zpool_featurenumbers.rb +14 -0
- data/lib/facter/facts/freebsd/zpool_version.rb +14 -0
- data/lib/facter/facts/linux/disks.rb +20 -1
- data/lib/facter/facts/linux/dmi/board/asset_tag.rb +19 -0
- data/lib/facter/facts/linux/ec2_metadata.rb +5 -3
- data/lib/facter/facts/linux/ec2_userdata.rb +5 -3
- data/lib/facter/facts/linux/gce.rb +16 -0
- data/lib/facter/facts/linux/is_virtual.rb +1 -3
- data/lib/facter/facts/linux/mountpoints.rb +1 -1
- data/lib/facter/facts/linux/networking/scope6.rb +3 -1
- data/lib/facter/facts/linux/partitions.rb +1 -1
- data/lib/facter/facts/linux/processors/speed.rb +17 -0
- data/lib/facter/facts/linux/scope6_interfaces.rb +1 -2
- data/lib/facter/facts/linux/ssh.rb +19 -9
- data/lib/facter/facts/linux/sshfp_algorithm.rb +1 -1
- data/lib/facter/facts/linux/system_uptime/days.rb +7 -1
- data/lib/facter/facts/linux/system_uptime/hours.rb +7 -1
- data/lib/facter/facts/linux/system_uptime/seconds.rb +7 -1
- data/lib/facter/facts/linux/system_uptime/uptime.rb +7 -1
- data/lib/facter/facts/linux/virtual.rb +17 -0
- data/lib/facter/facts/linux/xen.rb +28 -0
- data/lib/facter/facts/macosx/dhcp_servers.rb +2 -2
- data/lib/facter/facts/macosx/interfaces.rb +1 -1
- data/lib/facter/facts/macosx/ipaddress6_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/ipaddress_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/macaddress_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/mtu_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/netmask6_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/netmask_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/network6_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/network_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/networking/dhcp.rb +1 -1
- data/lib/facter/facts/macosx/networking/interfaces.rb +1 -1
- data/lib/facter/facts/macosx/networking/ip.rb +1 -1
- data/lib/facter/facts/macosx/networking/ip6.rb +1 -1
- data/lib/facter/facts/macosx/networking/mac.rb +1 -1
- data/lib/facter/facts/macosx/networking/mtu.rb +1 -1
- data/lib/facter/facts/macosx/networking/netmask.rb +1 -1
- data/lib/facter/facts/macosx/networking/netmask6.rb +1 -1
- data/lib/facter/facts/macosx/networking/network.rb +1 -1
- data/lib/facter/facts/macosx/networking/network6.rb +1 -1
- data/lib/facter/facts/macosx/networking/primary.rb +1 -1
- data/lib/facter/facts/macosx/networking/scope6.rb +4 -2
- data/lib/facter/facts/macosx/scope6_interfaces.rb +1 -3
- data/lib/facter/facts/macosx/ssh.rb +19 -11
- data/lib/facter/facts/macosx/sshfp_algorithm.rb +1 -1
- data/lib/facter/facts/macosx/virtual.rb +1 -1
- data/lib/facter/facts/solaris/current_zone.rb +16 -0
- data/lib/facter/facts/solaris/disks.rb +33 -0
- data/lib/facter/facts/solaris/dmi/bios/release_date.rb +24 -0
- data/lib/facter/facts/solaris/dmi/bios/vendor.rb +24 -0
- data/lib/facter/facts/solaris/dmi/bios/version.rb +24 -0
- data/lib/facter/facts/solaris/dmi/chassis/asset_tag.rb +24 -0
- data/lib/facter/facts/solaris/dmi/chassis/type.rb +24 -0
- data/lib/facter/facts/solaris/dmi/manufacturer.rb +25 -0
- data/lib/facter/facts/solaris/dmi/product/name.rb +27 -0
- data/lib/facter/facts/solaris/dmi/product/serial_number.rb +27 -0
- data/lib/facter/facts/solaris/dmi/product/uuid.rb +24 -0
- data/lib/facter/facts/solaris/hypervisors/ldom.rb +24 -0
- data/lib/facter/facts/solaris/hypervisors/zone.rb +39 -0
- data/lib/facter/facts/solaris/is_virtual.rb +64 -0
- data/lib/facter/facts/solaris/kernelmajversion.rb +1 -1
- data/lib/facter/facts/solaris/ldom.rb +35 -0
- data/lib/facter/facts/solaris/load_averages.rb +14 -0
- data/lib/facter/facts/solaris/memory/swap/available.rb +22 -0
- data/lib/facter/facts/solaris/memory/swap/available_bytes.rb +22 -0
- data/lib/facter/facts/solaris/memory/swap/capacity.rb +20 -0
- data/lib/facter/facts/solaris/memory/swap/total.rb +22 -0
- data/lib/facter/facts/solaris/memory/swap/total_bytes.rb +22 -0
- data/lib/facter/facts/solaris/memory/swap/used.rb +21 -0
- data/lib/facter/facts/solaris/memory/swap/used_bytes.rb +19 -0
- data/lib/facter/facts/solaris/memory/system/available.rb +22 -0
- data/lib/facter/facts/solaris/memory/system/available_bytes.rb +22 -0
- data/lib/facter/facts/solaris/memory/system/capacity.rb +20 -0
- data/lib/facter/facts/solaris/memory/system/total.rb +22 -0
- data/lib/facter/facts/solaris/memory/system/total_bytes.rb +22 -0
- data/lib/facter/facts/solaris/memory/system/used.rb +21 -0
- data/lib/facter/facts/solaris/memory/system/used_bytes.rb +19 -0
- data/lib/facter/facts/solaris/mountpoints.rb +1 -1
- data/lib/facter/facts/solaris/os/release.rb +3 -3
- data/lib/facter/facts/solaris/ssh.rb +19 -9
- data/lib/facter/facts/solaris/sshalgorithmkey.rb +17 -0
- data/lib/facter/facts/solaris/sshfp_algorithm.rb +20 -0
- data/lib/facter/facts/solaris/virtual.rb +60 -0
- data/lib/facter/facts/solaris/zfs_featurenumbers.rb +1 -1
- data/lib/facter/facts/solaris/zfs_version.rb +1 -1
- data/lib/facter/facts/solaris/zones.rb +60 -0
- data/lib/facter/facts/solaris/zpool_featureflags.rb +1 -1
- data/lib/facter/facts/solaris/zpool_featurenumbers.rb +1 -1
- data/lib/facter/facts/solaris/zpool_version.rb +1 -1
- data/lib/facter/facts/windows/dhcp_servers.rb +2 -2
- data/lib/facter/facts/windows/ec2_metadata.rb +5 -3
- data/lib/facter/facts/windows/ec2_userdata.rb +5 -3
- data/lib/facter/facts/windows/gce.rb +16 -0
- data/lib/facter/facts/windows/interfaces.rb +1 -1
- data/lib/facter/facts/windows/ipaddress6_interfaces.rb +1 -1
- data/lib/facter/facts/windows/ipaddress_interfaces.rb +1 -1
- data/lib/facter/facts/windows/macaddress_interfaces.rb +1 -1
- data/lib/facter/facts/windows/mtu_interfaces.rb +1 -1
- data/lib/facter/facts/windows/netmask6_interfaces.rb +1 -1
- data/lib/facter/facts/windows/netmask_interfaces.rb +1 -1
- data/lib/facter/facts/windows/network6_interfaces.rb +1 -1
- data/lib/facter/facts/windows/network_interfaces.rb +1 -1
- data/lib/facter/facts/windows/networking/dhcp.rb +1 -1
- data/lib/facter/facts/windows/networking/domain.rb +1 -1
- data/lib/facter/facts/windows/networking/fqdn.rb +1 -1
- data/lib/facter/facts/windows/networking/interfaces.rb +1 -1
- data/lib/facter/facts/windows/networking/ip.rb +1 -1
- data/lib/facter/facts/windows/networking/ip6.rb +1 -1
- data/lib/facter/facts/windows/networking/mac.rb +1 -1
- data/lib/facter/facts/windows/networking/mtu.rb +1 -1
- data/lib/facter/facts/windows/networking/netmask.rb +1 -1
- data/lib/facter/facts/windows/networking/netmask6.rb +1 -1
- data/lib/facter/facts/windows/networking/network.rb +1 -1
- data/lib/facter/facts/windows/networking/network6.rb +1 -1
- data/lib/facter/facts/windows/networking/primary.rb +1 -1
- data/lib/facter/facts/windows/networking/scope6.rb +4 -2
- data/lib/facter/facts/windows/scope6_interfaces.rb +1 -1
- data/lib/facter/facts/windows/sshalgorithmkey.rb +22 -0
- data/lib/facter/facts/windows/sshfp_algorithm.rb +25 -0
- data/lib/facter/facts_utils/facts_utils.rb +2 -0
- data/lib/facter/framework/cli/cli.rb +16 -4
- data/lib/facter/framework/config/fact_groups.rb +13 -0
- data/lib/facter/framework/core/fact/internal/core_fact.rb +2 -0
- data/lib/facter/framework/core/fact/internal/internal_fact_manager.rb +10 -25
- data/lib/facter/framework/core/fact_filter.rb +13 -0
- data/lib/facter/framework/core/fact_loaders/fact_loader.rb +24 -1
- data/lib/facter/framework/detector/os_detector.rb +5 -1
- data/lib/facter/framework/formatters/legacy_fact_formatter.rb +8 -1
- data/lib/facter/framework/formatters/yaml_fact_formatter.rb +1 -1
- data/lib/facter/os_hierarchy.json +6 -7
- data/lib/facter/resolvers/aix/serialnumber.rb +37 -0
- data/lib/facter/resolvers/augeas_resolver.rb +19 -2
- data/lib/facter/resolvers/base_resolver.rb +1 -1
- data/lib/facter/resolvers/bsd/ffi/ffi_helper.rb +0 -10
- data/lib/facter/resolvers/dmi_resolver.rb +4 -3
- data/lib/facter/resolvers/ec2.rb +4 -18
- data/lib/facter/resolvers/filesystems_resolver.rb +1 -1
- data/lib/facter/resolvers/freebsd/dmi_resolver.rb +38 -0
- data/lib/facter/resolvers/freebsd/ffi/ffi_helper.rb +19 -0
- data/lib/facter/resolvers/freebsd/swap_memory_resolver.rb +39 -0
- data/lib/facter/resolvers/freebsd/system_memory_resolver.rb +41 -0
- data/lib/facter/resolvers/gce.rb +54 -0
- data/lib/facter/resolvers/linux/docker_uptime.rb +45 -0
- data/lib/facter/resolvers/{load_averages_resolver.rb → linux/load_averages.rb} +0 -1
- data/lib/facter/resolvers/load_averages.rb +26 -0
- data/lib/facter/resolvers/lspci.rb +2 -0
- data/lib/facter/resolvers/memory_resolver.rb +8 -1
- data/lib/facter/resolvers/mountpoints_resolver.rb +42 -44
- data/lib/facter/resolvers/networking_linux_resolver.rb +16 -1
- data/lib/facter/resolvers/networking_resolver.rb +106 -0
- data/lib/facter/resolvers/os_release_resolver.rb +1 -1
- data/lib/facter/resolvers/processors_resolver.rb +24 -2
- data/lib/facter/resolvers/redhat_release_resolver.rb +4 -3
- data/lib/facter/resolvers/solaris/disks.rb +51 -0
- data/lib/facter/resolvers/solaris/dmi.rb +57 -0
- data/lib/facter/resolvers/solaris/dmi_sparc.rb +47 -0
- data/lib/facter/resolvers/solaris/ffi/ffi.rb +5 -0
- data/lib/facter/resolvers/solaris/{filesystems_resolver.rb → filesystems.rb} +0 -0
- data/lib/facter/resolvers/solaris/{ipaddress_resolver.rb → ipaddress.rb} +0 -0
- data/lib/facter/resolvers/solaris/ldom.rb +70 -0
- data/lib/facter/resolvers/solaris/memory.rb +93 -0
- data/lib/facter/resolvers/solaris/{networking_resolver.rb → networking.rb} +2 -6
- data/lib/facter/resolvers/solaris/os_release.rb +44 -0
- data/lib/facter/resolvers/solaris/zone.rb +51 -0
- data/lib/facter/resolvers/solaris/zone_name.rb +31 -0
- data/lib/facter/resolvers/uptime_resolver.rb +1 -27
- data/lib/facter/resolvers/utils/ffi/load_averages.rb +27 -0
- data/lib/facter/resolvers/utils/http.rb +68 -0
- data/lib/facter/resolvers/utils/networking.rb +2 -0
- data/lib/facter/resolvers/utils/uptime_helper.rb +32 -0
- data/lib/facter/resolvers/windows/ffi/ffi.rb +1 -1
- data/lib/facter/resolvers/windows/networking_resolver.rb +100 -100
- data/lib/facter/resolvers/xen.rb +28 -0
- data/lib/facter/resolvers/zfs.rb +32 -0
- data/lib/facter/resolvers/zpool.rb +34 -0
- data/lib/facter/version.rb +1 -1
- metadata +144 -18
- data/lib/facter/facts/freebsd/solaris_zones/current.rb +0 -15
- data/lib/facter/facts/freebsd/solaris_zones/zone.rb +0 -15
- data/lib/facter/facts/solaris/solaris_zones/zone.rb +0 -62
- data/lib/facter/resolvers/bsd/load_averages_resolver.rb +0 -26
- data/lib/facter/resolvers/macosx/networking_resolver.rb +0 -108
- data/lib/facter/resolvers/solaris/solaris_os_release_resolver.rb +0 -42
- data/lib/facter/resolvers/solaris/solaris_zone_name.rb +0 -28
- data/lib/facter/resolvers/solaris/zfs_resolver.rb +0 -34
- data/lib/facter/resolvers/solaris/zone_resolver.rb +0 -48
- data/lib/facter/resolvers/solaris/zpool_resolver.rb +0 -36
@@ -4,11 +4,30 @@ module Facts
|
|
4
4
|
module Linux
|
5
5
|
class Disks
|
6
6
|
FACT_NAME = 'disks'
|
7
|
+
ALIASES = %w[blockdevices blockdevice_.*_model blockdevice_.*_size blockdevice_.*_vendor'].freeze
|
7
8
|
|
8
9
|
def call_the_resolver
|
10
|
+
facts = []
|
9
11
|
disks = Facter::Resolvers::Linux::Disk.resolve(:disks)
|
10
12
|
|
11
|
-
Facter::ResolvedFact.new(FACT_NAME, disks
|
13
|
+
return Facter::ResolvedFact.new(FACT_NAME, nil) if disks.nil? || disks.empty?
|
14
|
+
|
15
|
+
blockdevices = disks.keys.join(',')
|
16
|
+
facts.push(Facter::ResolvedFact.new(FACT_NAME, disks))
|
17
|
+
facts.push(Facter::ResolvedFact.new('blockdevices', blockdevices, :legacy))
|
18
|
+
add_legacy_facts(disks, facts)
|
19
|
+
|
20
|
+
facts
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def add_legacy_facts(disks, facts)
|
26
|
+
disks.each do |disk_name, disk_info|
|
27
|
+
facts.push(Facter::ResolvedFact.new("blockdevice_#{disk_name}_model", disk_info[:model], :legacy))
|
28
|
+
facts.push(Facter::ResolvedFact.new("blockdevice_#{disk_name}_size", disk_info[:size_bytes].to_s, :legacy))
|
29
|
+
facts.push(Facter::ResolvedFact.new("blockdevice_#{disk_name}_vendor", disk_info[:vendor], :legacy))
|
30
|
+
end
|
12
31
|
end
|
13
32
|
end
|
14
33
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facts
|
4
|
+
module Linux
|
5
|
+
module Dmi
|
6
|
+
module Board
|
7
|
+
class AssetTag
|
8
|
+
FACT_NAME = 'dmi.board.asset_tag'
|
9
|
+
ALIASES = 'boardassettag'
|
10
|
+
|
11
|
+
def call_the_resolver
|
12
|
+
fact_value = Facter::Resolvers::Linux::DmiBios.resolve(:board_asset_tag)
|
13
|
+
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -6,14 +6,16 @@ module Facts
|
|
6
6
|
FACT_NAME = 'ec2_metadata'
|
7
7
|
|
8
8
|
def call_the_resolver
|
9
|
-
return Facter::ResolvedFact.new(FACT_NAME, nil) unless
|
9
|
+
return Facter::ResolvedFact.new(FACT_NAME, nil) unless aws_hypervisors?
|
10
10
|
|
11
11
|
fact_value = Facter::Resolvers::Ec2.resolve(:metadata)
|
12
12
|
|
13
|
-
Facter::ResolvedFact.new(FACT_NAME, fact_value
|
13
|
+
Facter::ResolvedFact.new(FACT_NAME, fact_value&.empty? ? nil : fact_value)
|
14
14
|
end
|
15
15
|
|
16
|
-
|
16
|
+
private
|
17
|
+
|
18
|
+
def aws_hypervisors?
|
17
19
|
virtual = check_virt_what || check_xen || check_product_name || check_bios_vendor || check_lspci
|
18
20
|
|
19
21
|
virtual == 'kvm' || virtual =~ /xen/
|
@@ -6,14 +6,16 @@ module Facts
|
|
6
6
|
FACT_NAME = 'ec2_userdata'
|
7
7
|
|
8
8
|
def call_the_resolver
|
9
|
-
return Facter::ResolvedFact.new(FACT_NAME, nil) unless
|
9
|
+
return Facter::ResolvedFact.new(FACT_NAME, nil) unless aws_hypervisors?
|
10
10
|
|
11
11
|
fact_value = Facter::Resolvers::Ec2.resolve(:userdata)
|
12
12
|
|
13
|
-
Facter::ResolvedFact.new(FACT_NAME, fact_value
|
13
|
+
Facter::ResolvedFact.new(FACT_NAME, fact_value&.empty? ? nil : fact_value)
|
14
14
|
end
|
15
15
|
|
16
|
-
|
16
|
+
private
|
17
|
+
|
18
|
+
def aws_hypervisors?
|
17
19
|
virtual = check_virt_what || check_xen || check_product_name || check_bios_vendor || check_lspci
|
18
20
|
|
19
21
|
virtual == 'kvm' || virtual =~ /xen/
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facts
|
4
|
+
module Linux
|
5
|
+
class Gce
|
6
|
+
FACT_NAME = 'gce'
|
7
|
+
|
8
|
+
def call_the_resolver
|
9
|
+
bios_vendor = Facter::Resolvers::Linux::DmiBios.resolve(:bios_vendor)
|
10
|
+
|
11
|
+
fact_value = bios_vendor&.include?('Google') ? Facter::Resolvers::Gce.resolve(:metadata) : nil
|
12
|
+
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -5,8 +5,6 @@ module Facts
|
|
5
5
|
class IsVirtual
|
6
6
|
FACT_NAME = 'is_virtual'
|
7
7
|
|
8
|
-
PHYSICAL_HYPERVISORS = %w[physical xen0 vmware_server vmware_workstation openvzhn vserver_host].freeze
|
9
|
-
|
10
8
|
def call_the_resolver # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
11
9
|
fact_value = check_docker_lxc || check_gce || retrieve_from_virt_what || check_vmware
|
12
10
|
fact_value ||= check_open_vz || check_vserver || check_xen || check_other_facts || check_lspci || 'physical'
|
@@ -59,7 +57,7 @@ module Facts
|
|
59
57
|
end
|
60
58
|
|
61
59
|
def check_if_virtual(found_vm)
|
62
|
-
PHYSICAL_HYPERVISORS.count(found_vm).zero?
|
60
|
+
Facter::FactsUtils::PHYSICAL_HYPERVISORS.count(found_vm).zero?
|
63
61
|
end
|
64
62
|
end
|
65
63
|
end
|
@@ -6,7 +6,7 @@ module Facts
|
|
6
6
|
FACT_NAME = 'mountpoints'
|
7
7
|
|
8
8
|
def call_the_resolver
|
9
|
-
mountpoints = Facter::Resolvers::
|
9
|
+
mountpoints = Facter::Resolvers::Mountpoints.resolve(FACT_NAME.to_sym)
|
10
10
|
return Facter::ResolvedFact.new(FACT_NAME, nil) unless mountpoints
|
11
11
|
|
12
12
|
fact = {}
|
@@ -5,11 +5,13 @@ module Facts
|
|
5
5
|
module Networking
|
6
6
|
class Scope6
|
7
7
|
FACT_NAME = 'networking.scope6'
|
8
|
+
ALIASES = 'scope6'
|
8
9
|
|
9
10
|
def call_the_resolver
|
10
11
|
fact_value = Facter::Resolvers::NetworkingLinux.resolve(:scope6)
|
11
12
|
|
12
|
-
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
13
|
+
[Facter::ResolvedFact.new(FACT_NAME, fact_value),
|
14
|
+
Facter::ResolvedFact.new('scope6', fact_value, :legacy)]
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
@@ -11,7 +11,7 @@ module Facts
|
|
11
11
|
|
12
12
|
def partitions
|
13
13
|
parts = Facter::Resolvers::Partitions.resolve(:partitions)
|
14
|
-
mountpoints = Facter::Resolvers::
|
14
|
+
mountpoints = Facter::Resolvers::Mountpoints.resolve(:mountpoints)
|
15
15
|
return parts unless mountpoints
|
16
16
|
|
17
17
|
mountpoints.each do |mnt|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facts
|
4
|
+
module Linux
|
5
|
+
module Processors
|
6
|
+
class Speed
|
7
|
+
FACT_NAME = 'processors.speed'
|
8
|
+
|
9
|
+
def call_the_resolver
|
10
|
+
fact_value = Facter::Resolvers::Linux::Processors.resolve(:speed)
|
11
|
+
speed = Facter::FactsUtils::UnitConverter.hertz_to_human_readable(fact_value)
|
12
|
+
Facter::ResolvedFact.new(FACT_NAME, speed)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -9,14 +9,13 @@ module Facts
|
|
9
9
|
def call_the_resolver
|
10
10
|
resolved_facts = []
|
11
11
|
interfaces = Facter::Resolvers::NetworkingLinux.resolve(:interfaces)
|
12
|
-
primary_scope6 = Facter::Resolvers::NetworkingLinux.resolve(:scope6)
|
13
12
|
|
14
13
|
interfaces&.each do |interface_name, info|
|
15
14
|
if info[:scope6]
|
16
15
|
resolved_facts << Facter::ResolvedFact.new("scope6_#{interface_name}", info[:scope6], :legacy)
|
17
16
|
end
|
18
17
|
end
|
19
|
-
|
18
|
+
|
20
19
|
resolved_facts
|
21
20
|
end
|
22
21
|
end
|
@@ -6,20 +6,30 @@ module Facts
|
|
6
6
|
FACT_NAME = 'ssh'
|
7
7
|
|
8
8
|
def call_the_resolver
|
9
|
-
|
10
|
-
ssh_facts = {}
|
11
|
-
result.each { |ssh| ssh_facts.merge!(create_ssh_fact(ssh)) }
|
12
|
-
Facter::ResolvedFact.new(FACT_NAME, ssh_facts)
|
9
|
+
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
13
10
|
end
|
14
11
|
|
15
12
|
private
|
16
13
|
|
14
|
+
def fact_value
|
15
|
+
resolver_data.map { |el| create_ssh_fact(el) }.inject(:merge)
|
16
|
+
end
|
17
|
+
|
18
|
+
def resolver_data
|
19
|
+
Facter::Resolvers::SshResolver.resolve(:ssh)
|
20
|
+
end
|
21
|
+
|
17
22
|
def create_ssh_fact(ssh)
|
18
|
-
{ ssh
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
+
return {} unless ssh
|
24
|
+
|
25
|
+
{ ssh.name.to_sym => {
|
26
|
+
fingerprints: {
|
27
|
+
sha1: ssh.fingerprint.sha1,
|
28
|
+
sha256: ssh.fingerprint.sha256
|
29
|
+
},
|
30
|
+
key: ssh.key,
|
31
|
+
type: ssh.type
|
32
|
+
} }
|
23
33
|
end
|
24
34
|
end
|
25
35
|
end
|
@@ -11,7 +11,7 @@ module Facts
|
|
11
11
|
result = Facter::Resolvers::SshResolver.resolve(:ssh)
|
12
12
|
result.each do |ssh|
|
13
13
|
facts << Facter::ResolvedFact.new("sshfp_#{ssh.name.to_sym}",
|
14
|
-
"#{ssh.fingerprint.sha1}
|
14
|
+
"#{ssh.fingerprint.sha1}\n#{ssh.fingerprint.sha256}", :legacy)
|
15
15
|
end
|
16
16
|
facts
|
17
17
|
end
|
@@ -8,7 +8,13 @@ module Facts
|
|
8
8
|
ALIASES = 'uptime_days'
|
9
9
|
|
10
10
|
def call_the_resolver
|
11
|
-
|
11
|
+
hypervisors = Facter::Resolvers::Containers.resolve(:hypervisor)
|
12
|
+
|
13
|
+
fact_value = if hypervisors && hypervisors[:docker]
|
14
|
+
Facter::Resolvers::Linux::DockerUptime.resolve(:days)
|
15
|
+
else
|
16
|
+
Facter::Resolvers::Uptime.resolve(:days)
|
17
|
+
end
|
12
18
|
|
13
19
|
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
|
14
20
|
end
|
@@ -8,7 +8,13 @@ module Facts
|
|
8
8
|
ALIASES = 'uptime_hours'
|
9
9
|
|
10
10
|
def call_the_resolver
|
11
|
-
|
11
|
+
hypervisors = Facter::Resolvers::Containers.resolve(:hypervisor)
|
12
|
+
|
13
|
+
fact_value = if hypervisors && hypervisors[:docker]
|
14
|
+
Facter::Resolvers::Linux::DockerUptime.resolve(:hours)
|
15
|
+
else
|
16
|
+
Facter::Resolvers::Uptime.resolve(:hours)
|
17
|
+
end
|
12
18
|
|
13
19
|
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
|
14
20
|
end
|
@@ -8,7 +8,13 @@ module Facts
|
|
8
8
|
ALIASES = 'uptime_seconds'
|
9
9
|
|
10
10
|
def call_the_resolver
|
11
|
-
|
11
|
+
hypervisors = Facter::Resolvers::Containers.resolve(:hypervisor)
|
12
|
+
|
13
|
+
fact_value = if hypervisors && hypervisors[:docker]
|
14
|
+
Facter::Resolvers::Linux::DockerUptime.resolve(:seconds)
|
15
|
+
else
|
16
|
+
Facter::Resolvers::Uptime.resolve(:seconds)
|
17
|
+
end
|
12
18
|
|
13
19
|
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
|
14
20
|
end
|
@@ -8,7 +8,13 @@ module Facts
|
|
8
8
|
ALIASES = 'uptime'
|
9
9
|
|
10
10
|
def call_the_resolver
|
11
|
-
|
11
|
+
hypervisors = Facter::Resolvers::Containers.resolve(:hypervisor)
|
12
|
+
|
13
|
+
fact_value = if hypervisors && hypervisors[:docker]
|
14
|
+
Facter::Resolvers::Linux::DockerUptime.resolve(:uptime)
|
15
|
+
else
|
16
|
+
Facter::Resolvers::Uptime.resolve(:uptime)
|
17
|
+
end
|
12
18
|
|
13
19
|
[Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
|
14
20
|
end
|
@@ -5,43 +5,59 @@ module Facts
|
|
5
5
|
class Virtual
|
6
6
|
FACT_NAME = 'virtual'
|
7
7
|
|
8
|
+
def initialize
|
9
|
+
@log = Facter::Log.new(self)
|
10
|
+
end
|
11
|
+
|
8
12
|
def call_the_resolver # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
13
|
+
@log.debug('Linux Virtual Resolver')
|
14
|
+
|
9
15
|
fact_value = check_docker_lxc || check_gce || retrieve_from_virt_what || check_vmware
|
10
16
|
fact_value ||= check_open_vz || check_vserver || check_xen || check_other_facts || check_lspci || 'physical'
|
11
17
|
|
18
|
+
@log.debug("Fact value is: #{fact_value}")
|
19
|
+
|
12
20
|
Facter::ResolvedFact.new(FACT_NAME, fact_value)
|
13
21
|
end
|
14
22
|
|
15
23
|
def check_gce
|
24
|
+
@log.debug('Checking GCE')
|
16
25
|
bios_vendor = Facter::Resolvers::Linux::DmiBios.resolve(:bios_vendor)
|
17
26
|
'gce' if bios_vendor&.include?('Google')
|
18
27
|
end
|
19
28
|
|
20
29
|
def check_docker_lxc
|
30
|
+
@log.debug('Checking Docker and LXC')
|
21
31
|
Facter::Resolvers::Containers.resolve(:vm)
|
22
32
|
end
|
23
33
|
|
24
34
|
def check_vmware
|
35
|
+
@log.debug('Checking VMware')
|
25
36
|
Facter::Resolvers::Vmware.resolve(:vm)
|
26
37
|
end
|
27
38
|
|
28
39
|
def retrieve_from_virt_what
|
40
|
+
@log.debug('Checking virtual_what')
|
29
41
|
Facter::Resolvers::VirtWhat.resolve(:vm)
|
30
42
|
end
|
31
43
|
|
32
44
|
def check_open_vz
|
45
|
+
@log.debug('Checking OpenVZ')
|
33
46
|
Facter::Resolvers::OpenVz.resolve(:vm)
|
34
47
|
end
|
35
48
|
|
36
49
|
def check_vserver
|
50
|
+
@log.debug('Checking VServer')
|
37
51
|
Facter::Resolvers::VirtWhat.resolve(:vserver)
|
38
52
|
end
|
39
53
|
|
40
54
|
def check_xen
|
55
|
+
@log.debug('Checking XEN')
|
41
56
|
Facter::Resolvers::Xen.resolve(:vm)
|
42
57
|
end
|
43
58
|
|
44
59
|
def check_other_facts
|
60
|
+
@log.debug('Checking others')
|
45
61
|
product_name = Facter::Resolvers::Linux::DmiBios.resolve(:product_name)
|
46
62
|
bios_vendor = Facter::Resolvers::Linux::DmiBios.resolve(:bios_vendor)
|
47
63
|
return 'kvm' if bios_vendor&.include?('Amazon EC2')
|
@@ -53,6 +69,7 @@ module Facts
|
|
53
69
|
end
|
54
70
|
|
55
71
|
def check_lspci
|
72
|
+
@log.debug('Checking lspci')
|
56
73
|
Facter::Resolvers::Lspci.resolve(:vm)
|
57
74
|
end
|
58
75
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facts
|
4
|
+
module Linux
|
5
|
+
class Xen
|
6
|
+
FACT_NAME = 'xen'
|
7
|
+
ALIASES = 'xendomains'
|
8
|
+
|
9
|
+
def call_the_resolver
|
10
|
+
xen_type = check_virt_what || check_xen
|
11
|
+
return Facter::ResolvedFact.new(FACT_NAME, nil) if !xen_type || xen_type != 'xen0'
|
12
|
+
|
13
|
+
domains = Facter::Resolvers::Xen.resolve(:domains) || []
|
14
|
+
|
15
|
+
[Facter::ResolvedFact.new(FACT_NAME, { domains: domains }),
|
16
|
+
Facter::ResolvedFact.new(ALIASES, domains.entries.join(','), :legacy)]
|
17
|
+
end
|
18
|
+
|
19
|
+
def check_virt_what
|
20
|
+
Facter::Resolvers::VirtWhat.resolve(:vm)
|
21
|
+
end
|
22
|
+
|
23
|
+
def check_xen
|
24
|
+
Facter::Resolvers::Xen.resolve(:vm)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -14,8 +14,8 @@ module Facts
|
|
14
14
|
private
|
15
15
|
|
16
16
|
def construct_addresses_hash
|
17
|
-
primary_dhcp = Facter::Resolvers::
|
18
|
-
interfaces = Facter::Resolvers::
|
17
|
+
primary_dhcp = Facter::Resolvers::Networking.resolve(:dhcp)
|
18
|
+
interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
|
19
19
|
return unless interfaces
|
20
20
|
|
21
21
|
servers = { system: primary_dhcp }
|
@@ -6,7 +6,7 @@ module Facts
|
|
6
6
|
FACT_NAME = 'interfaces'
|
7
7
|
|
8
8
|
def call_the_resolver
|
9
|
-
fact_value = Facter::Resolvers::
|
9
|
+
fact_value = Facter::Resolvers::Networking.resolve(:interfaces)
|
10
10
|
|
11
11
|
Facter::ResolvedFact.new(FACT_NAME, fact_value ? fact_value.keys.sort.join(',') : nil, :legacy)
|
12
12
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
|
9
9
|
def call_the_resolver
|
10
10
|
arr = []
|
11
|
-
interfaces = Facter::Resolvers::
|
11
|
+
interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
|
12
12
|
interfaces&.each do |interface_name, info|
|
13
13
|
arr << Facter::ResolvedFact.new("ipaddress6_#{interface_name}", info[:ip6], :legacy) if info[:ip6]
|
14
14
|
end
|
@@ -8,7 +8,7 @@ module Facts
|
|
8
8
|
|
9
9
|
def call_the_resolver
|
10
10
|
arr = []
|
11
|
-
interfaces = Facter::Resolvers::
|
11
|
+
interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
|
12
12
|
interfaces&.each do |interface_name, info|
|
13
13
|
arr << Facter::ResolvedFact.new("ipaddress_#{interface_name}", info[:ip], :legacy) if info[:ip]
|
14
14
|
end
|