facter 4.0.46 → 4.0.51
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.rb +32 -0
- data/lib/docs/template.erb +34 -0
- data/lib/facter.rb +59 -7
- data/lib/facter/config.rb +53 -10
- data/lib/facter/custom_facts/core/aggregate.rb +7 -0
- data/lib/facter/custom_facts/core/execution/base.rb +3 -2
- data/lib/facter/custom_facts/core/execution/popen3.rb +47 -0
- data/lib/facter/custom_facts/util/collection.rb +1 -2
- data/lib/facter/custom_facts/util/directory_loader.rb +1 -1
- data/lib/facter/custom_facts/util/fact.rb +40 -4
- data/lib/facter/custom_facts/util/loader.rb +1 -1
- data/lib/facter/custom_facts/util/resolution.rb +2 -2
- data/lib/facter/facts/aix/disks.rb +1 -1
- data/lib/facter/facts/aix/interfaces.rb +1 -0
- data/lib/facter/facts/aix/memory/swap/available.rb +1 -1
- data/lib/facter/facts/aix/memory/swap/available_bytes.rb +1 -1
- data/lib/facter/facts/aix/memory/swap/total.rb +1 -1
- data/lib/facter/facts/aix/memory/swap/total_bytes.rb +1 -1
- data/lib/facter/facts/aix/memory/swap/used.rb +1 -1
- data/lib/facter/facts/aix/memory/system/available.rb +1 -1
- data/lib/facter/facts/aix/memory/system/available_bytes.rb +1 -1
- data/lib/facter/facts/aix/memory/system/total.rb +1 -1
- data/lib/facter/facts/aix/memory/system/total_bytes.rb +1 -1
- data/lib/facter/facts/aix/memory/system/used.rb +1 -1
- data/lib/facter/facts/aix/processors/speed.rb +1 -1
- data/lib/facter/facts/aix/ssh.rb +1 -1
- data/lib/facter/facts/aix/sshalgorithmkey.rb +1 -1
- data/lib/facter/facts/aix/sshfp_algorithm.rb +1 -1
- data/lib/facter/facts/alpine/os/release.rb +29 -0
- data/lib/facter/facts/amzn/os/release.rb +29 -0
- data/lib/facter/facts/bsd/processors/speed.rb +1 -1
- data/lib/facter/facts/devuan/os/distro/release.rb +36 -0
- data/lib/facter/facts/devuan/os/release.rb +29 -0
- data/lib/facter/facts/freebsd/is_virtual.rb +25 -0
- data/lib/facter/facts/freebsd/memory/swap/available.rb +1 -1
- data/lib/facter/facts/freebsd/memory/swap/available_bytes.rb +1 -1
- data/lib/facter/facts/freebsd/memory/swap/total.rb +1 -1
- data/lib/facter/facts/freebsd/memory/swap/total_bytes.rb +1 -1
- data/lib/facter/facts/freebsd/memory/swap/used.rb +1 -1
- data/lib/facter/facts/freebsd/memory/system/available.rb +1 -1
- data/lib/facter/facts/freebsd/memory/system/available_bytes.rb +1 -1
- data/lib/facter/facts/freebsd/memory/system/total.rb +1 -1
- data/lib/facter/facts/freebsd/memory/system/total_bytes.rb +1 -1
- data/lib/facter/facts/freebsd/memory/system/used.rb +1 -1
- data/lib/facter/facts/freebsd/processors/speed.rb +1 -1
- data/lib/facter/facts/freebsd/ssh.rb +1 -1
- data/lib/facter/facts/freebsd/sshalgorithmkey.rb +1 -1
- data/lib/facter/facts/freebsd/sshfp_algorithm.rb +1 -1
- data/lib/facter/facts/freebsd/virtual.rb +22 -0
- data/lib/facter/facts/gentoo/os/release.rb +29 -0
- data/lib/facter/facts/linux/dhcp_servers.rb +1 -0
- data/lib/facter/facts/linux/disks.rb +1 -1
- data/lib/facter/facts/linux/ec2_metadata.rb +1 -1
- data/lib/facter/facts/linux/ec2_userdata.rb +1 -1
- data/lib/facter/facts/linux/hypervisors/kvm.rb +1 -1
- data/lib/facter/facts/linux/hypervisors/xen.rb +1 -1
- data/lib/facter/facts/linux/interfaces.rb +1 -0
- data/lib/facter/facts/linux/is_virtual.rb +2 -2
- data/lib/facter/facts/linux/memory/swap/available.rb +1 -1
- data/lib/facter/facts/linux/memory/swap/available_bytes.rb +1 -1
- data/lib/facter/facts/linux/memory/swap/total.rb +1 -1
- data/lib/facter/facts/linux/memory/swap/total_bytes.rb +1 -1
- data/lib/facter/facts/linux/memory/swap/used.rb +1 -1
- data/lib/facter/facts/linux/memory/system/available.rb +1 -1
- data/lib/facter/facts/linux/memory/system/available_bytes.rb +1 -1
- data/lib/facter/facts/linux/memory/system/total.rb +1 -1
- data/lib/facter/facts/linux/memory/system/total_bytes.rb +1 -1
- data/lib/facter/facts/linux/memory/system/used.rb +1 -1
- data/lib/facter/facts/linux/os/family.rb +4 -2
- data/lib/facter/facts/linux/processors/speed.rb +1 -1
- data/lib/facter/facts/linux/ssh.rb +1 -1
- data/lib/facter/facts/linux/sshalgorithmkey.rb +1 -1
- data/lib/facter/facts/linux/sshfp_algorithm.rb +1 -1
- data/lib/facter/facts/linux/virtual.rb +1 -1
- data/lib/facter/facts/linuxmint/os/name.rb +18 -0
- data/lib/facter/facts/linuxmint/os/release.rb +35 -0
- data/lib/facter/facts/macosx/dhcp_servers.rb +1 -0
- data/lib/facter/facts/macosx/interfaces.rb +1 -0
- data/lib/facter/facts/macosx/memory/swap/available.rb +1 -1
- data/lib/facter/facts/macosx/memory/swap/available_bytes.rb +1 -1
- data/lib/facter/facts/macosx/memory/swap/total.rb +1 -1
- data/lib/facter/facts/macosx/memory/swap/total_bytes.rb +1 -1
- data/lib/facter/facts/macosx/memory/swap/used.rb +1 -1
- data/lib/facter/facts/macosx/memory/system/available.rb +1 -1
- data/lib/facter/facts/macosx/memory/system/available_bytes.rb +1 -1
- data/lib/facter/facts/macosx/memory/system/total.rb +1 -1
- data/lib/facter/facts/macosx/memory/system/total_bytes.rb +1 -1
- data/lib/facter/facts/macosx/memory/system/used.rb +1 -1
- data/lib/facter/facts/macosx/processors/speed.rb +1 -1
- data/lib/facter/facts/macosx/ssh.rb +1 -1
- data/lib/facter/facts/macosx/sshalgorithmkey.rb +1 -1
- data/lib/facter/facts/macosx/sshfp_algorithm.rb +1 -1
- data/lib/facter/facts/mageia/os/release.rb +36 -0
- data/lib/facter/facts/meego/os/release.rb +29 -0
- data/lib/facter/facts/oel/os/release.rb +29 -0
- data/lib/facter/facts/ol/os/release.rb +29 -0
- data/lib/facter/facts/openwrt/os/release.rb +35 -0
- data/lib/facter/facts/ovs/os/release.rb +29 -0
- data/lib/facter/facts/photon/os/release.rb +45 -0
- data/lib/facter/facts/rhel/os/release.rb +1 -8
- data/lib/facter/facts/slackware/os/release.rb +35 -0
- data/lib/facter/facts/solaris/dhcp_servers.rb +1 -0
- data/lib/facter/facts/solaris/disks.rb +1 -1
- data/lib/facter/facts/solaris/interfaces.rb +1 -0
- data/lib/facter/facts/solaris/is_virtual.rb +2 -2
- data/lib/facter/facts/solaris/ldom.rb +31 -4
- data/lib/facter/facts/solaris/memory/swap/available.rb +1 -1
- data/lib/facter/facts/solaris/memory/swap/available_bytes.rb +1 -1
- data/lib/facter/facts/solaris/memory/swap/total.rb +1 -1
- data/lib/facter/facts/solaris/memory/swap/total_bytes.rb +1 -1
- data/lib/facter/facts/solaris/memory/swap/used.rb +1 -1
- data/lib/facter/facts/solaris/memory/system/available.rb +1 -1
- data/lib/facter/facts/solaris/memory/system/available_bytes.rb +1 -1
- data/lib/facter/facts/solaris/memory/system/total.rb +1 -1
- data/lib/facter/facts/solaris/memory/system/total_bytes.rb +1 -1
- data/lib/facter/facts/solaris/memory/system/used.rb +1 -1
- data/lib/facter/facts/solaris/processors/speed.rb +1 -1
- data/lib/facter/facts/solaris/ssh.rb +1 -1
- data/lib/facter/facts/solaris/sshalgorithmkey.rb +1 -1
- data/lib/facter/facts/solaris/sshfp_algorithm.rb +1 -1
- data/lib/facter/facts/solaris/virtual.rb +1 -1
- data/lib/facter/facts/windows/dhcp_servers.rb +1 -0
- data/lib/facter/facts/windows/interfaces.rb +1 -0
- data/lib/facter/facts/windows/memory/system/available.rb +1 -1
- data/lib/facter/facts/windows/memory/system/available_bytes.rb +1 -1
- data/lib/facter/facts/windows/memory/system/total.rb +1 -1
- data/lib/facter/facts/windows/memory/system/total_bytes.rb +1 -1
- data/lib/facter/facts/windows/memory/system/used.rb +1 -1
- data/lib/facter/facts/windows/networking/fqdn.rb +1 -1
- data/lib/facter/facts/windows/os/release.rb +1 -1
- data/lib/facter/framework/cli/cli.rb +2 -4
- data/lib/facter/framework/config/config_reader.rb +7 -0
- data/lib/facter/framework/config/fact_groups.rb +3 -0
- data/lib/facter/framework/core/cache_manager.rb +1 -1
- data/lib/facter/framework/core/fact_loaders/external_fact_loader.rb +4 -6
- data/lib/facter/framework/core/fact_loaders/fact_loader.rb +18 -0
- data/lib/facter/framework/core/fact_manager.rb +14 -2
- data/lib/facter/framework/core/file_loader.rb +6 -2
- data/lib/facter/framework/core/options/option_store.rb +12 -4
- data/lib/facter/framework/detector/os_detector.rb +8 -0
- data/lib/facter/framework/logging/logger.rb +7 -7
- data/lib/facter/models/fact_collection.rb +11 -1
- data/lib/facter/models/loaded_fact.rb +2 -1
- data/lib/facter/resolvers/aio_agent_version.rb +2 -2
- data/lib/facter/resolvers/aix/{architecture_resolver.rb → architecture.rb} +4 -4
- data/lib/facter/resolvers/aix/disks.rb +5 -5
- data/lib/facter/resolvers/aix/ffi/ffi.rb +63 -0
- data/lib/facter/resolvers/aix/ffi/ffi_helper.rb +146 -20
- data/lib/facter/resolvers/aix/ffi/structs.rb +69 -0
- data/lib/facter/resolvers/aix/{filesystem_resolver.rb → filesystem.rb} +2 -2
- data/lib/facter/resolvers/aix/{hardware_resolver.rb → hardware.rb} +3 -3
- data/lib/facter/resolvers/aix/{load_averages_resolver.rb → load_averages.rb} +2 -2
- data/lib/facter/resolvers/aix/memory.rb +3 -3
- data/lib/facter/resolvers/aix/mountpoints.rb +5 -5
- data/lib/facter/resolvers/aix/{networking_resolver.rb → networking.rb} +12 -18
- data/lib/facter/resolvers/aix/nim.rb +1 -1
- data/lib/facter/resolvers/aix/os_level.rb +1 -1
- data/lib/facter/resolvers/aix/partitions.rb +6 -6
- data/lib/facter/resolvers/aix/processors.rb +4 -4
- data/lib/facter/resolvers/aix/serialnumber.rb +2 -2
- data/lib/facter/resolvers/{augeas_resolver.rb → augeas.rb} +1 -1
- data/lib/facter/resolvers/base_resolver.rb +7 -4
- data/lib/facter/resolvers/bsd/processors.rb +1 -1
- data/lib/facter/resolvers/cloud.rb +2 -2
- data/lib/facter/resolvers/containers.rb +4 -4
- data/lib/facter/resolvers/debian_version.rb +2 -2
- data/lib/facter/resolvers/{disk_resolver.rb → disk.rb} +3 -3
- data/lib/facter/resolvers/{dmi_resolver.rb → dmi.rb} +2 -2
- data/lib/facter/resolvers/dmi_decode.rb +1 -1
- data/lib/facter/resolvers/ec2.rb +4 -2
- data/lib/facter/resolvers/{eos_release_resolver.rb → eos_release.rb} +2 -2
- data/lib/facter/resolvers/{facterversion_resolver.rb → facterversion.rb} +1 -1
- data/lib/facter/resolvers/{filesystems_resolver.rb → filesystems.rb} +2 -2
- data/lib/facter/resolvers/{fips_enabled_resolver.rb → fips_enabled.rb} +2 -2
- data/lib/facter/resolvers/freebsd/{dmi_resolver.rb → dmi.rb} +1 -1
- data/lib/facter/resolvers/freebsd/{freebsd_version_resolver.rb → freebsd_version.rb} +1 -1
- data/lib/facter/resolvers/freebsd/{geom_resolver.rb → geom.rb} +2 -2
- data/lib/facter/resolvers/freebsd/processors.rb +1 -1
- data/lib/facter/resolvers/freebsd/{swap_memory_resolver.rb → swap_memory.rb} +4 -3
- data/lib/facter/resolvers/freebsd/{system_memory_resolver.rb → system_memory.rb} +3 -2
- data/lib/facter/resolvers/freebsd/virtual.rb +45 -0
- data/lib/facter/resolvers/gce.rb +2 -2
- data/lib/facter/resolvers/hostname.rb +92 -0
- data/lib/facter/resolvers/{identity_resolver.rb → identity.rb} +1 -1
- data/lib/facter/resolvers/linux/docker_uptime.rb +2 -2
- data/lib/facter/resolvers/linux/load_averages.rb +2 -2
- data/lib/facter/resolvers/load_averages.rb +4 -3
- data/lib/facter/resolvers/{lpar_resolver.rb → lpar.rb} +1 -1
- data/lib/facter/resolvers/{lsb_release_resolver.rb → lsb_release.rb} +1 -1
- data/lib/facter/resolvers/lspci.rb +1 -1
- data/lib/facter/resolvers/macosx/{dmi_resolver.rb → dmi.rb} +1 -1
- data/lib/facter/resolvers/macosx/{filesystems_resolver.rb → filesystems.rb} +1 -1
- data/lib/facter/resolvers/macosx/{load_averages_resolver.rb → load_averages.rb} +1 -1
- data/lib/facter/resolvers/macosx/{mountpoints_resolver.rb → mountpoints.rb} +8 -8
- data/lib/facter/resolvers/macosx/{processor_resolver.rb → processor.rb} +1 -1
- data/lib/facter/resolvers/macosx/{swap_memory_resolver.rb → swap_memory.rb} +1 -1
- data/lib/facter/resolvers/macosx/{system_memory_resolver.rb → system_memory.rb} +1 -1
- data/lib/facter/resolvers/macosx/{system_profiler_resolver.rb → system_profiler.rb} +4 -4
- data/lib/facter/resolvers/{memory_resolver.rb → memory.rb} +2 -2
- data/lib/facter/resolvers/{mountpoints_resolver.rb → mountpoints.rb} +9 -9
- data/lib/facter/resolvers/{networking_resolver.rb → networking.rb} +9 -6
- data/lib/facter/resolvers/networking_linux.rb +296 -0
- data/lib/facter/resolvers/open_vz.rb +2 -4
- data/lib/facter/resolvers/{os_release_resolver.rb → os_release.rb} +2 -2
- data/lib/facter/resolvers/partitions.rb +6 -6
- data/lib/facter/resolvers/{path_resolver.rb → path.rb} +1 -1
- data/lib/facter/resolvers/{processors_resolver.rb → processors.rb} +3 -3
- data/lib/facter/resolvers/{redhat_release_resolver.rb → redhat_release.rb} +2 -2
- data/lib/facter/resolvers/release_from_first_line.rb +41 -0
- data/lib/facter/resolvers/{ruby_resolver.rb → ruby.rb} +1 -1
- data/lib/facter/resolvers/{selinux_resolver.rb → selinux.rb} +4 -4
- data/lib/facter/resolvers/solaris/disks.rb +2 -2
- data/lib/facter/resolvers/solaris/dmi.rb +1 -1
- data/lib/facter/resolvers/solaris/dmi_sparc.rb +1 -1
- data/lib/facter/resolvers/solaris/filesystems.rb +1 -1
- data/lib/facter/resolvers/solaris/ipaddress.rb +1 -1
- data/lib/facter/resolvers/solaris/ldom.rb +1 -1
- data/lib/facter/resolvers/solaris/memory.rb +3 -3
- data/lib/facter/resolvers/solaris/mountpoints.rb +12 -11
- data/lib/facter/resolvers/solaris/networking.rb +50 -42
- data/lib/facter/resolvers/solaris/os_release.rb +2 -2
- data/lib/facter/resolvers/solaris/processors.rb +1 -1
- data/lib/facter/resolvers/solaris/zone.rb +1 -1
- data/lib/facter/resolvers/solaris/zone_name.rb +1 -1
- data/lib/facter/resolvers/specific_release_file.rb +35 -0
- data/lib/facter/resolvers/{ssh_resolver.rb → ssh.rb} +5 -4
- data/lib/facter/resolvers/{suse_release_resolver.rb → suse_release.rb} +2 -2
- data/lib/facter/resolvers/{sw_vers_resolver.rb → sw_vers.rb} +1 -1
- data/lib/facter/resolvers/{timezone_resolver.rb → timezone.rb} +1 -1
- data/lib/facter/resolvers/{uname_resolver.rb → uname.rb} +1 -1
- data/lib/facter/resolvers/{uptime_resolver.rb → uptime.rb} +3 -3
- data/lib/facter/resolvers/virt_what.rb +1 -1
- data/lib/facter/resolvers/vmware.rb +1 -1
- data/lib/facter/resolvers/windows/aio_agent_version.rb +2 -2
- data/lib/facter/resolvers/windows/{dmi_bios_resolver.rb → dmi_bios.rb} +2 -2
- data/lib/facter/resolvers/windows/{dmi_computersystem_resolver.rb → dmi_computersystem.rb} +2 -2
- data/lib/facter/resolvers/windows/ffi/network_utils.rb +1 -2
- data/lib/facter/resolvers/windows/{fips_resolver.rb → fips.rb} +1 -1
- data/lib/facter/resolvers/windows/{hardware_architecture_resolver.rb → hardware_architecture.rb} +1 -1
- data/lib/facter/resolvers/windows/{identity_resolver.rb → identity.rb} +1 -1
- data/lib/facter/resolvers/windows/{kernel_resolver.rb → kernel.rb} +1 -1
- data/lib/facter/resolvers/windows/{memory_resolver.rb → memory.rb} +5 -1
- data/lib/facter/resolvers/windows/{netkvm_resolver.rb → netkvm.rb} +1 -1
- data/lib/facter/resolvers/windows/{networking_resolver.rb → networking.rb} +22 -5
- data/lib/facter/resolvers/windows/{processors_resolver.rb → processors.rb} +2 -2
- data/lib/facter/resolvers/windows/{product_release_resolver.rb → product_release.rb} +1 -1
- data/lib/facter/resolvers/windows/ssh.rb +3 -3
- data/lib/facter/resolvers/windows/{system32_resolver.rb → system32.rb} +1 -1
- data/lib/facter/resolvers/windows/{uptime_resolver.rb → uptime.rb} +2 -2
- data/lib/facter/resolvers/windows/{virtualization_resolver.rb → virtualization.rb} +2 -2
- data/lib/facter/resolvers/windows/{win_os_description_resolver.rb → win_os_description.rb} +2 -2
- data/lib/facter/resolvers/{wpar_resolver.rb → wpar.rb} +1 -1
- data/lib/facter/resolvers/xen.rb +2 -2
- data/lib/facter/resolvers/zfs.rb +1 -1
- data/lib/facter/resolvers/zpool.rb +1 -1
- data/lib/facter/util/aix/info_extractor.rb +24 -0
- data/lib/facter/util/aix/odm_query.rb +46 -0
- data/lib/facter/util/api_debugger.rb +33 -29
- data/lib/facter/util/facts/facts_utils.rb +47 -0
- data/lib/facter/util/facts/unit_converter.rb +68 -0
- data/lib/facter/util/facts/uptime_parser.rb +128 -0
- data/lib/facter/util/facts/virtual_detector.rb +90 -0
- data/lib/facter/util/facts/windows_release_finder.rb +55 -0
- data/lib/facter/{resolvers/macosx/utils → util/macosx}/system_profile_executor.rb +1 -1
- data/lib/facter/util/resolvers/aws_token.rb +37 -0
- data/lib/facter/{resolvers/utils → util/resolvers}/ffi/load_averages.rb +2 -2
- data/lib/facter/util/resolvers/filesystem_helper.rb +47 -0
- data/lib/facter/util/resolvers/fingerprint.rb +15 -0
- data/lib/facter/{resolvers/utils → util/resolvers}/http.rb +17 -10
- data/lib/facter/util/resolvers/networking/dhcp.rb +21 -0
- data/lib/facter/util/resolvers/networking/networking.rb +109 -0
- data/lib/facter/util/resolvers/networking/primary_interface.rb +82 -0
- data/lib/facter/util/resolvers/ssh.rb +17 -0
- data/lib/facter/util/resolvers/ssh_helper.rb +31 -0
- data/lib/facter/{resolvers/utils → util/resolvers}/uptime_helper.rb +2 -2
- data/lib/facter/{framework/utils → util}/utils.rb +0 -4
- data/lib/facter/util/windows/win32ole.rb +30 -0
- data/lib/facter/version.rb +1 -1
- metadata +123 -116
- data/lib/facter/facts/aix/puppet_version.rb +0 -15
- data/lib/facter/facts/freebsd/puppet_version.rb +0 -15
- data/lib/facter/facts/linux/puppet_version.rb +0 -15
- data/lib/facter/facts/macosx/puppet_version.rb +0 -15
- data/lib/facter/facts/solaris/puppet_version.rb +0 -15
- data/lib/facter/facts/windows/puppet_version.rb +0 -15
- data/lib/facter/facts_utils/facts_utils.rb +0 -12
- data/lib/facter/facts_utils/unit_converter.rb +0 -59
- data/lib/facter/facts_utils/uptime_parser.rb +0 -124
- data/lib/facter/facts_utils/virtual_detector.rb +0 -78
- data/lib/facter/facts_utils/windows_release_finder.rb +0 -51
- data/lib/facter/resolvers/aix/utils/info_extractor.rb +0 -20
- data/lib/facter/resolvers/aix/utils/odm_query.rb +0 -42
- data/lib/facter/resolvers/hostname_resolver.rb +0 -45
- data/lib/facter/resolvers/networking_linux_resolver.rb +0 -160
- data/lib/facter/resolvers/puppet_version_resolver.rb +0 -26
- data/lib/facter/resolvers/utils/filesystem_helper.rb +0 -43
- data/lib/facter/resolvers/utils/fingerprint.rb +0 -11
- data/lib/facter/resolvers/utils/networking.rb +0 -88
- data/lib/facter/resolvers/utils/ssh.rb +0 -13
- data/lib/facter/resolvers/utils/ssh_helper.rb +0 -27
- data/lib/facter/resolvers/windows/utils/win32ole.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db03b26f8336c77d444ced6b4d073a927b529e6272ef0ba65eafc69af0e66060
|
4
|
+
data.tar.gz: a07adb46289f6315764d40a3f21c967de22c187fe9070177959a02c82bd1da6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cf1b38ac9c4e67b93e73474afa8f134132f0afd90d9cb5e45a4ced0c2cca3874ca581d1e6dd59ea154eb57e7ffc423a2a0c9aa1d36bdd04501648499dc30c3f
|
7
|
+
data.tar.gz: 0567b4d6940087e0c0d273392b103bd507fe6f15adbcaa826d783db1eda0c512582da10031400a0360b76fa397150101e925b4f814b394bdc478b615a1d1c1d0
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Generates a markdown file containing fact documentation.
|
5
|
+
# usage: ruby generate.rb > facts.md
|
6
|
+
|
7
|
+
require 'yaml'
|
8
|
+
require 'erb'
|
9
|
+
require 'ostruct'
|
10
|
+
|
11
|
+
PATH_TO_SCHEMA = File.join(File.dirname(__FILE__), '../schema/facter.yaml')
|
12
|
+
PATH_TO_TEMPLATE = File.join(File.dirname(__FILE__), 'template.erb')
|
13
|
+
|
14
|
+
schema = YAML.load_file(PATH_TO_SCHEMA)
|
15
|
+
|
16
|
+
def format_facts(fact_hash)
|
17
|
+
scope = OpenStruct.new({
|
18
|
+
facts: fact_hash
|
19
|
+
})
|
20
|
+
|
21
|
+
erb = if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
|
22
|
+
ERB.new(File.read(PATH_TO_TEMPLATE), trim_mode: '-')
|
23
|
+
else
|
24
|
+
ERB.new(File.read(PATH_TO_TEMPLATE), nil, '-')
|
25
|
+
end
|
26
|
+
erb.result(scope.instance_eval { binding })
|
27
|
+
end
|
28
|
+
|
29
|
+
print "## Modern Facts\n\n"
|
30
|
+
print format_facts(schema.reject { |_name, info| info['hidden'] == true })
|
31
|
+
print "## Legacy Facts\n\n"
|
32
|
+
print format_facts(schema.reject { |_name, info| info['hidden'].nil? || info['hidden'] == false })
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<%# This template is used to generate a markdown file documenting facts. -%>
|
2
|
+
<%# Run 'ruby generate.rb > facts.md' to generate the markdown file. -%>
|
3
|
+
<%
|
4
|
+
def format_fact_element(name, info, indent = '')
|
5
|
+
subelements = (info['elements'] || {}).map{|n, i| format_fact_element(n, i, "#{indent} ")}.join('')
|
6
|
+
|
7
|
+
"#{indent}* `#{name}` (#{info['type']}) --- #{info['description']}\n#{subelements}"
|
8
|
+
end
|
9
|
+
-%>
|
10
|
+
<% facts.each do |name, schema| -%>
|
11
|
+
### `<%= name %>`
|
12
|
+
|
13
|
+
<% if schema['hidden'] -%>
|
14
|
+
This legacy fact is hidden by default in Facter's command-line output.
|
15
|
+
|
16
|
+
<% end -%>
|
17
|
+
**Type:** <%= schema['type'] %>
|
18
|
+
|
19
|
+
**Purpose:**
|
20
|
+
|
21
|
+
<%= schema['description'] %>
|
22
|
+
|
23
|
+
<% if schema['elements'] -%>
|
24
|
+
**Elements:**
|
25
|
+
|
26
|
+
<%= schema['elements'].map{|name, info| format_fact_element(name, info)}.join('') %>
|
27
|
+
<% end -%>
|
28
|
+
|
29
|
+
<% if schema['details'] -%>
|
30
|
+
**Details:**
|
31
|
+
|
32
|
+
<%= schema['details'] %>
|
33
|
+
<% end -%>
|
34
|
+
<% end -%>
|
data/lib/facter.rb
CHANGED
@@ -44,6 +44,27 @@ module Facter
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
def puppet_facts
|
48
|
+
require 'puppet'
|
49
|
+
|
50
|
+
# don't allow puppet logger to be injected in Facter
|
51
|
+
Options[:allow_external_loggers] = false
|
52
|
+
|
53
|
+
Puppet.initialize_settings
|
54
|
+
$LOAD_PATH << Puppet[:libdir] unless $LOAD_PATH.include?(Puppet[:libdir])
|
55
|
+
Facter.reset
|
56
|
+
Facter.search_external([Puppet[:pluginfactdest]])
|
57
|
+
if Puppet.respond_to? :initialize_facts
|
58
|
+
Puppet.initialize_facts
|
59
|
+
else
|
60
|
+
Facter.add(:puppetversion) do
|
61
|
+
setcode { Puppet.version.to_s }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
rescue LoadError => e
|
65
|
+
logger.error("Could not load puppet gem, got #{e}")
|
66
|
+
end
|
67
|
+
|
47
68
|
# Alias method for Facter.fact()
|
48
69
|
# @param name [string] fact name
|
49
70
|
#
|
@@ -261,6 +282,26 @@ module Facter
|
|
261
282
|
nil
|
262
283
|
end
|
263
284
|
|
285
|
+
# Enables/Disables external facts.
|
286
|
+
# @param enable_external [boolean]
|
287
|
+
#
|
288
|
+
# @return nil
|
289
|
+
#
|
290
|
+
# @api public
|
291
|
+
def load_external(enable_external)
|
292
|
+
# enable_external param needs negation because behind the scene
|
293
|
+
# no_external_facts= method is negating the parameter again.
|
294
|
+
Options[:no_external_facts] = !enable_external
|
295
|
+
|
296
|
+
if enable_external
|
297
|
+
logger.debug('Facter.load_external(true) called. External facts will be loaded')
|
298
|
+
else
|
299
|
+
logger.debug('Facter.load_external(false) called. External facts will NOT be loaded')
|
300
|
+
end
|
301
|
+
|
302
|
+
nil
|
303
|
+
end
|
304
|
+
|
264
305
|
# Register directories to be searched for custom facts. The registered directories
|
265
306
|
# must be absolute paths or they will be ignored.
|
266
307
|
# @param dirs [Array<String>] An array of searched directories
|
@@ -310,9 +351,12 @@ module Facter
|
|
310
351
|
# @api public
|
311
352
|
def to_hash
|
312
353
|
log_blocked_facts
|
354
|
+
logger.debug("Facter version: #{Facter::VERSION}")
|
313
355
|
|
314
356
|
resolved_facts = Facter::FactManager.instance.resolve_facts
|
315
|
-
|
357
|
+
resolved_facts.reject! { |fact| fact.type == :custom && fact.value.nil? }
|
358
|
+
collection = Facter::FactCollection.new.build_fact_collection!(resolved_facts)
|
359
|
+
Hash[collection]
|
316
360
|
end
|
317
361
|
|
318
362
|
# Check whether printing stack trace is enabled
|
@@ -358,9 +402,9 @@ module Facter
|
|
358
402
|
# @api public
|
359
403
|
def values(options, user_queries)
|
360
404
|
init_cli_options(options, user_queries)
|
361
|
-
Options[:show_legacy] = true
|
362
405
|
log_blocked_facts
|
363
406
|
resolved_facts = Facter::FactManager.instance.resolve_facts(user_queries)
|
407
|
+
resolved_facts.reject! { |fact| fact.type == :custom && fact.value.nil? }
|
364
408
|
|
365
409
|
if user_queries.count.zero?
|
366
410
|
Facter::FactCollection.new.build_fact_collection!(resolved_facts)
|
@@ -386,13 +430,13 @@ module Facter
|
|
386
430
|
def to_user_output(cli_options, *args)
|
387
431
|
init_cli_options(cli_options, args)
|
388
432
|
logger.info("executed with command line: #{ARGV.drop(1).join(' ')}")
|
433
|
+
logger.debug("Facter version: #{Facter::VERSION}")
|
389
434
|
log_blocked_facts
|
390
|
-
resolved_facts =
|
435
|
+
resolved_facts = resolve_facts_for_user_query(args)
|
391
436
|
fact_formatter = Facter::FormatterFactory.build(Facter::Options.get)
|
392
|
-
|
393
437
|
status = error_check(resolved_facts)
|
394
438
|
|
395
|
-
[fact_formatter.format(resolved_facts), status
|
439
|
+
[fact_formatter.format(resolved_facts), status]
|
396
440
|
end
|
397
441
|
|
398
442
|
# Logs an exception and an optional message
|
@@ -446,6 +490,15 @@ module Facter
|
|
446
490
|
|
447
491
|
private
|
448
492
|
|
493
|
+
def resolve_facts_for_user_query(user_query)
|
494
|
+
resolved_facts = Facter::FactManager.instance.resolve_facts(user_query)
|
495
|
+
user_querie = resolved_facts.uniq(&:user_query).map(&:user_query).first
|
496
|
+
|
497
|
+
resolved_facts.reject! { |fact| fact.type == :custom && fact.value.nil? } if user_querie&.empty?
|
498
|
+
|
499
|
+
resolved_facts
|
500
|
+
end
|
501
|
+
|
449
502
|
def parse_exception(exception, error_message)
|
450
503
|
if exception.is_a?(Exception)
|
451
504
|
error_message << exception.message if error_message.empty?
|
@@ -504,14 +557,13 @@ module Facter
|
|
504
557
|
#
|
505
558
|
# @api private
|
506
559
|
def error_check(resolved_facts)
|
560
|
+
status = 0
|
507
561
|
if Options[:strict]
|
508
562
|
missing_names = resolved_facts.select { |fact| fact.type == :nil }.map(&:user_query)
|
509
563
|
|
510
564
|
if missing_names.count.positive?
|
511
565
|
status = 1
|
512
566
|
log_errors(missing_names)
|
513
|
-
else
|
514
|
-
status = nil
|
515
567
|
end
|
516
568
|
end
|
517
569
|
|
data/lib/facter/config.rb
CHANGED
@@ -7,10 +7,13 @@ module Facter
|
|
7
7
|
{
|
8
8
|
'Linux' => [
|
9
9
|
{
|
10
|
-
'Debian' =>
|
11
|
-
Elementary
|
12
|
-
Ubuntu
|
13
|
-
|
10
|
+
'Debian' => [
|
11
|
+
'Elementary',
|
12
|
+
{ 'Ubuntu' => [
|
13
|
+
'Linuxmint'
|
14
|
+
] },
|
15
|
+
'Raspbian',
|
16
|
+
'Devuan'
|
14
17
|
]
|
15
18
|
},
|
16
19
|
{
|
@@ -20,13 +23,23 @@ module Facter
|
|
20
23
|
Centos
|
21
24
|
Ol
|
22
25
|
Scientific
|
26
|
+
Meego
|
27
|
+
Oel
|
28
|
+
Ovs
|
23
29
|
]
|
24
30
|
},
|
25
31
|
{
|
26
|
-
'Sles' => [
|
27
|
-
|
32
|
+
'Sles' => %w[
|
33
|
+
Opensuse
|
34
|
+
Sled
|
28
35
|
]
|
29
|
-
}
|
36
|
+
},
|
37
|
+
'Gentoo',
|
38
|
+
'Alpine',
|
39
|
+
'Photon',
|
40
|
+
'Slackware',
|
41
|
+
'Mageia',
|
42
|
+
'Openwrt'
|
30
43
|
]
|
31
44
|
},
|
32
45
|
{
|
@@ -42,6 +55,9 @@ module Facter
|
|
42
55
|
end
|
43
56
|
unless defined? FACT_GROUPS
|
44
57
|
FACT_GROUPS = {
|
58
|
+
'AIX NIM type' => [
|
59
|
+
'nim_type'
|
60
|
+
],
|
45
61
|
'EC2' => %w[
|
46
62
|
ec2_metadata
|
47
63
|
ec2_userdata
|
@@ -49,6 +65,10 @@ module Facter
|
|
49
65
|
'GCE' => [
|
50
66
|
'gce'
|
51
67
|
],
|
68
|
+
'Xen' => %w[
|
69
|
+
xen
|
70
|
+
xendomains
|
71
|
+
],
|
52
72
|
'augeas' => %w[
|
53
73
|
augeas
|
54
74
|
augeasversion
|
@@ -69,11 +89,18 @@ module Facter
|
|
69
89
|
uuid
|
70
90
|
chassistype
|
71
91
|
],
|
92
|
+
'disks' => %w[
|
93
|
+
blockdevices
|
94
|
+
disks
|
95
|
+
],
|
72
96
|
'file system' => %w[
|
73
97
|
mountpoints
|
74
98
|
filesystems
|
75
99
|
partitions
|
76
100
|
],
|
101
|
+
'fips' => [
|
102
|
+
'fips_enabled'
|
103
|
+
],
|
77
104
|
'hypervisors' => [
|
78
105
|
'hypervisors'
|
79
106
|
],
|
@@ -112,12 +139,12 @@ module Facter
|
|
112
139
|
netmask6
|
113
140
|
network
|
114
141
|
network6
|
142
|
+
scope6
|
115
143
|
macaddress
|
116
144
|
interfaces
|
117
145
|
domain
|
118
146
|
fqdn
|
119
147
|
dhcp_servers
|
120
|
-
scope6
|
121
148
|
],
|
122
149
|
'operating system' => %w[
|
123
150
|
os
|
@@ -210,6 +237,23 @@ module Facter
|
|
210
237
|
is_virtual
|
211
238
|
cloud
|
212
239
|
],
|
240
|
+
'ldom' => [
|
241
|
+
'ldom'
|
242
|
+
],
|
243
|
+
'Solaris zone' => %w[
|
244
|
+
zones
|
245
|
+
zonename
|
246
|
+
solaris_zones
|
247
|
+
],
|
248
|
+
'ZFS' => %w[
|
249
|
+
zfs_version
|
250
|
+
zfs_featurenumbers
|
251
|
+
],
|
252
|
+
'ZFS storage pool' => %w[
|
253
|
+
zpool_version
|
254
|
+
zpool_featureflags
|
255
|
+
zpool_featurenumbers
|
256
|
+
],
|
213
257
|
'legacy' => [
|
214
258
|
'architecture',
|
215
259
|
'augeasversion',
|
@@ -281,8 +325,7 @@ module Facter
|
|
281
325
|
'operatingsystemrelease',
|
282
326
|
'osfamily',
|
283
327
|
'physicalprocessorcount',
|
284
|
-
'processor
|
285
|
-
'processor*',
|
328
|
+
'processor[0-9]+.*',
|
286
329
|
'processorcount',
|
287
330
|
'productname',
|
288
331
|
'rubyplatform',
|
@@ -24,6 +24,13 @@ module Facter
|
|
24
24
|
# @api public
|
25
25
|
attr_reader :name
|
26
26
|
|
27
|
+
# @!attribute [r] fact_type
|
28
|
+
#
|
29
|
+
# @return [Symbol] The fact type of the aggregate resolution
|
30
|
+
#
|
31
|
+
# @api private
|
32
|
+
attr_reader :fact_type
|
33
|
+
|
27
34
|
# @!attribute [r] deps
|
28
35
|
#
|
29
36
|
# @return [LegacyFacter::Core::DirectedGraph]
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'popen3'
|
4
|
+
|
3
5
|
module Facter
|
4
6
|
module Core
|
5
7
|
module Execution
|
@@ -70,8 +72,7 @@ module Facter
|
|
70
72
|
opts = { 'LC_ALL' => 'C', 'LANG' => 'C' }
|
71
73
|
require 'timeout'
|
72
74
|
@log.debug("Executing command: #{command}")
|
73
|
-
out, stderr =
|
74
|
-
pid = wait_thr.pid
|
75
|
+
out, stderr = Popen3.popen3e(opts, command.to_s) do |_, stdout, stderr, pid|
|
75
76
|
stdout_messages = +''
|
76
77
|
stderr_messages = +''
|
77
78
|
out_reader = Thread.new { stdout.read }
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Because Open3 uses Process.detach the env $? is not set so
|
5
|
+
# this class reimplements Open3.popen3 with Process.wait instead.
|
6
|
+
# [FACT-2934] When calling Facter::Core::Execution, $? and $CHILD_STATUS
|
7
|
+
# ruby env variables should be set.
|
8
|
+
#
|
9
|
+
|
10
|
+
module Facter
|
11
|
+
module Core
|
12
|
+
module Execution
|
13
|
+
class Popen3
|
14
|
+
def self.popen_rune(cmd, opts, child_io, parent_io) # :nodoc:
|
15
|
+
pid = spawn(*cmd, opts)
|
16
|
+
child_io.each(&:close)
|
17
|
+
result = [*parent_io, pid]
|
18
|
+
if defined? yield
|
19
|
+
begin
|
20
|
+
return yield(*result)
|
21
|
+
ensure
|
22
|
+
parent_io.each(&:close)
|
23
|
+
Process.wait(pid)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
result
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.popen3e(*cmd, &block)
|
30
|
+
opts = if cmd.last.is_a? Hash
|
31
|
+
cmd.pop.dup
|
32
|
+
else
|
33
|
+
{}
|
34
|
+
end
|
35
|
+
in_r, in_w = IO.pipe
|
36
|
+
opts[:in] = in_r
|
37
|
+
in_w.sync = true
|
38
|
+
out_r, out_w = IO.pipe
|
39
|
+
opts[:out] = out_w
|
40
|
+
err_r, err_w = IO.pipe
|
41
|
+
opts[:err] = err_w
|
42
|
+
popen_rune(cmd, opts, [in_r, out_w, err_w], [in_w, out_r, err_r], &block)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -115,8 +115,7 @@ module LegacyFacter
|
|
115
115
|
internal_loader.load_all unless @loaded
|
116
116
|
@loaded = true
|
117
117
|
|
118
|
-
custom_facts = @facts.select { |_k, v| v.options[:fact_type] == :custom }
|
119
|
-
@custom_facts = Facter::Utils.deep_copy(custom_facts.keys)
|
118
|
+
@custom_facts = @facts.select { |_k, v| v.options[:fact_type] == :custom }
|
120
119
|
end
|
121
120
|
|
122
121
|
def load(name)
|
@@ -109,7 +109,7 @@ module LegacyFacter
|
|
109
109
|
|
110
110
|
def entries
|
111
111
|
dirs = @directories.select { |directory| File.directory?(directory) }.map do |directory|
|
112
|
-
Dir.entries(directory).map { |directory_entry| File.join(directory, directory_entry) }
|
112
|
+
Dir.entries(directory).map { |directory_entry| File.join(directory, directory_entry) }.sort.reverse!
|
113
113
|
end
|
114
114
|
dirs.flatten.select { |f| should_parse?(f) }
|
115
115
|
rescue Errno::ENOENT
|
@@ -9,6 +9,10 @@
|
|
9
9
|
module Facter
|
10
10
|
module Util
|
11
11
|
class Fact
|
12
|
+
# The location from where fact is resolved
|
13
|
+
# @return [String]
|
14
|
+
attr_reader :location
|
15
|
+
|
12
16
|
# The name of the fact
|
13
17
|
# @return [String]
|
14
18
|
attr_reader :name
|
@@ -33,7 +37,7 @@ module Facter
|
|
33
37
|
def initialize(name, options = {})
|
34
38
|
@name = name.to_s.downcase.intern
|
35
39
|
|
36
|
-
@options =
|
40
|
+
@options = options.dup
|
37
41
|
extract_ldapname_option!(options)
|
38
42
|
|
39
43
|
@ldapname ||= @name.to_s
|
@@ -43,6 +47,8 @@ module Facter
|
|
43
47
|
@used_resolution_weight = 0
|
44
48
|
|
45
49
|
@value = nil
|
50
|
+
|
51
|
+
@log = Facter::Log.new(self)
|
46
52
|
end
|
47
53
|
|
48
54
|
# Adds a new {Facter::Util::Resolution resolution}. This requires a
|
@@ -55,7 +61,11 @@ module Facter
|
|
55
61
|
#
|
56
62
|
# @api private
|
57
63
|
def add(options = {}, &block)
|
58
|
-
@options =
|
64
|
+
@options = @options.merge(options)
|
65
|
+
|
66
|
+
@location = options[:file]
|
67
|
+
@location ||= block.source_location if block_given?
|
68
|
+
|
59
69
|
define_resolution(nil, options, &block)
|
60
70
|
end
|
61
71
|
|
@@ -173,7 +183,24 @@ module Facter
|
|
173
183
|
end
|
174
184
|
|
175
185
|
def sort_by_weight(resolutions)
|
176
|
-
|
186
|
+
# sort resolutions:
|
187
|
+
# - descending by weight
|
188
|
+
# - multiple facts have the same weight but different types, the :external fact take precedence
|
189
|
+
# - multiple facts with the same weight and type, the order is preserved.
|
190
|
+
# note: sort_by with index is slower than .sort
|
191
|
+
# we cannot use .sort because it is not stable: https://bugs.ruby-lang.org/issues/1089
|
192
|
+
# solution from: https://bugs.ruby-lang.org/issues/1089#note-10
|
193
|
+
|
194
|
+
# rubocop:disable Style/NestedTernaryOperator
|
195
|
+
idx = 0
|
196
|
+
resolutions.sort_by do |x|
|
197
|
+
[
|
198
|
+
-x.weight,
|
199
|
+
x.respond_to?(:fact_type) ? x.fact_type == :external ? 0 : 1 : 1,
|
200
|
+
idx += 1
|
201
|
+
]
|
202
|
+
end
|
203
|
+
# rubocop:enable Style/NestedTernaryOperator
|
177
204
|
end
|
178
205
|
|
179
206
|
def find_first_real_value(resolutions)
|
@@ -184,11 +211,20 @@ module Facter
|
|
184
211
|
break
|
185
212
|
end
|
186
213
|
@used_resolution_weight = resolve.weight
|
187
|
-
|
214
|
+
next if value.nil?
|
215
|
+
|
216
|
+
log_fact_path(resolve)
|
217
|
+
|
218
|
+
return value
|
188
219
|
end
|
189
220
|
nil
|
190
221
|
end
|
191
222
|
|
223
|
+
def log_fact_path(resolve)
|
224
|
+
fact = resolve.fact
|
225
|
+
@log.debug("#{resolve.fact_type} fact #{fact.name} got resolved from: #{fact.location}")
|
226
|
+
end
|
227
|
+
|
192
228
|
def announce_when_no_suitable_resolution(resolutions)
|
193
229
|
return unless resolutions.empty?
|
194
230
|
|