facter 4.0.34 → 4.0.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/facter/facts/aix/ssh.rb +3 -1
- data/lib/facter/facts/freebsd/augeas/version.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/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/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/mountpoints.rb +1 -1
- data/lib/facter/facts/linux/partitions.rb +1 -1
- data/lib/facter/facts/linux/ssh.rb +19 -9
- 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/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 +1 -1
- data/lib/facter/facts/macosx/scope6_interfaces.rb +2 -2
- data/lib/facter/facts/macosx/ssh.rb +19 -11
- data/lib/facter/facts/solaris/current_zone.rb +16 -0
- data/lib/facter/facts/solaris/disks.rb +14 -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/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/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/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 +1 -1
- data/lib/facter/facts/windows/scope6_interfaces.rb +1 -1
- data/lib/facter/framework/cli/cli.rb +16 -4
- data/lib/facter/framework/config/fact_groups.rb +13 -0
- data/lib/facter/os_hierarchy.json +3 -6
- data/lib/facter/resolvers/base_resolver.rb +1 -1
- data/lib/facter/resolvers/ec2.rb +2 -2
- data/lib/facter/resolvers/filesystems_resolver.rb +1 -1
- data/lib/facter/resolvers/linux/docker_uptime.rb +45 -0
- data/lib/facter/resolvers/linux/load_averages.rb +0 -1
- data/lib/facter/resolvers/load_averages.rb +2 -0
- data/lib/facter/resolvers/mountpoints_resolver.rb +42 -44
- data/lib/facter/resolvers/networking_resolver.rb +106 -0
- 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/{filesystems_resolver.rb → filesystems.rb} +0 -0
- data/lib/facter/resolvers/solaris/{ipaddress_resolver.rb → ipaddress.rb} +0 -0
- data/lib/facter/resolvers/solaris/{networking_resolver.rb → networking.rb} +0 -0
- 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/uptime_helper.rb +32 -0
- data/lib/facter/resolvers/windows/networking_resolver.rb +100 -98
- data/lib/facter/resolvers/zfs.rb +32 -0
- data/lib/facter/resolvers/zpool.rb +34 -0
- data/lib/facter/version.rb +1 -1
- metadata +77 -16
- 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/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
@@ -1,62 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Facts
|
4
|
-
module Solaris
|
5
|
-
module SolarisZones
|
6
|
-
class Zone
|
7
|
-
FACT_NAME = 'solaris_zones.zones'
|
8
|
-
ALIASES = %w[
|
9
|
-
zone_.*_brand
|
10
|
-
zone_.*_iptype
|
11
|
-
zone_.*_name
|
12
|
-
zone_.*_uuid
|
13
|
-
zone_.*_id
|
14
|
-
zone_.*_path
|
15
|
-
zone_.*_status
|
16
|
-
zones
|
17
|
-
].freeze
|
18
|
-
|
19
|
-
def call_the_resolver
|
20
|
-
resolved_facts = []
|
21
|
-
zones = {}
|
22
|
-
|
23
|
-
results = Facter::Resolvers::SolarisZone.resolve(:zone)
|
24
|
-
return Facter::ResolvedFact.new(FACT_NAME, nil) unless results
|
25
|
-
|
26
|
-
results&.each do |result|
|
27
|
-
zones.merge!(parse_result(result))
|
28
|
-
resolved_facts << create_legacy_zone_facts(result)
|
29
|
-
end
|
30
|
-
|
31
|
-
resolved_facts << Facter::ResolvedFact.new('solaris_zones.zones', zones)
|
32
|
-
resolved_facts << Facter::ResolvedFact.new('zones', results.count, :legacy)
|
33
|
-
|
34
|
-
resolved_facts.flatten
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def parse_result(result)
|
40
|
-
{
|
41
|
-
result[:name].to_sym => {
|
42
|
-
brand: result[:brand],
|
43
|
-
id: result[:id],
|
44
|
-
ip_type: result[:iptype],
|
45
|
-
path: result[:path],
|
46
|
-
status: result[:status]
|
47
|
-
}
|
48
|
-
}
|
49
|
-
end
|
50
|
-
|
51
|
-
def create_legacy_zone_facts(zone)
|
52
|
-
legacy_facts = []
|
53
|
-
%w[brand iptype name uuid id path status].each do |key|
|
54
|
-
legacy_facts << Facter::ResolvedFact.new("zone_#{zone[:name]}_#{key}", zone[key.to_sym], :legacy)
|
55
|
-
end
|
56
|
-
|
57
|
-
legacy_facts
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,108 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Facter
|
4
|
-
module Resolvers
|
5
|
-
module Macosx
|
6
|
-
class Networking < 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
|
-
primary_interface
|
19
|
-
interfaces_data
|
20
|
-
::Resolvers::Utils::Networking.expand_main_bindings(@fact_list)
|
21
|
-
@fact_list[fact_name]
|
22
|
-
end
|
23
|
-
|
24
|
-
def primary_interface
|
25
|
-
result = Facter::Core::Execution.execute('route -n get default', logger: log)
|
26
|
-
|
27
|
-
@fact_list[:primary_interface] = result.match(/interface: (.+)/)&.captures&.first
|
28
|
-
end
|
29
|
-
|
30
|
-
def interfaces_data
|
31
|
-
command_response = Facter::Core::Execution.execute('ifconfig -a', logger: log)
|
32
|
-
|
33
|
-
clean_up_interfaces_response(command_response)
|
34
|
-
parse_interfaces_response(command_response)
|
35
|
-
end
|
36
|
-
|
37
|
-
def clean_up_interfaces_response(response)
|
38
|
-
# convert ip ranges into single ip. eg. 10.16.132.213 --> 10.16.132.213 is converted to 10.16.132.213
|
39
|
-
response.gsub!(/(\d+(\.\d+)*)\s+-->\s+\d+(\.\d+)*/, '\\1')
|
40
|
-
end
|
41
|
-
|
42
|
-
def parse_interfaces_response(response)
|
43
|
-
parsed_interfaces_data = {}
|
44
|
-
interfaces_data = Hash[*response.split(/^([A-Za-z0-9_]+): /)[1..-1]]
|
45
|
-
|
46
|
-
interfaces_data.each do |interface_name, raw_data|
|
47
|
-
parsed_interface_data = {}
|
48
|
-
|
49
|
-
extract_mtu(raw_data, parsed_interface_data)
|
50
|
-
extract_mac(raw_data, parsed_interface_data)
|
51
|
-
extract_dhcp(interface_name, raw_data, parsed_interface_data)
|
52
|
-
extract_ip_data(raw_data, parsed_interface_data)
|
53
|
-
|
54
|
-
parsed_interfaces_data[interface_name] = parsed_interface_data
|
55
|
-
end
|
56
|
-
@fact_list[:interfaces] = parsed_interfaces_data unless parsed_interfaces_data.empty?
|
57
|
-
end
|
58
|
-
|
59
|
-
def extract_mtu(raw_data, parsed_interface_data)
|
60
|
-
mtu = raw_data.match(/mtu\s+(\d+)/)&.captures&.first&.to_i
|
61
|
-
parsed_interface_data[:mtu] = mtu unless mtu.nil?
|
62
|
-
end
|
63
|
-
|
64
|
-
def extract_mac(raw_data, parsed_interface_data)
|
65
|
-
mac = raw_data.match(/(?:ether|lladdr)\s+(\w?\w:\w?\w:\w?\w:\w?\w:\w?\w:\w?\w)/)&.captures&.first
|
66
|
-
parsed_interface_data[:mac] = mac unless mac.nil?
|
67
|
-
end
|
68
|
-
|
69
|
-
def extract_dhcp(interface_name, raw_data, parsed_interface_data)
|
70
|
-
return unless raw_data =~ /status:\s+active/
|
71
|
-
|
72
|
-
result = Facter::Core::Execution.execute("ipconfig getoption #{interface_name} " \
|
73
|
-
'server_identifier', logger: log)
|
74
|
-
|
75
|
-
parsed_interface_data[:dhcp] = result.match(/^[\d.a-f:\s]+$/)&.to_s&.strip unless result.empty?
|
76
|
-
end
|
77
|
-
|
78
|
-
def extract_ip_data(raw_data, parsed_interface_data)
|
79
|
-
ip = extract_values(raw_data, /inet (\S+)/)
|
80
|
-
mask = extract_values(raw_data, /netmask (\S+)/).map { |val| val.hex.to_s(2).count('1') }
|
81
|
-
|
82
|
-
ip6 = extract_values(raw_data, /inet6 (\S+)/).map { |val| val.gsub(/%.+/, '') }
|
83
|
-
mask6 = extract_values(raw_data, /prefixlen (\S+)/)
|
84
|
-
|
85
|
-
parsed_interface_data[:bindings] = create_bindings(ip, mask) unless ip.empty?
|
86
|
-
parsed_interface_data[:bindings6] = create_bindings(ip6, mask6) unless ip6.empty?
|
87
|
-
end
|
88
|
-
|
89
|
-
def extract_values(data, regex)
|
90
|
-
results = []
|
91
|
-
data.scan(regex).flatten.each do |val|
|
92
|
-
results << val
|
93
|
-
end
|
94
|
-
results
|
95
|
-
end
|
96
|
-
|
97
|
-
def create_bindings(ips, masks)
|
98
|
-
bindings = []
|
99
|
-
ips.zip(masks).each do |ip, mask|
|
100
|
-
bindings << ::Resolvers::Utils::Networking.build_binding(ip, mask)
|
101
|
-
end
|
102
|
-
bindings
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Facter
|
4
|
-
module Resolvers
|
5
|
-
class SolarisRelease < BaseResolver
|
6
|
-
@semaphore = Mutex.new
|
7
|
-
@fact_list ||= {}
|
8
|
-
@os_version_regex_patterns = ['Solaris \d+ \d+/\d+ s(\d+)[sx]?_u(\d+)wos_',
|
9
|
-
'Solaris (\d+)[.](\d+)', 'Solaris (\d+)']
|
10
|
-
class << self
|
11
|
-
private
|
12
|
-
|
13
|
-
def post_resolve(fact_name)
|
14
|
-
@fact_list.fetch(fact_name) { build_release_facts(fact_name) }
|
15
|
-
end
|
16
|
-
|
17
|
-
def build_release_facts(fact_name)
|
18
|
-
result = Util::FileHelper.safe_read('/etc/release', nil)
|
19
|
-
return @fact_list[fact_name] = nil if result.nil?
|
20
|
-
|
21
|
-
@os_version_regex_patterns.each do |os_version_regex|
|
22
|
-
major, minor = search_for_os_version(/#{os_version_regex}/, result)
|
23
|
-
next unless major || minor
|
24
|
-
|
25
|
-
@fact_list[:major] = major
|
26
|
-
@fact_list[:minor] = minor
|
27
|
-
@fact_list[:full] = major == '10' ? major + '_u' + minor : major + '.' + minor
|
28
|
-
break
|
29
|
-
end
|
30
|
-
@fact_list[fact_name]
|
31
|
-
end
|
32
|
-
|
33
|
-
def search_for_os_version(regex_pattern, text)
|
34
|
-
result = text.match(regex_pattern)
|
35
|
-
major, minor = result.captures if result
|
36
|
-
minor = regex_pattern == /Solaris (\d+)/ ? '0' : minor
|
37
|
-
return [major, minor] if major && minor
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Facter
|
4
|
-
module Resolvers
|
5
|
-
class SolarisZoneName < BaseResolver
|
6
|
-
@semaphore = Mutex.new
|
7
|
-
@fact_list ||= {}
|
8
|
-
class << self
|
9
|
-
private
|
10
|
-
|
11
|
-
def post_resolve(fact_name)
|
12
|
-
@fact_list.fetch(fact_name) { build_current_zone_name_fact(fact_name) }
|
13
|
-
end
|
14
|
-
|
15
|
-
def build_current_zone_name_fact(fact_name)
|
16
|
-
zone_name_output = Facter::Core::Execution.execute('/bin/zonename', logger: log)
|
17
|
-
|
18
|
-
if zone_name_output.empty?
|
19
|
-
log.debug("Command #{command} returned an empty result")
|
20
|
-
return
|
21
|
-
end
|
22
|
-
@fact_list[:current_zone_name] = zone_name_output.chomp
|
23
|
-
@fact_list[fact_name]
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Facter
|
4
|
-
module Resolvers
|
5
|
-
module Solaris
|
6
|
-
class ZFS < BaseResolver
|
7
|
-
@semaphore = Mutex.new
|
8
|
-
@fact_list ||= {}
|
9
|
-
class << self
|
10
|
-
private
|
11
|
-
|
12
|
-
def post_resolve(fact_name)
|
13
|
-
@fact_list.fetch(fact_name) { zfs_fact(fact_name) }
|
14
|
-
end
|
15
|
-
|
16
|
-
def zfs_fact(fact_name)
|
17
|
-
build_zfs_facts
|
18
|
-
@fact_list[fact_name]
|
19
|
-
end
|
20
|
-
|
21
|
-
def build_zfs_facts
|
22
|
-
output = Facter::Core::Execution.execute('zfs upgrade -v', logger: log)
|
23
|
-
features_list = output.scan(/^\s+(\d+)/).flatten
|
24
|
-
|
25
|
-
return if features_list.empty?
|
26
|
-
|
27
|
-
@fact_list[:zfs_featurenumbers] = features_list.join(',')
|
28
|
-
@fact_list[:zfs_version] = features_list.last
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Facter
|
4
|
-
module Resolvers
|
5
|
-
class SolarisZone < BaseResolver
|
6
|
-
@semaphore = Mutex.new
|
7
|
-
@fact_list ||= {}
|
8
|
-
class << self
|
9
|
-
private
|
10
|
-
|
11
|
-
def post_resolve(fact_name)
|
12
|
-
@fact_list.fetch(fact_name) { build_zone_fact(fact_name) }
|
13
|
-
end
|
14
|
-
|
15
|
-
def build_zone_fact(fact_name)
|
16
|
-
command = '/usr/sbin/zoneadm list -cp'
|
17
|
-
zone_adm_output = Facter::Core::Execution.execute(command, logger: log)
|
18
|
-
|
19
|
-
if zone_adm_output.empty?
|
20
|
-
log.debug("Command #{command} returned an empty result")
|
21
|
-
return
|
22
|
-
end
|
23
|
-
@fact_list[:zone] = create_zone_facts(zone_adm_output)
|
24
|
-
|
25
|
-
@fact_list[fact_name]
|
26
|
-
end
|
27
|
-
|
28
|
-
def create_zone_facts(zones_result)
|
29
|
-
zones_fact = []
|
30
|
-
zones_result.each_line do |zone_line|
|
31
|
-
id, name, status, path, uuid, brand, ip_type = zone_line.split(':')
|
32
|
-
zones_fact << {
|
33
|
-
brand: brand,
|
34
|
-
id: id,
|
35
|
-
iptype: ip_type.chomp,
|
36
|
-
name: name,
|
37
|
-
uuid: uuid,
|
38
|
-
status: status,
|
39
|
-
path: path
|
40
|
-
|
41
|
-
}
|
42
|
-
end
|
43
|
-
zones_fact
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Facter
|
4
|
-
module Resolvers
|
5
|
-
module Solaris
|
6
|
-
class ZPool < BaseResolver
|
7
|
-
@semaphore = Mutex.new
|
8
|
-
@fact_list ||= {}
|
9
|
-
class << self
|
10
|
-
private
|
11
|
-
|
12
|
-
def post_resolve(fact_name)
|
13
|
-
@fact_list.fetch(fact_name) { zpool_fact(fact_name) }
|
14
|
-
end
|
15
|
-
|
16
|
-
def zpool_fact(fact_name)
|
17
|
-
build_zpool_facts
|
18
|
-
@fact_list[fact_name]
|
19
|
-
end
|
20
|
-
|
21
|
-
def build_zpool_facts
|
22
|
-
output = Facter::Core::Execution.execute('zpool upgrade -v', logger: log)
|
23
|
-
features_list = output.scan(/^\s+(\d+)/).flatten
|
24
|
-
features_flags = output.scan(/^([a-z0-9_]+)[[:blank:]]*(\(read-only compatible\))?$/).map(&:first)
|
25
|
-
|
26
|
-
return if features_list.empty?
|
27
|
-
|
28
|
-
@fact_list[:zpool_featurenumbers] = features_list.join(',')
|
29
|
-
@fact_list[:zpool_featureflags] = features_flags.join(',')
|
30
|
-
@fact_list[:zpool_version] = features_flags.any? ? '5000' : features_list.last
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|