facter 4.0.43 → 4.0.49
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 +65 -9
- data/lib/facter/config.rb +385 -0
- data/lib/facter/custom_facts/core/aggregate.rb +7 -0
- data/lib/facter/custom_facts/core/execution.rb +28 -4
- data/lib/facter/custom_facts/core/execution/base.rb +33 -33
- 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 +39 -3
- data/lib/facter/custom_facts/util/loader.rb +1 -1
- data/lib/facter/custom_facts/util/parser.rb +17 -3
- 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/bsd/processors/speed.rb +1 -1
- 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/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/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/rhel/os/release.rb +1 -1
- data/lib/facter/facts/solaris/dhcp_servers.rb +1 -0
- data/lib/facter/facts/solaris/disks.rb +1 -1
- data/lib/facter/facts/solaris/hypervisors/ldom.rb +3 -0
- 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 +34 -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/benchmarking/timer.rb +4 -2
- data/lib/facter/framework/cli/cli.rb +20 -6
- data/lib/facter/framework/config/fact_groups.rb +10 -8
- data/lib/facter/framework/core/cache_manager.rb +62 -17
- data/lib/facter/framework/core/fact/internal/core_fact.rb +6 -1
- data/lib/facter/framework/core/fact/internal/internal_fact_manager.rb +38 -4
- data/lib/facter/framework/core/fact_augmenter.rb +1 -1
- data/lib/facter/framework/core/fact_loaders/external_fact_loader.rb +4 -2
- data/lib/facter/framework/core/fact_loaders/fact_loader.rb +17 -1
- data/lib/facter/framework/core/fact_manager.rb +15 -3
- data/lib/facter/framework/core/file_loader.rb +6 -2
- data/lib/facter/framework/core/options/config_file_options.rb +16 -5
- data/lib/facter/framework/core/options/option_store.rb +42 -20
- data/lib/facter/framework/detector/os_detector.rb +1 -0
- data/lib/facter/framework/detector/os_hierarchy.rb +5 -9
- data/lib/facter/framework/logging/logger.rb +3 -3
- 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} +19 -4
- data/lib/facter/resolvers/aix/disks.rb +6 -5
- data/lib/facter/resolvers/aix/{filesystem_resolver.rb → filesystem.rb} +2 -2
- data/lib/facter/resolvers/aix/{hardware_resolver.rb → hardware.rb} +4 -3
- data/lib/facter/resolvers/aix/{load_averages_resolver.rb → load_averages.rb} +2 -1
- data/lib/facter/resolvers/aix/memory.rb +4 -3
- data/lib/facter/resolvers/aix/mountpoints.rb +6 -5
- data/lib/facter/resolvers/aix/{networking_resolver.rb → networking.rb} +4 -3
- 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 +7 -6
- data/lib/facter/resolvers/aix/processors.rb +5 -4
- data/lib/facter/resolvers/aix/serialnumber.rb +2 -2
- data/lib/facter/resolvers/{augeas_resolver.rb → augeas.rb} +8 -2
- data/lib/facter/resolvers/base_resolver.rb +14 -4
- data/lib/facter/resolvers/bsd/processors.rb +13 -8
- data/lib/facter/resolvers/cloud.rb +2 -2
- data/lib/facter/resolvers/containers.rb +5 -4
- data/lib/facter/resolvers/debian_version.rb +2 -2
- data/lib/facter/resolvers/{disk_resolver.rb → disk.rb} +17 -6
- data/lib/facter/resolvers/{dmi_resolver.rb → dmi.rb} +3 -2
- data/lib/facter/resolvers/dmi_decode.rb +1 -1
- data/lib/facter/resolvers/ec2.rb +5 -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} +5 -2
- data/lib/facter/resolvers/{fips_enabled_resolver.rb → fips_enabled.rb} +5 -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} +9 -7
- data/lib/facter/resolvers/freebsd/{geom_resolver.rb → geom.rb} +15 -22
- data/lib/facter/resolvers/freebsd/processors.rb +13 -8
- data/lib/facter/resolvers/freebsd/{swap_memory_resolver.rb → swap_memory.rb} +5 -3
- data/lib/facter/resolvers/freebsd/{system_memory_resolver.rb → system_memory.rb} +4 -2
- data/lib/facter/resolvers/freebsd/virtual.rb +45 -0
- data/lib/facter/resolvers/gce.rb +3 -2
- data/lib/facter/resolvers/hostname.rb +92 -0
- data/lib/facter/resolvers/{identity_resolver.rb → identity.rb} +2 -1
- data/lib/facter/resolvers/linux/docker_uptime.rb +3 -2
- data/lib/facter/resolvers/linux/load_averages.rb +3 -2
- data/lib/facter/resolvers/load_averages.rb +5 -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} +2 -1
- data/lib/facter/resolvers/macosx/{mountpoints_resolver.rb → mountpoints.rb} +9 -8
- data/lib/facter/resolvers/macosx/{processor_resolver.rb → processor.rb} +2 -1
- data/lib/facter/resolvers/macosx/{swap_memory_resolver.rb → swap_memory.rb} +2 -1
- data/lib/facter/resolvers/macosx/{system_memory_resolver.rb → system_memory.rb} +2 -1
- data/lib/facter/resolvers/macosx/{system_profiler_resolver.rb → system_profiler.rb} +4 -6
- data/lib/facter/resolvers/{memory_resolver.rb → memory.rb} +4 -2
- data/lib/facter/resolvers/mountpoints.rb +90 -0
- 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 +67 -63
- data/lib/facter/resolvers/{path_resolver.rb → path.rb} +1 -1
- data/lib/facter/resolvers/{processors_resolver.rb → processors.rb} +6 -3
- data/lib/facter/resolvers/{redhat_release_resolver.rb → redhat_release.rb} +2 -2
- 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 +3 -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 +2 -1
- data/lib/facter/resolvers/solaris/ldom.rb +1 -3
- data/lib/facter/resolvers/solaris/memory.rb +4 -3
- data/lib/facter/resolvers/solaris/mountpoints.rb +13 -12
- data/lib/facter/resolvers/solaris/networking.rb +50 -43
- data/lib/facter/resolvers/solaris/os_release.rb +7 -5
- data/lib/facter/resolvers/solaris/processors.rb +2 -1
- data/lib/facter/resolvers/solaris/zone.rb +1 -1
- data/lib/facter/resolvers/solaris/zone_name.rb +1 -1
- data/lib/facter/resolvers/{ssh_resolver.rb → ssh.rb} +12 -8
- data/lib/facter/resolvers/{suse_release_resolver.rb → suse_release.rb} +2 -2
- data/lib/facter/resolvers/{sw_vers_resolver.rb → sw_vers.rb} +2 -2
- 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/{fips_resolver.rb → fips.rb} +2 -1
- data/lib/facter/resolvers/windows/{hardware_architecture_resolver.rb → hardware_architecture.rb} +2 -1
- data/lib/facter/resolvers/windows/{identity_resolver.rb → identity.rb} +2 -1
- data/lib/facter/resolvers/windows/{kernel_resolver.rb → kernel.rb} +3 -1
- data/lib/facter/resolvers/windows/{memory_resolver.rb → memory.rb} +7 -1
- data/lib/facter/resolvers/windows/{netkvm_resolver.rb → netkvm.rb} +2 -1
- data/lib/facter/resolvers/windows/{networking_resolver.rb → networking.rb} +18 -4
- data/lib/facter/resolvers/windows/{processors_resolver.rb → processors.rb} +3 -2
- data/lib/facter/resolvers/windows/{product_release_resolver.rb → product_release.rb} +2 -1
- data/lib/facter/resolvers/windows/ssh.rb +5 -3
- data/lib/facter/resolvers/windows/{system32_resolver.rb → system32.rb} +3 -1
- data/lib/facter/resolvers/windows/{uptime_resolver.rb → uptime.rb} +3 -2
- data/lib/facter/resolvers/windows/{virtualization_resolver.rb → virtualization.rb} +3 -2
- data/lib/facter/resolvers/windows/{win_os_description_resolver.rb → win_os_description.rb} +4 -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 +2 -1
- data/lib/facter/resolvers/zpool.rb +2 -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 +30 -0
- data/lib/facter/util/facts/unit_converter.rb +61 -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 -0
- data/lib/facter/util/windows/win32ole.rb +30 -0
- data/lib/facter/version.rb +1 -1
- metadata +106 -119
- data/lib/facter/fact_groups.conf +0 -308
- 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/os_hierarchy.json +0 -36
- 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 -44
- data/lib/facter/resolvers/mountpoints_resolver.rb +0 -62
- data/lib/facter/resolvers/networking_linux_resolver.rb +0 -159
- 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 -86
- 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
@@ -4,7 +4,8 @@ module Facter
|
|
4
4
|
module Resolvers
|
5
5
|
module Aix
|
6
6
|
class Disks < BaseResolver
|
7
|
-
|
7
|
+
init_resolver
|
8
|
+
|
8
9
|
class << self
|
9
10
|
private
|
10
11
|
|
@@ -33,7 +34,7 @@ module Facter
|
|
33
34
|
|
34
35
|
return if stdout.empty?
|
35
36
|
|
36
|
-
info_size = InfoExtractor.extract(stdout, /PP SIZE:|TOTAL PPs:|FREE PPs:|PV STATE:/)
|
37
|
+
info_size = Facter::Util::Aix::InfoExtractor.extract(stdout, /PP SIZE:|TOTAL PPs:|FREE PPs:|PV STATE:/)
|
37
38
|
|
38
39
|
return unless info_size['PV STATE']
|
39
40
|
|
@@ -41,7 +42,7 @@ module Facter
|
|
41
42
|
|
42
43
|
{
|
43
44
|
size_bytes: size_bytes,
|
44
|
-
size: Facter::
|
45
|
+
size: Facter::Util::Facts::UnitConverter.bytes_to_human_readable(size_bytes)
|
45
46
|
}
|
46
47
|
end
|
47
48
|
|
@@ -49,9 +50,9 @@ module Facter
|
|
49
50
|
physical_partitions = size_hash['TOTAL PPs'].to_i + size_hash['FREE PPs'].to_i
|
50
51
|
size_physical_partition = size_hash['PP SIZE']
|
51
52
|
exp = if size_physical_partition[/mega/]
|
52
|
-
InfoExtractor::MEGABYTES_EXPONENT
|
53
|
+
Facter::Util::Aix::InfoExtractor::MEGABYTES_EXPONENT
|
53
54
|
else
|
54
|
-
InfoExtractor::GIGABYTES_EXPONENT
|
55
|
+
Facter::Util::Aix::InfoExtractor::GIGABYTES_EXPONENT
|
55
56
|
end
|
56
57
|
size_physical_partition.to_i * physical_partitions * exp
|
57
58
|
end
|
@@ -4,7 +4,7 @@ module Facter
|
|
4
4
|
module Resolvers
|
5
5
|
module Aix
|
6
6
|
class Filesystem < BaseResolver
|
7
|
-
|
7
|
+
init_resolver
|
8
8
|
|
9
9
|
class << self
|
10
10
|
private
|
@@ -14,7 +14,7 @@ module Facter
|
|
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|
|
@@ -4,7 +4,8 @@ module Facter
|
|
4
4
|
module Resolvers
|
5
5
|
class Hardware < BaseResolver
|
6
6
|
# :hardware
|
7
|
-
|
7
|
+
init_resolver
|
8
|
+
|
8
9
|
class << self
|
9
10
|
private
|
10
11
|
|
@@ -13,8 +14,8 @@ module Facter
|
|
13
14
|
end
|
14
15
|
|
15
16
|
def read_hardware(fact_name)
|
16
|
-
|
17
|
-
odmquery = Facter::ODMQuery.new
|
17
|
+
require 'facter/util/aix/odm_query'
|
18
|
+
odmquery = Facter::Util::Aix::ODMQuery.new
|
18
19
|
odmquery
|
19
20
|
.equals('name', 'sys0')
|
20
21
|
.equals('attribute', 'modelname')
|
@@ -4,8 +4,9 @@ module Facter
|
|
4
4
|
module Resolvers
|
5
5
|
module Aix
|
6
6
|
class Memory < BaseResolver
|
7
|
+
init_resolver
|
7
8
|
# :hardware
|
8
|
-
|
9
|
+
|
9
10
|
class << self
|
10
11
|
private
|
11
12
|
|
@@ -43,7 +44,7 @@ module Facter
|
|
43
44
|
{ available_bytes: content[3].to_i * pagesize,
|
44
45
|
total_bytes: total,
|
45
46
|
used_bytes: used,
|
46
|
-
capacity: FilesystemHelper.compute_capacity(used, total) }
|
47
|
+
capacity: Facter::Util::Resolvers::FilesystemHelper.compute_capacity(used, total) }
|
47
48
|
end
|
48
49
|
|
49
50
|
def populate_swap(content, pagesize)
|
@@ -55,7 +56,7 @@ module Facter
|
|
55
56
|
{ available_bytes: total - used,
|
56
57
|
total_bytes: total,
|
57
58
|
used_bytes: used,
|
58
|
-
capacity: FilesystemHelper.compute_capacity(used, total) }
|
59
|
+
capacity: Facter::Util::Resolvers::FilesystemHelper.compute_capacity(used, total) }
|
59
60
|
end
|
60
61
|
end
|
61
62
|
end
|
@@ -4,7 +4,8 @@ module Facter
|
|
4
4
|
module Resolvers
|
5
5
|
module Aix
|
6
6
|
class Mountpoints < BaseResolver
|
7
|
-
|
7
|
+
init_resolver
|
8
|
+
|
8
9
|
BLOCK_SIZE = 512
|
9
10
|
|
10
11
|
class << self
|
@@ -52,13 +53,13 @@ module Facter
|
|
52
53
|
used_bytes = info[2]
|
53
54
|
size_bytes = info[1]
|
54
55
|
@fact_list[:mountpoints][info.last].merge!(
|
55
|
-
capacity: FilesystemHelper.compute_capacity(used_bytes, size_bytes),
|
56
|
+
capacity: Facter::Util::Resolvers::FilesystemHelper.compute_capacity(used_bytes, size_bytes),
|
56
57
|
available_bytes: available_bytes,
|
57
58
|
used_bytes: used_bytes,
|
58
59
|
size_bytes: size_bytes,
|
59
|
-
available:
|
60
|
-
used:
|
61
|
-
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)
|
62
63
|
)
|
63
64
|
end
|
64
65
|
end
|
@@ -4,7 +4,7 @@ module Facter
|
|
4
4
|
module Resolvers
|
5
5
|
module Aix
|
6
6
|
class Networking < BaseResolver
|
7
|
-
|
7
|
+
init_resolver
|
8
8
|
|
9
9
|
class << self
|
10
10
|
private
|
@@ -21,7 +21,7 @@ module Facter
|
|
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
|
|
@@ -49,7 +49,8 @@ module Facter
|
|
49
49
|
mask_length = mask_length.to_i - 1 unless is_ipv4
|
50
50
|
@fact_list[:interfaces][name] ||= {}
|
51
51
|
@fact_list[:interfaces][name][bind_to_add] ||= []
|
52
|
-
@fact_list[:interfaces][name][bind_to_add] << ::Resolvers::
|
52
|
+
@fact_list[:interfaces][name][bind_to_add] << Facter::Util::Resolvers::Networking
|
53
|
+
.build_binding(ip, mask_length)
|
53
54
|
end
|
54
55
|
|
55
56
|
def populate_with_mtu_and_mac!(interfaces)
|
@@ -4,7 +4,8 @@ module Facter
|
|
4
4
|
module Resolvers
|
5
5
|
module Aix
|
6
6
|
class Partitions < BaseResolver
|
7
|
-
|
7
|
+
init_resolver
|
8
|
+
|
8
9
|
class << self
|
9
10
|
private
|
10
11
|
|
@@ -13,7 +14,7 @@ module Facter
|
|
13
14
|
end
|
14
15
|
|
15
16
|
def query_cudv(fact_name)
|
16
|
-
odmquery = Facter::ODMQuery.new
|
17
|
+
odmquery = Facter::Util::Aix::ODMQuery.new
|
17
18
|
odmquery.equals('PdDvLn', 'logical_volume/lvsubclass/lvtype')
|
18
19
|
|
19
20
|
result = odmquery.execute
|
@@ -39,13 +40,13 @@ module Facter
|
|
39
40
|
|
40
41
|
return if stdout.empty?
|
41
42
|
|
42
|
-
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/)
|
43
44
|
size_bytes = compute_size(info_hash)
|
44
45
|
|
45
46
|
part_info = {
|
46
47
|
filesystem: info_hash['TYPE'],
|
47
48
|
size_bytes: size_bytes,
|
48
|
-
size: Facter::
|
49
|
+
size: Facter::Util::Facts::UnitConverter.bytes_to_human_readable(size_bytes)
|
49
50
|
}
|
50
51
|
mount = info_hash['MOUNT POINT']
|
51
52
|
label = info_hash['LABEL']
|
@@ -58,9 +59,9 @@ module Facter
|
|
58
59
|
physical_partitions = info_hash['PPs'].to_i
|
59
60
|
size_physical_partition = info_hash['PP SIZE']
|
60
61
|
exp = if size_physical_partition[/mega/]
|
61
|
-
InfoExtractor::MEGABYTES_EXPONENT
|
62
|
+
Facter::Util::Aix::InfoExtractor::MEGABYTES_EXPONENT
|
62
63
|
else
|
63
|
-
InfoExtractor::GIGABYTES_EXPONENT
|
64
|
+
Facter::Util::Aix::InfoExtractor::GIGABYTES_EXPONENT
|
64
65
|
end
|
65
66
|
size_physical_partition.to_i * physical_partitions * exp
|
66
67
|
end
|
@@ -4,7 +4,8 @@ module Facter
|
|
4
4
|
module Resolvers
|
5
5
|
module Aix
|
6
6
|
class Processors < BaseResolver
|
7
|
-
|
7
|
+
init_resolver
|
8
|
+
|
8
9
|
class << self
|
9
10
|
private
|
10
11
|
|
@@ -16,7 +17,7 @@ module Facter
|
|
16
17
|
@fact_list[:models] = []
|
17
18
|
@fact_list[:logical_count] = 0
|
18
19
|
|
19
|
-
odmquery = Facter::ODMQuery.new
|
20
|
+
odmquery = Facter::Util::Aix::ODMQuery.new
|
20
21
|
odmquery.equals('class', 'processor')
|
21
22
|
|
22
23
|
result = odmquery.execute
|
@@ -31,7 +32,7 @@ module Facter
|
|
31
32
|
end
|
32
33
|
|
33
34
|
def populate_from_cudv(name)
|
34
|
-
odmquery = Facter::ODMQuery.new
|
35
|
+
odmquery = Facter::Util::Aix::ODMQuery.new
|
35
36
|
odmquery.equals('PdDvLn', name)
|
36
37
|
|
37
38
|
result = odmquery.execute
|
@@ -44,7 +45,7 @@ module Facter
|
|
44
45
|
end
|
45
46
|
|
46
47
|
def query_cuat(name)
|
47
|
-
odmquery = Facter::ODMQuery.new
|
48
|
+
odmquery = Facter::Util::Aix::ODMQuery.new
|
48
49
|
odmquery.equals('name', name)
|
49
50
|
|
50
51
|
result = odmquery.execute
|
@@ -4,7 +4,7 @@ module Facter
|
|
4
4
|
module Resolvers
|
5
5
|
module Aix
|
6
6
|
class Serialnumber < BaseResolver
|
7
|
-
|
7
|
+
init_resolver
|
8
8
|
|
9
9
|
class << self
|
10
10
|
private
|
@@ -14,7 +14,7 @@ module Facter
|
|
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')
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Facter
|
4
4
|
module Resolvers
|
5
5
|
class Augeas < BaseResolver
|
6
|
-
|
6
|
+
init_resolver
|
7
7
|
|
8
8
|
class << self
|
9
9
|
private
|
@@ -20,7 +20,13 @@ module Facter
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def read_augeas_from_cli
|
23
|
-
|
23
|
+
command = if File.readable?('/opt/puppetlabs/puppet/bin/augparse')
|
24
|
+
'/opt/puppetlabs/puppet/bin/augparse'
|
25
|
+
else
|
26
|
+
'augparse'
|
27
|
+
end
|
28
|
+
|
29
|
+
output = Facter::Core::Execution.execute("#{command} --version 2>&1", logger: log)
|
24
30
|
Regexp.last_match(1) if output =~ /^augparse (\d+\.\d+\.\d+)/
|
25
31
|
end
|
26
32
|
|
@@ -11,21 +11,31 @@ module Facter
|
|
11
11
|
@fact_list = {}
|
12
12
|
end
|
13
13
|
|
14
|
+
def self.init_resolver
|
15
|
+
@fact_list = {}
|
16
|
+
@semaphore = Mutex.new
|
17
|
+
end
|
18
|
+
|
14
19
|
def self.subscribe_to_manager
|
15
20
|
Facter::SessionCache.subscribe(self)
|
16
21
|
end
|
17
22
|
|
18
23
|
def self.resolve(fact_name)
|
19
|
-
|
20
|
-
|
24
|
+
@semaphore.synchronize do
|
25
|
+
subscribe_to_manager
|
26
|
+
post_resolve(fact_name)
|
21
27
|
|
22
|
-
|
28
|
+
cache_nil_for_unresolved_facts(fact_name)
|
29
|
+
end
|
30
|
+
rescue NoMethodError => e
|
31
|
+
log.debug("Could not resolve #{fact_name}, got #{e}")
|
32
|
+
@fact_list[fact_name] = nil
|
23
33
|
rescue LoadError, NameError => e
|
24
34
|
log.debug("resolving fact #{fact_name}, but #{e}")
|
25
35
|
@fact_list[fact_name] = nil
|
26
36
|
end
|
27
37
|
|
28
|
-
def self.
|
38
|
+
def self.cache_nil_for_unresolved_facts(fact_name)
|
29
39
|
@fact_list.fetch(fact_name) { @fact_list[fact_name] = nil }
|
30
40
|
@fact_list[fact_name]
|
31
41
|
end
|
@@ -4,8 +4,9 @@ module Facter
|
|
4
4
|
module Resolvers
|
5
5
|
module Bsd
|
6
6
|
class Processors < BaseResolver
|
7
|
+
init_resolver
|
7
8
|
@log = Facter::Log.new(self)
|
8
|
-
|
9
|
+
|
9
10
|
class << self
|
10
11
|
private
|
11
12
|
|
@@ -16,8 +17,12 @@ module Facter
|
|
16
17
|
def collect_processors_info(fact_name)
|
17
18
|
require 'facter/resolvers/bsd/ffi/ffi_helper'
|
18
19
|
|
19
|
-
|
20
|
-
|
20
|
+
count = logical_count
|
21
|
+
model = processor_model
|
22
|
+
speed = processor_speed
|
23
|
+
|
24
|
+
@fact_list[:logical_count] = count
|
25
|
+
@fact_list[:models] = Array.new(count, model) if count && model
|
21
26
|
@fact_list[:speed] = speed * 1000 * 1000 if speed
|
22
27
|
|
23
28
|
@fact_list[fact_name]
|
@@ -28,16 +33,16 @@ module Facter
|
|
28
33
|
HW_NCPU = 3
|
29
34
|
HW_CPUSPEED = 12
|
30
35
|
|
31
|
-
def
|
32
|
-
|
36
|
+
def processor_model
|
37
|
+
Facter::Bsd::FfiHelper.sysctl(:string, [CTL_HW, HW_MODEL])
|
33
38
|
end
|
34
39
|
|
35
40
|
def logical_count
|
36
|
-
|
41
|
+
Facter::Bsd::FfiHelper.sysctl(:uint32_t, [CTL_HW, HW_NCPU])
|
37
42
|
end
|
38
43
|
|
39
|
-
def
|
40
|
-
|
44
|
+
def processor_speed
|
45
|
+
Facter::Bsd::FfiHelper.sysctl(:uint32_t, [CTL_HW, HW_CPUSPEED])
|
41
46
|
end
|
42
47
|
end
|
43
48
|
end
|
@@ -5,7 +5,7 @@ module Facter
|
|
5
5
|
class Cloud < BaseResolver
|
6
6
|
# cloud_provider
|
7
7
|
|
8
|
-
|
8
|
+
init_resolver
|
9
9
|
|
10
10
|
class << self
|
11
11
|
private
|
@@ -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'
|
@@ -6,7 +6,8 @@ module Facter
|
|
6
6
|
# :virtual
|
7
7
|
# :hypervisor
|
8
8
|
|
9
|
-
|
9
|
+
init_resolver
|
10
|
+
|
10
11
|
INFO = { 'docker' => 'id', 'lxc' => 'name' }.freeze
|
11
12
|
|
12
13
|
class << self
|
@@ -17,8 +18,8 @@ module Facter
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def read_cgroup(fact_name)
|
20
|
-
output_cgroup = Util::FileHelper.safe_read('/proc/1/cgroup', nil)
|
21
|
-
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)
|
22
23
|
return unless output_cgroup && output_environ
|
23
24
|
|
24
25
|
output_docker = %r{docker/(.+)}.match(output_cgroup)
|
@@ -48,7 +49,7 @@ module Facter
|
|
48
49
|
nspawn = /container=systemd-nspawn/ =~ output_environ
|
49
50
|
if nspawn
|
50
51
|
vm = 'systemd_nspawn'
|
51
|
-
info = Util::FileHelper.safe_read('/etc/machine-id', nil)
|
52
|
+
info = Facter::Util::FileHelper.safe_read('/etc/machine-id', nil)
|
52
53
|
end
|
53
54
|
[info ? { 'id' => info.strip } : {}, vm]
|
54
55
|
end
|