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
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facter
|
4
|
+
module Resolvers
|
5
|
+
module Aix
|
6
|
+
module FFI
|
7
|
+
class SockaddrDl < ::FFI::Struct
|
8
|
+
layout :sdl_len, :uchar,
|
9
|
+
:sdl_family, :uchar,
|
10
|
+
:sdl_index, :ushort,
|
11
|
+
:sdl_type, :uchar,
|
12
|
+
:sdl_nlen, :uchar,
|
13
|
+
:sdl_alen, :uchar,
|
14
|
+
:sdl_slen, :uchar,
|
15
|
+
:sdl_data, [:char, 120]
|
16
|
+
end
|
17
|
+
|
18
|
+
class IfMsghdr < ::FFI::Struct
|
19
|
+
layout :ifm_msglen, :ushort,
|
20
|
+
:ifm_version, :uchar,
|
21
|
+
:ifm_type, :uchar,
|
22
|
+
:ifm_addrs, :int,
|
23
|
+
:ifm_flags, :int,
|
24
|
+
:ifm_index, :ushort,
|
25
|
+
:ifm_addrlen, :uchar
|
26
|
+
end
|
27
|
+
|
28
|
+
class Sockaddr < ::FFI::Struct
|
29
|
+
layout :sa_len, :uchar,
|
30
|
+
:sa_family, :uchar,
|
31
|
+
:sa_data, [:char, 14]
|
32
|
+
end
|
33
|
+
|
34
|
+
class InAddr < ::FFI::Struct
|
35
|
+
layout :s_addr, :uint
|
36
|
+
end
|
37
|
+
|
38
|
+
class In6Addr < ::FFI::Struct
|
39
|
+
layout :u6_addr8, [:uchar, 16]
|
40
|
+
end
|
41
|
+
|
42
|
+
class SockaddrIn < ::FFI::Struct
|
43
|
+
layout :sin_len, :uchar,
|
44
|
+
:sin_family, :uchar,
|
45
|
+
:sin_port, :ushort,
|
46
|
+
:sin_addr, InAddr,
|
47
|
+
:sin_zero, [:uchar, 8]
|
48
|
+
end
|
49
|
+
|
50
|
+
class SockaddrIn6 < ::FFI::Struct
|
51
|
+
layout :sin6_len, :uchar,
|
52
|
+
:sin6_family, :uchar,
|
53
|
+
:sin6_port, :ushort,
|
54
|
+
:sin6_flowinfo, :uint,
|
55
|
+
:sin6_addr, In6Addr,
|
56
|
+
:sin6_scope_id, :uint
|
57
|
+
end
|
58
|
+
|
59
|
+
class SockaddrStorage < ::FFI::Struct
|
60
|
+
layout :ss_len, :uchar,
|
61
|
+
:ss_family, :uchar,
|
62
|
+
:ss_pad, [:char, 6],
|
63
|
+
:ss_align, :long_long,
|
64
|
+
:ss_pad2, [:char, 1264]
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -9,12 +9,12 @@ module Facter
|
|
9
9
|
class << self
|
10
10
|
private
|
11
11
|
|
12
|
-
def post_resolve(fact_name)
|
12
|
+
def post_resolve(fact_name, _options)
|
13
13
|
@fact_list.fetch(fact_name) { read_vtf_file(fact_name) }
|
14
14
|
end
|
15
15
|
|
16
16
|
def read_vtf_file(fact_name)
|
17
|
-
file_content = Util::FileHelper.safe_readlines('/etc/vfs')
|
17
|
+
file_content = Facter::Util::FileHelper.safe_readlines('/etc/vfs')
|
18
18
|
return if file_content.empty?
|
19
19
|
|
20
20
|
file_content = file_content.map do |line|
|
@@ -9,13 +9,13 @@ module Facter
|
|
9
9
|
class << self
|
10
10
|
private
|
11
11
|
|
12
|
-
def post_resolve(fact_name)
|
12
|
+
def post_resolve(fact_name, _options)
|
13
13
|
@fact_list.fetch(fact_name) { read_hardware(fact_name) }
|
14
14
|
end
|
15
15
|
|
16
16
|
def read_hardware(fact_name)
|
17
|
-
|
18
|
-
odmquery = Facter::ODMQuery.new
|
17
|
+
require 'facter/util/aix/odm_query'
|
18
|
+
odmquery = Facter::Util::Aix::ODMQuery.new
|
19
19
|
odmquery
|
20
20
|
.equals('name', 'sys0')
|
21
21
|
.equals('attribute', 'modelname')
|
@@ -9,14 +9,14 @@ module Facter
|
|
9
9
|
class << self
|
10
10
|
private
|
11
11
|
|
12
|
-
def post_resolve(fact_name)
|
12
|
+
def post_resolve(fact_name, _options)
|
13
13
|
@fact_list.fetch(fact_name) { read_load_averages(fact_name) }
|
14
14
|
end
|
15
15
|
|
16
16
|
def read_load_averages(fact_name)
|
17
17
|
require_relative 'ffi/ffi_helper'
|
18
18
|
@fact_list[:load_averages] = {}.tap do |h|
|
19
|
-
h['1m'], h['5m'], h['15m'] =
|
19
|
+
h['1m'], h['5m'], h['15m'] = FfiHelper.read_load_averages
|
20
20
|
end
|
21
21
|
|
22
22
|
@fact_list[fact_name]
|
@@ -10,7 +10,7 @@ module Facter
|
|
10
10
|
class << self
|
11
11
|
private
|
12
12
|
|
13
|
-
def post_resolve(fact_name)
|
13
|
+
def post_resolve(fact_name, _options)
|
14
14
|
@fact_list.fetch(fact_name) { execute_svmon(fact_name) }
|
15
15
|
end
|
16
16
|
|
@@ -44,7 +44,7 @@ module Facter
|
|
44
44
|
{ available_bytes: content[3].to_i * pagesize,
|
45
45
|
total_bytes: total,
|
46
46
|
used_bytes: used,
|
47
|
-
capacity: FilesystemHelper.compute_capacity(used, total) }
|
47
|
+
capacity: Facter::Util::Resolvers::FilesystemHelper.compute_capacity(used, total) }
|
48
48
|
end
|
49
49
|
|
50
50
|
def populate_swap(content, pagesize)
|
@@ -56,7 +56,7 @@ module Facter
|
|
56
56
|
{ available_bytes: total - used,
|
57
57
|
total_bytes: total,
|
58
58
|
used_bytes: used,
|
59
|
-
capacity: FilesystemHelper.compute_capacity(used, total) }
|
59
|
+
capacity: Facter::Util::Resolvers::FilesystemHelper.compute_capacity(used, total) }
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
@@ -11,7 +11,7 @@ module Facter
|
|
11
11
|
class << self
|
12
12
|
private
|
13
13
|
|
14
|
-
def post_resolve(fact_name)
|
14
|
+
def post_resolve(fact_name, _options)
|
15
15
|
@fact_list.fetch(fact_name) { read_mount(fact_name) }
|
16
16
|
end
|
17
17
|
|
@@ -53,13 +53,13 @@ module Facter
|
|
53
53
|
used_bytes = info[2]
|
54
54
|
size_bytes = info[1]
|
55
55
|
@fact_list[:mountpoints][info.last].merge!(
|
56
|
-
capacity: FilesystemHelper.compute_capacity(used_bytes, size_bytes),
|
56
|
+
capacity: Facter::Util::Resolvers::FilesystemHelper.compute_capacity(used_bytes, size_bytes),
|
57
57
|
available_bytes: available_bytes,
|
58
58
|
used_bytes: used_bytes,
|
59
59
|
size_bytes: size_bytes,
|
60
|
-
available:
|
61
|
-
used:
|
62
|
-
size:
|
60
|
+
available: Facter::Util::Facts::UnitConverter.bytes_to_human_readable(available_bytes),
|
61
|
+
used: Facter::Util::Facts::UnitConverter.bytes_to_human_readable(used_bytes),
|
62
|
+
size: Facter::Util::Facts::UnitConverter.bytes_to_human_readable(size_bytes)
|
63
63
|
)
|
64
64
|
end
|
65
65
|
end
|
@@ -9,7 +9,7 @@ module Facter
|
|
9
9
|
class << self
|
10
10
|
private
|
11
11
|
|
12
|
-
def post_resolve(fact_name)
|
12
|
+
def post_resolve(fact_name, _options)
|
13
13
|
@fact_list.fetch(fact_name) { read_netstat(fact_name) }
|
14
14
|
end
|
15
15
|
|
@@ -17,39 +17,27 @@ module Facter
|
|
17
17
|
@fact_list[:interfaces] = {}
|
18
18
|
output = Facter::Core::Execution.execute('netstat -rn', logger: log)
|
19
19
|
output = output.each_line.select { |line| (line =~ /\s\s[0-9]+.[0-9]+.[0-9]+.[0-9]+|\s\s.*:[0-9a-f]+/) }
|
20
|
-
|
20
|
+
@fact_list[:interfaces] = load_interfaces
|
21
21
|
|
22
22
|
populate_with_mtu_and_mac!(@fact_list[:interfaces])
|
23
23
|
get_primary_interface_info(output)
|
24
|
-
::Resolvers::
|
24
|
+
Facter::Util::Resolvers::Networking.expand_main_bindings(@fact_list)
|
25
25
|
@fact_list[fact_name]
|
26
26
|
end
|
27
27
|
|
28
28
|
def get_primary_interface_info(output)
|
29
|
-
primary_interface_info = output.find { |line| line =~
|
29
|
+
primary_interface_info = output.find { |line| line =~ /default/ }&.split(' ')
|
30
30
|
@fact_list[:primary_interface] = primary_interface_info[5] if primary_interface_info
|
31
31
|
end
|
32
32
|
|
33
|
-
def extract_interfaces(netstat_output)
|
34
|
-
netstat_output.each do |line|
|
35
|
-
next if line =~ /default/
|
36
|
-
|
37
|
-
info = line.split("\s")
|
38
|
-
mask_length = info[0].match(%r{/([0-9]+)|%([0-9]+)})
|
39
|
-
next unless mask_length
|
40
|
-
|
41
|
-
is_ipv4 = info[1] =~ /[0-9]+.[0-9]+.[0-9]+.[0-9]+/
|
42
|
-
build_bindings(info[5], info[1], mask_length[1] || mask_length[2], is_ipv4)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
33
|
def build_bindings(name, ip, mask_length, is_ipv4)
|
47
34
|
bind_to_add = is_ipv4 ? :bindings : :bindings6
|
48
35
|
ip = ip.gsub(/%[0-9]$/, '') # remove mask information if it exists
|
49
36
|
mask_length = mask_length.to_i - 1 unless is_ipv4
|
50
37
|
@fact_list[:interfaces][name] ||= {}
|
51
38
|
@fact_list[:interfaces][name][bind_to_add] ||= []
|
52
|
-
@fact_list[:interfaces][name][bind_to_add] << ::Resolvers::
|
39
|
+
@fact_list[:interfaces][name][bind_to_add] << Facter::Util::Resolvers::Networking
|
40
|
+
.build_binding(ip, mask_length)
|
53
41
|
end
|
54
42
|
|
55
43
|
def populate_with_mtu_and_mac!(interfaces)
|
@@ -68,6 +56,12 @@ module Facter
|
|
68
56
|
def format_mac_address(address)
|
69
57
|
address.split('.').map { |e| format('%<mac_address>02s', mac_address: e) }.join(':').tr(' ', '0')
|
70
58
|
end
|
59
|
+
|
60
|
+
def load_interfaces
|
61
|
+
require_relative 'ffi/ffi_helper'
|
62
|
+
|
63
|
+
FfiHelper.read_interfaces
|
64
|
+
end
|
71
65
|
end
|
72
66
|
end
|
73
67
|
end
|
@@ -9,12 +9,12 @@ module Facter
|
|
9
9
|
class << self
|
10
10
|
private
|
11
11
|
|
12
|
-
def post_resolve(fact_name)
|
12
|
+
def post_resolve(fact_name, _options)
|
13
13
|
@fact_list.fetch(fact_name) { query_cudv(fact_name) }
|
14
14
|
end
|
15
15
|
|
16
16
|
def query_cudv(fact_name)
|
17
|
-
odmquery = Facter::ODMQuery.new
|
17
|
+
odmquery = Facter::Util::Aix::ODMQuery.new
|
18
18
|
odmquery.equals('PdDvLn', 'logical_volume/lvsubclass/lvtype')
|
19
19
|
|
20
20
|
result = odmquery.execute
|
@@ -40,13 +40,13 @@ module Facter
|
|
40
40
|
|
41
41
|
return if stdout.empty?
|
42
42
|
|
43
|
-
info_hash = InfoExtractor.extract(stdout, /PPs:|PP SIZE|TYPE:|LABEL:|MOUNT/)
|
43
|
+
info_hash = Facter::Util::Aix::InfoExtractor.extract(stdout, /PPs:|PP SIZE|TYPE:|LABEL:|MOUNT/)
|
44
44
|
size_bytes = compute_size(info_hash)
|
45
45
|
|
46
46
|
part_info = {
|
47
47
|
filesystem: info_hash['TYPE'],
|
48
48
|
size_bytes: size_bytes,
|
49
|
-
size: Facter::
|
49
|
+
size: Facter::Util::Facts::UnitConverter.bytes_to_human_readable(size_bytes)
|
50
50
|
}
|
51
51
|
mount = info_hash['MOUNT POINT']
|
52
52
|
label = info_hash['LABEL']
|
@@ -59,9 +59,9 @@ module Facter
|
|
59
59
|
physical_partitions = info_hash['PPs'].to_i
|
60
60
|
size_physical_partition = info_hash['PP SIZE']
|
61
61
|
exp = if size_physical_partition[/mega/]
|
62
|
-
InfoExtractor::MEGABYTES_EXPONENT
|
62
|
+
Facter::Util::Aix::InfoExtractor::MEGABYTES_EXPONENT
|
63
63
|
else
|
64
|
-
InfoExtractor::GIGABYTES_EXPONENT
|
64
|
+
Facter::Util::Aix::InfoExtractor::GIGABYTES_EXPONENT
|
65
65
|
end
|
66
66
|
size_physical_partition.to_i * physical_partitions * exp
|
67
67
|
end
|
@@ -9,7 +9,7 @@ module Facter
|
|
9
9
|
class << self
|
10
10
|
private
|
11
11
|
|
12
|
-
def post_resolve(fact_name)
|
12
|
+
def post_resolve(fact_name, _options)
|
13
13
|
@fact_list.fetch(fact_name) { query_pddv(fact_name) }
|
14
14
|
end
|
15
15
|
|
@@ -17,7 +17,7 @@ module Facter
|
|
17
17
|
@fact_list[:models] = []
|
18
18
|
@fact_list[:logical_count] = 0
|
19
19
|
|
20
|
-
odmquery = Facter::ODMQuery.new
|
20
|
+
odmquery = Facter::Util::Aix::ODMQuery.new
|
21
21
|
odmquery.equals('class', 'processor')
|
22
22
|
|
23
23
|
result = odmquery.execute
|
@@ -32,7 +32,7 @@ module Facter
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def populate_from_cudv(name)
|
35
|
-
odmquery = Facter::ODMQuery.new
|
35
|
+
odmquery = Facter::Util::Aix::ODMQuery.new
|
36
36
|
odmquery.equals('PdDvLn', name)
|
37
37
|
|
38
38
|
result = odmquery.execute
|
@@ -45,7 +45,7 @@ module Facter
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def query_cuat(name)
|
48
|
-
odmquery = Facter::ODMQuery.new
|
48
|
+
odmquery = Facter::Util::Aix::ODMQuery.new
|
49
49
|
odmquery.equals('name', name)
|
50
50
|
|
51
51
|
result = odmquery.execute
|
@@ -9,12 +9,12 @@ module Facter
|
|
9
9
|
class << self
|
10
10
|
private
|
11
11
|
|
12
|
-
def post_resolve(fact_name)
|
12
|
+
def post_resolve(fact_name, _options)
|
13
13
|
@fact_list.fetch(fact_name) { read_serialnumber(fact_name) }
|
14
14
|
end
|
15
15
|
|
16
16
|
def read_serialnumber(fact_name)
|
17
|
-
odmquery = Facter::ODMQuery.new
|
17
|
+
odmquery = Facter::Util::Aix::ODMQuery.new
|
18
18
|
odmquery
|
19
19
|
.equals('name', 'sys0')
|
20
20
|
.equals('attribute', 'systemid')
|
@@ -20,13 +20,16 @@ module Facter
|
|
20
20
|
Facter::SessionCache.subscribe(self)
|
21
21
|
end
|
22
22
|
|
23
|
-
def self.resolve(fact_name)
|
23
|
+
def self.resolve(fact_name, options = {})
|
24
24
|
@semaphore.synchronize do
|
25
25
|
subscribe_to_manager
|
26
|
-
post_resolve(fact_name)
|
26
|
+
post_resolve(fact_name, options)
|
27
27
|
|
28
28
|
cache_nil_for_unresolved_facts(fact_name)
|
29
29
|
end
|
30
|
+
rescue NoMethodError => e
|
31
|
+
log.debug("Could not resolve #{fact_name}, got #{e}")
|
32
|
+
@fact_list[fact_name] = nil
|
30
33
|
rescue LoadError, NameError => e
|
31
34
|
log.debug("resolving fact #{fact_name}, but #{e}")
|
32
35
|
@fact_list[fact_name] = nil
|
@@ -37,8 +40,8 @@ module Facter
|
|
37
40
|
@fact_list[fact_name]
|
38
41
|
end
|
39
42
|
|
40
|
-
def self.post_resolve(_fact_name)
|
41
|
-
raise NotImplementedError, "You must implement post_resolve(fact_name) method in #{name}"
|
43
|
+
def self.post_resolve(_fact_name, _options)
|
44
|
+
raise NotImplementedError, "You must implement post_resolve(fact_name, options) method in #{name}"
|
42
45
|
end
|
43
46
|
end
|
44
47
|
end
|
@@ -10,7 +10,7 @@ module Facter
|
|
10
10
|
class << self
|
11
11
|
private
|
12
12
|
|
13
|
-
def post_resolve(fact_name)
|
13
|
+
def post_resolve(fact_name, _options)
|
14
14
|
@fact_list.fetch(fact_name) { detect_azure(fact_name) }
|
15
15
|
end
|
16
16
|
|
@@ -23,7 +23,7 @@ module Facter
|
|
23
23
|
files.select! { |filename| filename =~ /^dhclient.*lease.*$/ }
|
24
24
|
files.each do |file|
|
25
25
|
path = File.join([path, file])
|
26
|
-
output = Util::FileHelper.safe_read(path)
|
26
|
+
output = Facter::Util::FileHelper.safe_read(path)
|
27
27
|
|
28
28
|
if output.include?('option unknown-245') || output.include?('option 245')
|
29
29
|
@fact_list[:cloud_provider] = 'azure'
|
@@ -13,13 +13,13 @@ module Facter
|
|
13
13
|
class << self
|
14
14
|
private
|
15
15
|
|
16
|
-
def post_resolve(fact_name)
|
16
|
+
def post_resolve(fact_name, _options)
|
17
17
|
@fact_list.fetch(fact_name) { read_cgroup(fact_name) }
|
18
18
|
end
|
19
19
|
|
20
20
|
def read_cgroup(fact_name)
|
21
|
-
output_cgroup = Util::FileHelper.safe_read('/proc/1/cgroup', nil)
|
22
|
-
output_environ = Util::FileHelper.safe_read('/proc/1/environ', nil)
|
21
|
+
output_cgroup = Facter::Util::FileHelper.safe_read('/proc/1/cgroup', nil)
|
22
|
+
output_environ = Facter::Util::FileHelper.safe_read('/proc/1/environ', nil)
|
23
23
|
return unless output_cgroup && output_environ
|
24
24
|
|
25
25
|
output_docker = %r{docker/(.+)}.match(output_cgroup)
|
@@ -49,7 +49,7 @@ module Facter
|
|
49
49
|
nspawn = /container=systemd-nspawn/ =~ output_environ
|
50
50
|
if nspawn
|
51
51
|
vm = 'systemd_nspawn'
|
52
|
-
info = Util::FileHelper.safe_read('/etc/machine-id', nil)
|
52
|
+
info = Facter::Util::FileHelper.safe_read('/etc/machine-id', nil)
|
53
53
|
end
|
54
54
|
[info ? { 'id' => info.strip } : {}, vm]
|
55
55
|
end
|