facter 4.0.31 → 4.0.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/facter/custom_facts/util/directory_loader.rb +13 -1
- data/lib/facter/fact_groups.conf +140 -1
- data/lib/facter/facts/aix/disks.rb +17 -2
- data/lib/facter/facts/aix/networking/scope6.rb +3 -1
- data/lib/facter/facts/aix/scope6_interfaces.rb +0 -2
- data/lib/facter/facts/aix/serialnumber.rb +20 -0
- data/lib/facter/facts/aix/ssh.rb +3 -1
- data/lib/facter/facts/aix/sshalgorithmkey.rb +17 -0
- data/lib/facter/facts/aix/sshfp_algorithm.rb +20 -0
- data/lib/facter/facts/bsd/load_averages.rb +1 -1
- data/lib/facter/facts/debian/os/distro/release.rb +6 -1
- data/lib/facter/facts/freebsd/augeas/version.rb +19 -0
- data/lib/facter/facts/freebsd/dmi/bios/release_date.rb +19 -0
- data/lib/facter/facts/freebsd/dmi/bios/vendor.rb +19 -0
- data/lib/facter/facts/freebsd/dmi/bios/version.rb +19 -0
- data/lib/facter/facts/freebsd/dmi/manufacturer.rb +17 -0
- data/lib/facter/facts/freebsd/dmi/product/name.rb +19 -0
- data/lib/facter/facts/freebsd/dmi/product/serial_number.rb +19 -0
- data/lib/facter/facts/freebsd/dmi/product/uuid.rb +19 -0
- data/lib/facter/facts/freebsd/facterversion.rb +14 -0
- data/lib/facter/facts/freebsd/identity/gid.rb +16 -0
- data/lib/facter/facts/{solaris/solaris_zones/current.rb → freebsd/identity/group.rb} +6 -6
- data/lib/facter/facts/freebsd/identity/privileged.rb +16 -0
- data/lib/facter/facts/freebsd/identity/uid.rb +16 -0
- data/lib/facter/facts/freebsd/identity/user.rb +17 -0
- data/lib/facter/facts/freebsd/kernel.rb +14 -0
- data/lib/facter/facts/freebsd/kernelrelease.rb +14 -0
- data/lib/facter/facts/freebsd/memory/swap/available.rb +21 -0
- data/lib/facter/facts/freebsd/memory/swap/available_bytes.rb +20 -0
- data/lib/facter/facts/freebsd/memory/swap/capacity.rb +18 -0
- data/lib/facter/facts/freebsd/memory/swap/encrypted.rb +19 -0
- data/lib/facter/facts/freebsd/memory/swap/total.rb +21 -0
- data/lib/facter/facts/freebsd/memory/swap/total_bytes.rb +20 -0
- data/lib/facter/facts/freebsd/memory/swap/used.rb +20 -0
- data/lib/facter/facts/freebsd/memory/swap/used_bytes.rb +18 -0
- data/lib/facter/facts/freebsd/memory/system/available.rb +21 -0
- data/lib/facter/facts/freebsd/memory/system/available_bytes.rb +20 -0
- data/lib/facter/facts/freebsd/memory/system/capacity.rb +18 -0
- data/lib/facter/facts/freebsd/memory/system/total.rb +21 -0
- data/lib/facter/facts/freebsd/memory/system/total_bytes.rb +20 -0
- data/lib/facter/facts/freebsd/memory/system/used.rb +20 -0
- data/lib/facter/facts/freebsd/memory/system/used_bytes.rb +18 -0
- data/lib/facter/facts/freebsd/mountpoints.rb +21 -0
- data/lib/facter/facts/freebsd/netmask6_interfaces.rb +20 -0
- data/lib/facter/facts/freebsd/netmask_interfaces.rb +20 -0
- data/lib/facter/facts/freebsd/network6_interfaces.rb +20 -0
- data/lib/facter/facts/freebsd/network_interfaces.rb +20 -0
- data/lib/facter/facts/freebsd/networking/dhcp.rb +17 -0
- data/lib/facter/facts/freebsd/networking/domain.rb +18 -0
- data/lib/facter/facts/freebsd/networking/fqdn.rb +18 -0
- data/lib/facter/facts/freebsd/networking/hostname.rb +18 -0
- data/lib/facter/facts/freebsd/networking/interfaces.rb +17 -0
- data/lib/facter/facts/freebsd/networking/ip.rb +18 -0
- data/lib/facter/facts/freebsd/networking/ip6.rb +18 -0
- data/lib/facter/facts/freebsd/networking/mac.rb +18 -0
- data/lib/facter/facts/freebsd/networking/mtu.rb +17 -0
- data/lib/facter/facts/freebsd/networking/netmask.rb +18 -0
- data/lib/facter/facts/freebsd/networking/netmask6.rb +18 -0
- data/lib/facter/facts/freebsd/networking/network.rb +18 -0
- data/lib/facter/facts/freebsd/networking/network6.rb +18 -0
- data/lib/facter/facts/freebsd/networking/primary.rb +17 -0
- data/lib/facter/facts/freebsd/networking/scope6.rb +17 -0
- data/lib/facter/facts/freebsd/os/architecture.rb +18 -0
- data/lib/facter/facts/freebsd/os/hardware.rb +18 -0
- data/lib/facter/facts/freebsd/os/name.rb +18 -0
- data/lib/facter/facts/{bsd/bsd_example_fact.rb → freebsd/path.rb} +5 -4
- data/lib/facter/facts/freebsd/processors/isa.rb +17 -0
- data/lib/facter/facts/freebsd/puppet_version.rb +15 -0
- data/lib/facter/facts/freebsd/ruby/platform.rb +18 -0
- data/lib/facter/facts/freebsd/ruby/sitedir.rb +18 -0
- data/lib/facter/facts/freebsd/ruby/version.rb +18 -0
- data/lib/facter/facts/freebsd/ssh.rb +26 -0
- data/lib/facter/facts/freebsd/sshalgorithmkey.rb +17 -0
- data/lib/facter/facts/freebsd/sshfp_algorithm.rb +20 -0
- data/lib/facter/facts/freebsd/system_uptime/days.rb +18 -0
- data/lib/facter/facts/freebsd/system_uptime/hours.rb +18 -0
- data/lib/facter/facts/freebsd/system_uptime/seconds.rb +18 -0
- data/lib/facter/facts/freebsd/system_uptime/uptime.rb +18 -0
- data/lib/facter/facts/freebsd/timezone.rb +15 -0
- data/lib/facter/facts/freebsd/zfs_featurenumbers.rb +14 -0
- data/lib/facter/facts/freebsd/zfs_version.rb +14 -0
- data/lib/facter/facts/freebsd/zpool_featureflags.rb +14 -0
- data/lib/facter/facts/freebsd/zpool_featurenumbers.rb +14 -0
- data/lib/facter/facts/freebsd/zpool_version.rb +14 -0
- data/lib/facter/facts/linux/disks.rb +20 -1
- data/lib/facter/facts/linux/dmi/board/asset_tag.rb +19 -0
- data/lib/facter/facts/linux/ec2_metadata.rb +5 -3
- data/lib/facter/facts/linux/ec2_userdata.rb +5 -3
- data/lib/facter/facts/linux/gce.rb +16 -0
- data/lib/facter/facts/linux/is_virtual.rb +1 -3
- data/lib/facter/facts/linux/mountpoints.rb +1 -1
- data/lib/facter/facts/linux/networking/scope6.rb +3 -1
- data/lib/facter/facts/linux/partitions.rb +1 -1
- data/lib/facter/facts/linux/processors/speed.rb +17 -0
- data/lib/facter/facts/linux/scope6_interfaces.rb +1 -2
- data/lib/facter/facts/linux/ssh.rb +19 -9
- data/lib/facter/facts/linux/sshfp_algorithm.rb +1 -1
- data/lib/facter/facts/linux/system_uptime/days.rb +7 -1
- data/lib/facter/facts/linux/system_uptime/hours.rb +7 -1
- data/lib/facter/facts/linux/system_uptime/seconds.rb +7 -1
- data/lib/facter/facts/linux/system_uptime/uptime.rb +7 -1
- data/lib/facter/facts/linux/virtual.rb +17 -0
- data/lib/facter/facts/linux/xen.rb +28 -0
- data/lib/facter/facts/macosx/dhcp_servers.rb +2 -2
- data/lib/facter/facts/macosx/interfaces.rb +1 -1
- data/lib/facter/facts/macosx/ipaddress6_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/ipaddress_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/macaddress_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/mtu_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/netmask6_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/netmask_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/network6_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/network_interfaces.rb +1 -1
- data/lib/facter/facts/macosx/networking/dhcp.rb +1 -1
- data/lib/facter/facts/macosx/networking/interfaces.rb +1 -1
- data/lib/facter/facts/macosx/networking/ip.rb +1 -1
- data/lib/facter/facts/macosx/networking/ip6.rb +1 -1
- data/lib/facter/facts/macosx/networking/mac.rb +1 -1
- data/lib/facter/facts/macosx/networking/mtu.rb +1 -1
- data/lib/facter/facts/macosx/networking/netmask.rb +1 -1
- data/lib/facter/facts/macosx/networking/netmask6.rb +1 -1
- data/lib/facter/facts/macosx/networking/network.rb +1 -1
- data/lib/facter/facts/macosx/networking/network6.rb +1 -1
- data/lib/facter/facts/macosx/networking/primary.rb +1 -1
- data/lib/facter/facts/macosx/networking/scope6.rb +4 -2
- data/lib/facter/facts/macosx/scope6_interfaces.rb +1 -3
- data/lib/facter/facts/macosx/ssh.rb +19 -11
- data/lib/facter/facts/macosx/sshfp_algorithm.rb +1 -1
- data/lib/facter/facts/macosx/virtual.rb +1 -1
- data/lib/facter/facts/solaris/current_zone.rb +16 -0
- data/lib/facter/facts/solaris/disks.rb +33 -0
- data/lib/facter/facts/solaris/dmi/bios/release_date.rb +24 -0
- data/lib/facter/facts/solaris/dmi/bios/vendor.rb +24 -0
- data/lib/facter/facts/solaris/dmi/bios/version.rb +24 -0
- data/lib/facter/facts/solaris/dmi/chassis/asset_tag.rb +24 -0
- data/lib/facter/facts/solaris/dmi/chassis/type.rb +24 -0
- data/lib/facter/facts/solaris/dmi/manufacturer.rb +25 -0
- data/lib/facter/facts/solaris/dmi/product/name.rb +27 -0
- data/lib/facter/facts/solaris/dmi/product/serial_number.rb +27 -0
- data/lib/facter/facts/solaris/dmi/product/uuid.rb +24 -0
- data/lib/facter/facts/solaris/hypervisors/ldom.rb +24 -0
- data/lib/facter/facts/solaris/hypervisors/zone.rb +39 -0
- data/lib/facter/facts/solaris/is_virtual.rb +64 -0
- data/lib/facter/facts/solaris/kernelmajversion.rb +1 -1
- data/lib/facter/facts/solaris/ldom.rb +35 -0
- data/lib/facter/facts/solaris/load_averages.rb +14 -0
- data/lib/facter/facts/solaris/memory/swap/available.rb +22 -0
- data/lib/facter/facts/solaris/memory/swap/available_bytes.rb +22 -0
- data/lib/facter/facts/solaris/memory/swap/capacity.rb +20 -0
- data/lib/facter/facts/solaris/memory/swap/total.rb +22 -0
- data/lib/facter/facts/solaris/memory/swap/total_bytes.rb +22 -0
- data/lib/facter/facts/solaris/memory/swap/used.rb +21 -0
- data/lib/facter/facts/solaris/memory/swap/used_bytes.rb +19 -0
- data/lib/facter/facts/solaris/memory/system/available.rb +22 -0
- data/lib/facter/facts/solaris/memory/system/available_bytes.rb +22 -0
- data/lib/facter/facts/solaris/memory/system/capacity.rb +20 -0
- data/lib/facter/facts/solaris/memory/system/total.rb +22 -0
- data/lib/facter/facts/solaris/memory/system/total_bytes.rb +22 -0
- data/lib/facter/facts/solaris/memory/system/used.rb +21 -0
- data/lib/facter/facts/solaris/memory/system/used_bytes.rb +19 -0
- data/lib/facter/facts/solaris/mountpoints.rb +1 -1
- data/lib/facter/facts/solaris/os/release.rb +3 -3
- data/lib/facter/facts/solaris/ssh.rb +19 -9
- data/lib/facter/facts/solaris/sshalgorithmkey.rb +17 -0
- data/lib/facter/facts/solaris/sshfp_algorithm.rb +20 -0
- data/lib/facter/facts/solaris/virtual.rb +60 -0
- data/lib/facter/facts/solaris/zfs_featurenumbers.rb +1 -1
- data/lib/facter/facts/solaris/zfs_version.rb +1 -1
- data/lib/facter/facts/solaris/zones.rb +60 -0
- data/lib/facter/facts/solaris/zpool_featureflags.rb +1 -1
- data/lib/facter/facts/solaris/zpool_featurenumbers.rb +1 -1
- data/lib/facter/facts/solaris/zpool_version.rb +1 -1
- data/lib/facter/facts/windows/dhcp_servers.rb +2 -2
- data/lib/facter/facts/windows/ec2_metadata.rb +5 -3
- data/lib/facter/facts/windows/ec2_userdata.rb +5 -3
- data/lib/facter/facts/windows/gce.rb +16 -0
- data/lib/facter/facts/windows/interfaces.rb +1 -1
- data/lib/facter/facts/windows/ipaddress6_interfaces.rb +1 -1
- data/lib/facter/facts/windows/ipaddress_interfaces.rb +1 -1
- data/lib/facter/facts/windows/macaddress_interfaces.rb +1 -1
- data/lib/facter/facts/windows/mtu_interfaces.rb +1 -1
- data/lib/facter/facts/windows/netmask6_interfaces.rb +1 -1
- data/lib/facter/facts/windows/netmask_interfaces.rb +1 -1
- data/lib/facter/facts/windows/network6_interfaces.rb +1 -1
- data/lib/facter/facts/windows/network_interfaces.rb +1 -1
- data/lib/facter/facts/windows/networking/dhcp.rb +1 -1
- data/lib/facter/facts/windows/networking/domain.rb +1 -1
- data/lib/facter/facts/windows/networking/fqdn.rb +1 -1
- data/lib/facter/facts/windows/networking/interfaces.rb +1 -1
- data/lib/facter/facts/windows/networking/ip.rb +1 -1
- data/lib/facter/facts/windows/networking/ip6.rb +1 -1
- data/lib/facter/facts/windows/networking/mac.rb +1 -1
- data/lib/facter/facts/windows/networking/mtu.rb +1 -1
- data/lib/facter/facts/windows/networking/netmask.rb +1 -1
- data/lib/facter/facts/windows/networking/netmask6.rb +1 -1
- data/lib/facter/facts/windows/networking/network.rb +1 -1
- data/lib/facter/facts/windows/networking/network6.rb +1 -1
- data/lib/facter/facts/windows/networking/primary.rb +1 -1
- data/lib/facter/facts/windows/networking/scope6.rb +4 -2
- data/lib/facter/facts/windows/scope6_interfaces.rb +1 -1
- data/lib/facter/facts/windows/sshalgorithmkey.rb +22 -0
- data/lib/facter/facts/windows/sshfp_algorithm.rb +25 -0
- data/lib/facter/facts_utils/facts_utils.rb +2 -0
- data/lib/facter/framework/cli/cli.rb +16 -4
- data/lib/facter/framework/config/fact_groups.rb +13 -0
- data/lib/facter/framework/core/fact/internal/core_fact.rb +2 -0
- data/lib/facter/framework/core/fact/internal/internal_fact_manager.rb +10 -25
- data/lib/facter/framework/core/fact_filter.rb +13 -0
- data/lib/facter/framework/core/fact_loaders/fact_loader.rb +24 -1
- data/lib/facter/framework/detector/os_detector.rb +5 -1
- data/lib/facter/framework/formatters/legacy_fact_formatter.rb +8 -1
- data/lib/facter/framework/formatters/yaml_fact_formatter.rb +1 -1
- data/lib/facter/os_hierarchy.json +6 -7
- data/lib/facter/resolvers/aix/serialnumber.rb +37 -0
- data/lib/facter/resolvers/augeas_resolver.rb +19 -2
- data/lib/facter/resolvers/base_resolver.rb +1 -1
- data/lib/facter/resolvers/bsd/ffi/ffi_helper.rb +0 -10
- data/lib/facter/resolvers/dmi_resolver.rb +4 -3
- data/lib/facter/resolvers/ec2.rb +4 -18
- data/lib/facter/resolvers/filesystems_resolver.rb +1 -1
- data/lib/facter/resolvers/freebsd/dmi_resolver.rb +38 -0
- data/lib/facter/resolvers/freebsd/ffi/ffi_helper.rb +19 -0
- data/lib/facter/resolvers/freebsd/swap_memory_resolver.rb +39 -0
- data/lib/facter/resolvers/freebsd/system_memory_resolver.rb +41 -0
- data/lib/facter/resolvers/gce.rb +54 -0
- data/lib/facter/resolvers/linux/docker_uptime.rb +45 -0
- data/lib/facter/resolvers/{load_averages_resolver.rb → linux/load_averages.rb} +0 -1
- data/lib/facter/resolvers/load_averages.rb +26 -0
- data/lib/facter/resolvers/lspci.rb +2 -0
- data/lib/facter/resolvers/memory_resolver.rb +8 -1
- data/lib/facter/resolvers/mountpoints_resolver.rb +42 -44
- data/lib/facter/resolvers/networking_linux_resolver.rb +16 -1
- data/lib/facter/resolvers/networking_resolver.rb +106 -0
- data/lib/facter/resolvers/os_release_resolver.rb +1 -1
- data/lib/facter/resolvers/processors_resolver.rb +24 -2
- data/lib/facter/resolvers/redhat_release_resolver.rb +4 -3
- data/lib/facter/resolvers/solaris/disks.rb +51 -0
- data/lib/facter/resolvers/solaris/dmi.rb +57 -0
- data/lib/facter/resolvers/solaris/dmi_sparc.rb +47 -0
- data/lib/facter/resolvers/solaris/ffi/ffi.rb +5 -0
- data/lib/facter/resolvers/solaris/{filesystems_resolver.rb → filesystems.rb} +0 -0
- data/lib/facter/resolvers/solaris/{ipaddress_resolver.rb → ipaddress.rb} +0 -0
- data/lib/facter/resolvers/solaris/ldom.rb +70 -0
- data/lib/facter/resolvers/solaris/memory.rb +93 -0
- data/lib/facter/resolvers/solaris/{networking_resolver.rb → networking.rb} +2 -6
- data/lib/facter/resolvers/solaris/os_release.rb +44 -0
- data/lib/facter/resolvers/solaris/zone.rb +51 -0
- data/lib/facter/resolvers/solaris/zone_name.rb +31 -0
- data/lib/facter/resolvers/uptime_resolver.rb +1 -27
- data/lib/facter/resolvers/utils/ffi/load_averages.rb +27 -0
- data/lib/facter/resolvers/utils/http.rb +68 -0
- data/lib/facter/resolvers/utils/networking.rb +2 -0
- data/lib/facter/resolvers/utils/uptime_helper.rb +32 -0
- data/lib/facter/resolvers/windows/ffi/ffi.rb +1 -1
- data/lib/facter/resolvers/windows/networking_resolver.rb +100 -100
- data/lib/facter/resolvers/xen.rb +28 -0
- data/lib/facter/resolvers/zfs.rb +32 -0
- data/lib/facter/resolvers/zpool.rb +34 -0
- data/lib/facter/version.rb +1 -1
- metadata +144 -18
- data/lib/facter/facts/freebsd/solaris_zones/current.rb +0 -15
- data/lib/facter/facts/freebsd/solaris_zones/zone.rb +0 -15
- data/lib/facter/facts/solaris/solaris_zones/zone.rb +0 -62
- data/lib/facter/resolvers/bsd/load_averages_resolver.rb +0 -26
- data/lib/facter/resolvers/macosx/networking_resolver.rb +0 -108
- data/lib/facter/resolvers/solaris/solaris_os_release_resolver.rb +0 -42
- data/lib/facter/resolvers/solaris/solaris_zone_name.rb +0 -28
- data/lib/facter/resolvers/solaris/zfs_resolver.rb +0 -34
- data/lib/facter/resolvers/solaris/zone_resolver.rb +0 -48
- data/lib/facter/resolvers/solaris/zpool_resolver.rb +0 -36
@@ -32,9 +32,10 @@ module Facter
|
|
32
32
|
version_codename = output_strings[1].split(' ')
|
33
33
|
|
34
34
|
@fact_list[:name] = name(output_strings[0])
|
35
|
-
@fact_list[:version] = version_codename[0]
|
36
|
-
|
37
|
-
|
35
|
+
@fact_list[:version] = version_codename[0]&.strip
|
36
|
+
|
37
|
+
codename = version_codename[1]&.strip
|
38
|
+
@fact_list[:codename] = codename ? codename.gsub(/[()]/, '') : nil
|
38
39
|
|
39
40
|
@fact_list[:identifier] = identifier(@fact_list[:name])
|
40
41
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facter
|
4
|
+
module Resolvers
|
5
|
+
module Solaris
|
6
|
+
class Disks < BaseResolver
|
7
|
+
@semaphore = Mutex.new
|
8
|
+
@fact_list ||= {}
|
9
|
+
|
10
|
+
class << self
|
11
|
+
private
|
12
|
+
|
13
|
+
def post_resolve(fact_name)
|
14
|
+
@fact_list.fetch(fact_name) { read_disks_info(fact_name) }
|
15
|
+
end
|
16
|
+
|
17
|
+
def read_disks_info(fact_name)
|
18
|
+
return unless File.executable?('/usr/bin/kstat')
|
19
|
+
|
20
|
+
log.debug('loading disks info')
|
21
|
+
|
22
|
+
kstat_output = Facter::Core::Execution.execute('/usr/bin/kstat sderr', logger: log)
|
23
|
+
return if kstat_output.empty?
|
24
|
+
|
25
|
+
@fact_list[fact_name] = parse(kstat_output)
|
26
|
+
end
|
27
|
+
|
28
|
+
def parse(kstat_output)
|
29
|
+
disks = {}
|
30
|
+
|
31
|
+
names = kstat_output.scan(/name:\s+(\w+)/).flatten
|
32
|
+
products = kstat_output.scan(/Product\s+(.+)/).flatten
|
33
|
+
vendors = kstat_output.scan(/Vendor\s+(\w+)/).flatten
|
34
|
+
sizes = kstat_output.scan(/Size\s+(\w+)/).flatten
|
35
|
+
|
36
|
+
names.each_with_index do |name, index|
|
37
|
+
disk_size = sizes[index].to_i
|
38
|
+
disks[name] = {
|
39
|
+
product: products[index],
|
40
|
+
size: Facter::FactsUtils::UnitConverter.bytes_to_human_readable(disk_size),
|
41
|
+
size_bytes: disk_size,
|
42
|
+
vendor: vendors[index]
|
43
|
+
}
|
44
|
+
end
|
45
|
+
disks
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facter
|
4
|
+
module Resolvers
|
5
|
+
module Solaris
|
6
|
+
class Dmi < BaseResolver
|
7
|
+
@semaphore = Mutex.new
|
8
|
+
@fact_list ||= {}
|
9
|
+
|
10
|
+
class << self
|
11
|
+
private
|
12
|
+
|
13
|
+
def post_resolve(fact_name)
|
14
|
+
@fact_list.fetch(fact_name) { read_facts(fact_name) }
|
15
|
+
end
|
16
|
+
|
17
|
+
SMBIOS_PARAMS = {
|
18
|
+
'SMB_TYPE_BIOS' => {
|
19
|
+
bios_version: 'Version String: (.+)',
|
20
|
+
bios_vendor: 'Vendor: (.+)',
|
21
|
+
bios_release_date: 'Release Date: (.+)'
|
22
|
+
},
|
23
|
+
'SMB_TYPE_SYSTEM' => {
|
24
|
+
manufacturer: 'Manufacturer: (.+)',
|
25
|
+
product_name: 'Product: (.+)',
|
26
|
+
serial_number: 'Serial Number: (.+)',
|
27
|
+
product_uuid: 'UUID: (.+)'
|
28
|
+
},
|
29
|
+
'SMB_TYPE_CHASSIS' => {
|
30
|
+
chassis_asset_tag: 'Asset Tag: (.+)',
|
31
|
+
chassis_type: '(?:Chassis )?Type: (.+)'
|
32
|
+
}
|
33
|
+
}.freeze
|
34
|
+
|
35
|
+
def read_facts(fact_name)
|
36
|
+
param = SMBIOS_PARAMS.find { |_key, hash| hash[fact_name] }
|
37
|
+
return nil unless param
|
38
|
+
|
39
|
+
output = exec_smbios(param[0])
|
40
|
+
facts = param[1]
|
41
|
+
facts.each do |name, regx|
|
42
|
+
@fact_list[name] = output.match(/#{regx}/)&.captures&.first
|
43
|
+
end
|
44
|
+
|
45
|
+
@fact_list[fact_name]
|
46
|
+
end
|
47
|
+
|
48
|
+
def exec_smbios(args)
|
49
|
+
return unless File.executable?('/usr/sbin/smbios')
|
50
|
+
|
51
|
+
Facter::Core::Execution.execute("/usr/sbin/smbios -t #{args}", logger: log)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facter
|
4
|
+
module Resolvers
|
5
|
+
module Solaris
|
6
|
+
class DmiSparc < BaseResolver
|
7
|
+
@semaphore = Mutex.new
|
8
|
+
@fact_list ||= {}
|
9
|
+
|
10
|
+
class << self
|
11
|
+
private
|
12
|
+
|
13
|
+
def post_resolve(fact_name)
|
14
|
+
@fact_list.fetch(fact_name) { read_facts(fact_name) }
|
15
|
+
end
|
16
|
+
|
17
|
+
def read_facts(fact_name)
|
18
|
+
output = exec_prtdiag
|
19
|
+
return unless output
|
20
|
+
|
21
|
+
matches = output.match(/System Configuration:\s+(.+?)\s+sun\d+\S+\s+(.+)/)&.captures
|
22
|
+
|
23
|
+
@fact_list[:manufacturer] = matches[0]&.strip
|
24
|
+
@fact_list[:product_name] = matches[1]&.strip
|
25
|
+
|
26
|
+
sneep = exec_sneep&.strip
|
27
|
+
@fact_list[:serial_number] = sneep
|
28
|
+
|
29
|
+
@fact_list[fact_name]
|
30
|
+
end
|
31
|
+
|
32
|
+
def exec_prtdiag
|
33
|
+
return unless File.executable?('/usr/sbin/prtdiag')
|
34
|
+
|
35
|
+
Facter::Core::Execution.execute('/usr/sbin/prtdiag', logger: log)
|
36
|
+
end
|
37
|
+
|
38
|
+
def exec_sneep
|
39
|
+
return unless File.executable?('/usr/sbin/sneep')
|
40
|
+
|
41
|
+
Facter::Core::Execution.execute('/usr/sbin/sneep', logger: log)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facter
|
4
|
+
module Resolvers
|
5
|
+
module Solaris
|
6
|
+
class Ldom < BaseResolver
|
7
|
+
# :chassis_serial
|
8
|
+
# :control_domain
|
9
|
+
# :domain_name
|
10
|
+
# :domain_uuid
|
11
|
+
# :role_control
|
12
|
+
# :role_io
|
13
|
+
# :role_root
|
14
|
+
# :role_service
|
15
|
+
# :role_impl
|
16
|
+
|
17
|
+
@semaphore = Mutex.new
|
18
|
+
@fact_list ||= {}
|
19
|
+
|
20
|
+
VIRTINFO_MAPPING = {
|
21
|
+
chassis_serial: %w[DOMAINCHASSIS serialno],
|
22
|
+
control_domain: %w[DOMAINCONTROL name],
|
23
|
+
domain_name: %w[DOMAINNAME name],
|
24
|
+
domain_uuid: %w[DOMAINUUID uuid],
|
25
|
+
role_control: %w[DOMAINROLE control],
|
26
|
+
role_io: %w[DOMAINROLE io],
|
27
|
+
role_root: %w[DOMAINROLE root],
|
28
|
+
role_service: %w[DOMAINROLE service],
|
29
|
+
role_impl: %w[DOMAINROLE impl]
|
30
|
+
}.freeze
|
31
|
+
|
32
|
+
class << self
|
33
|
+
private
|
34
|
+
|
35
|
+
def post_resolve(fact_name)
|
36
|
+
@fact_list.fetch(fact_name) { call_virtinfo(fact_name) }
|
37
|
+
end
|
38
|
+
|
39
|
+
def call_virtinfo(fact_name)
|
40
|
+
# return unless File.executable?('/usr/sbin/virtinfo')
|
41
|
+
|
42
|
+
virtinfo_output = Facter::Core::Execution.execute('/usr/sbin/virtinfo -a -p', logger: log)
|
43
|
+
return if virtinfo_output.empty?
|
44
|
+
|
45
|
+
output_hash = parse_output(virtinfo_output)
|
46
|
+
return if output_hash.empty?
|
47
|
+
|
48
|
+
VIRTINFO_MAPPING.each do |key, value|
|
49
|
+
@fact_list[key] = output_hash.dig(*value)&.strip
|
50
|
+
end
|
51
|
+
|
52
|
+
@fact_list[fact_name]
|
53
|
+
end
|
54
|
+
|
55
|
+
def parse_output(output)
|
56
|
+
result = {}
|
57
|
+
output.each_line do |line|
|
58
|
+
next unless line.include? 'DOMAIN'
|
59
|
+
|
60
|
+
x = line.split('|')
|
61
|
+
result[x.shift] = x.map { |f| f.split('=') }.to_h
|
62
|
+
end
|
63
|
+
|
64
|
+
result
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facter
|
4
|
+
module Resolvers
|
5
|
+
module Solaris
|
6
|
+
class Memory < BaseResolver
|
7
|
+
BLOCKSIZE = 512
|
8
|
+
# :system
|
9
|
+
# :swap
|
10
|
+
@semaphore = Mutex.new
|
11
|
+
@fact_list ||= {}
|
12
|
+
class << self
|
13
|
+
private
|
14
|
+
|
15
|
+
def post_resolve(fact_name)
|
16
|
+
@fact_list.fetch(fact_name) { calculate_memory(fact_name) }
|
17
|
+
end
|
18
|
+
|
19
|
+
def calculate_memory(fact_name)
|
20
|
+
@fact_list = { system: sys, swap: swap }
|
21
|
+
|
22
|
+
@fact_list[fact_name]
|
23
|
+
end
|
24
|
+
|
25
|
+
def sys
|
26
|
+
sys = {}
|
27
|
+
output = Facter::Core::Execution.execute('/usr/bin/kstat -m unix -n system_pages', logger: log).strip
|
28
|
+
total, free = parse_sys_output(output)
|
29
|
+
|
30
|
+
return unless total || free
|
31
|
+
|
32
|
+
sys[:total_bytes] = total
|
33
|
+
sys[:available_bytes] = free
|
34
|
+
sys[:used_bytes] = total - free
|
35
|
+
sys[:capacity] = FilesystemHelper.compute_capacity(total - free, total)
|
36
|
+
|
37
|
+
sys
|
38
|
+
end
|
39
|
+
|
40
|
+
def swap
|
41
|
+
swap_hash = {}
|
42
|
+
output = Facter::Core::Execution.execute('/usr/sbin/swap -l', logger: log).strip
|
43
|
+
total, free = parse_swap_output(output)
|
44
|
+
|
45
|
+
swap_hash[:total_bytes] = total
|
46
|
+
swap_hash[:available_bytes] = free
|
47
|
+
swap_hash[:used_bytes] = total - free
|
48
|
+
swap_hash[:capacity] = FilesystemHelper.compute_capacity(total - free, total)
|
49
|
+
|
50
|
+
swap_hash if total != 0
|
51
|
+
end
|
52
|
+
|
53
|
+
def parse_sys_output(output)
|
54
|
+
kstats = output.scan(/(physmem|pagesfree)\s+(\d+)/)
|
55
|
+
kstats = kstats.to_h
|
56
|
+
return unless kstats['physmem'] || kstats['pagesfree']
|
57
|
+
return unless pagesize != 0
|
58
|
+
|
59
|
+
total = kstats['physmem'].to_i * pagesize
|
60
|
+
free = kstats['pagesfree'].to_i * pagesize
|
61
|
+
|
62
|
+
[total, free]
|
63
|
+
end
|
64
|
+
|
65
|
+
def parse_swap_output(output)
|
66
|
+
total = 0
|
67
|
+
free = 0
|
68
|
+
|
69
|
+
output.each_line do |line|
|
70
|
+
swap_sizes = line.match(/(\d+)\s+(\d+)$/)
|
71
|
+
next if swap_sizes.nil?
|
72
|
+
|
73
|
+
total += swap_sizes[1].to_i
|
74
|
+
free += swap_sizes[2].to_i
|
75
|
+
end
|
76
|
+
total *= BLOCKSIZE
|
77
|
+
free *= BLOCKSIZE
|
78
|
+
|
79
|
+
[total, free]
|
80
|
+
end
|
81
|
+
|
82
|
+
def pagesize
|
83
|
+
unless @fact_list[:pagesize]
|
84
|
+
@fact_list[:pagesize] = Facter::Core::Execution.execute('pagesize', logger: log).strip.to_i
|
85
|
+
log.debug("Pagesize: #{@fact_list[:pagesize]}")
|
86
|
+
end
|
87
|
+
@fact_list[:pagesize]
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -12,11 +12,6 @@ module Facter
|
|
12
12
|
@fact_list ||= {}
|
13
13
|
@interfaces = {}
|
14
14
|
|
15
|
-
BINDINGS_KEY = {
|
16
|
-
FFI::AF_INET => :bindings,
|
17
|
-
FFI::AF_INET6 => :bindings6
|
18
|
-
}.freeze
|
19
|
-
|
20
15
|
class << self
|
21
16
|
private
|
22
17
|
|
@@ -141,7 +136,8 @@ module Facter
|
|
141
136
|
end
|
142
137
|
|
143
138
|
def add_dhcp(interface_name)
|
144
|
-
|
139
|
+
dhcpinfo_command = Facter::Core::Execution.which('dhcpinfo') || '/sbin/dhcpinfo'
|
140
|
+
result = Facter::Core::Execution.execute("#{dhcpinfo_command} -i #{interface_name} ServerID", logger: log)
|
145
141
|
|
146
142
|
@interfaces[interface_name][:dhcp] = result.chomp
|
147
143
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facter
|
4
|
+
module Resolvers
|
5
|
+
module Solaris
|
6
|
+
class OsRelease < BaseResolver
|
7
|
+
@semaphore = Mutex.new
|
8
|
+
@fact_list ||= {}
|
9
|
+
@os_version_regex_patterns = ['Solaris \d+ \d+/\d+ s(\d+)[sx]?_u(\d+)wos_',
|
10
|
+
'Solaris (\d+)[.](\d+)', 'Solaris (\d+)']
|
11
|
+
class << self
|
12
|
+
private
|
13
|
+
|
14
|
+
def post_resolve(fact_name)
|
15
|
+
@fact_list.fetch(fact_name) { build_release_facts(fact_name) }
|
16
|
+
end
|
17
|
+
|
18
|
+
def build_release_facts(fact_name)
|
19
|
+
result = Util::FileHelper.safe_read('/etc/release', nil)
|
20
|
+
return @fact_list[fact_name] = nil if result.nil?
|
21
|
+
|
22
|
+
@os_version_regex_patterns.each do |os_version_regex|
|
23
|
+
major, minor = search_for_os_version(/#{os_version_regex}/, result)
|
24
|
+
next unless major || minor
|
25
|
+
|
26
|
+
@fact_list[:major] = major
|
27
|
+
@fact_list[:minor] = minor
|
28
|
+
@fact_list[:full] = major == '10' ? major + '_u' + minor : major + '.' + minor
|
29
|
+
break
|
30
|
+
end
|
31
|
+
@fact_list[fact_name]
|
32
|
+
end
|
33
|
+
|
34
|
+
def search_for_os_version(regex_pattern, text)
|
35
|
+
result = text.match(regex_pattern)
|
36
|
+
major, minor = result.captures if result
|
37
|
+
minor = regex_pattern == /Solaris (\d+)/ ? '0' : minor
|
38
|
+
return [major, minor] if major && minor
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Facter
|
4
|
+
module Resolvers
|
5
|
+
module Solaris
|
6
|
+
class Zone < BaseResolver
|
7
|
+
@semaphore = Mutex.new
|
8
|
+
@fact_list ||= {}
|
9
|
+
|
10
|
+
class << self
|
11
|
+
private
|
12
|
+
|
13
|
+
def post_resolve(fact_name)
|
14
|
+
@fact_list.fetch(fact_name) { build_zone_fact(fact_name) }
|
15
|
+
end
|
16
|
+
|
17
|
+
def build_zone_fact(fact_name)
|
18
|
+
command = '/usr/sbin/zoneadm list -cp'
|
19
|
+
zone_adm_output = Facter::Core::Execution.execute(command, logger: log)
|
20
|
+
|
21
|
+
if zone_adm_output.empty?
|
22
|
+
log.debug("Command #{command} returned an empty result")
|
23
|
+
return
|
24
|
+
end
|
25
|
+
@fact_list[:zone] = create_zone_facts(zone_adm_output)
|
26
|
+
|
27
|
+
@fact_list[fact_name]
|
28
|
+
end
|
29
|
+
|
30
|
+
def create_zone_facts(zones_result)
|
31
|
+
zones_fact = []
|
32
|
+
zones_result.each_line do |zone_line|
|
33
|
+
id, name, status, path, uuid, brand, ip_type = zone_line.split(':')
|
34
|
+
zones_fact << {
|
35
|
+
brand: brand,
|
36
|
+
id: id,
|
37
|
+
iptype: ip_type.chomp,
|
38
|
+
name: name,
|
39
|
+
uuid: uuid,
|
40
|
+
status: status,
|
41
|
+
path: path
|
42
|
+
|
43
|
+
}
|
44
|
+
end
|
45
|
+
zones_fact
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|