facter 4.0.34 → 4.0.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. checksums.yaml +4 -4
  2. data/lib/facter/facts/aix/ssh.rb +3 -1
  3. data/lib/facter/facts/freebsd/augeas/version.rb +19 -0
  4. data/lib/facter/facts/freebsd/facterversion.rb +14 -0
  5. data/lib/facter/facts/freebsd/identity/gid.rb +16 -0
  6. data/lib/facter/facts/{solaris/solaris_zones/current.rb → freebsd/identity/group.rb} +6 -6
  7. data/lib/facter/facts/freebsd/identity/privileged.rb +16 -0
  8. data/lib/facter/facts/freebsd/identity/uid.rb +16 -0
  9. data/lib/facter/facts/freebsd/identity/user.rb +17 -0
  10. data/lib/facter/facts/freebsd/kernel.rb +14 -0
  11. data/lib/facter/facts/freebsd/kernelrelease.rb +14 -0
  12. data/lib/facter/facts/freebsd/mountpoints.rb +21 -0
  13. data/lib/facter/facts/freebsd/netmask6_interfaces.rb +20 -0
  14. data/lib/facter/facts/freebsd/netmask_interfaces.rb +20 -0
  15. data/lib/facter/facts/freebsd/network6_interfaces.rb +20 -0
  16. data/lib/facter/facts/freebsd/network_interfaces.rb +20 -0
  17. data/lib/facter/facts/freebsd/networking/dhcp.rb +17 -0
  18. data/lib/facter/facts/freebsd/networking/domain.rb +18 -0
  19. data/lib/facter/facts/freebsd/networking/fqdn.rb +18 -0
  20. data/lib/facter/facts/freebsd/networking/hostname.rb +18 -0
  21. data/lib/facter/facts/freebsd/networking/interfaces.rb +17 -0
  22. data/lib/facter/facts/freebsd/networking/ip.rb +18 -0
  23. data/lib/facter/facts/freebsd/networking/ip6.rb +18 -0
  24. data/lib/facter/facts/freebsd/networking/mac.rb +18 -0
  25. data/lib/facter/facts/freebsd/networking/mtu.rb +17 -0
  26. data/lib/facter/facts/freebsd/networking/netmask.rb +18 -0
  27. data/lib/facter/facts/freebsd/networking/netmask6.rb +18 -0
  28. data/lib/facter/facts/freebsd/networking/network.rb +18 -0
  29. data/lib/facter/facts/freebsd/networking/network6.rb +18 -0
  30. data/lib/facter/facts/freebsd/networking/primary.rb +17 -0
  31. data/lib/facter/facts/freebsd/networking/scope6.rb +17 -0
  32. data/lib/facter/facts/freebsd/os/architecture.rb +18 -0
  33. data/lib/facter/facts/freebsd/os/hardware.rb +18 -0
  34. data/lib/facter/facts/freebsd/os/name.rb +18 -0
  35. data/lib/facter/facts/{bsd/bsd_example_fact.rb → freebsd/path.rb} +5 -4
  36. data/lib/facter/facts/freebsd/processors/isa.rb +17 -0
  37. data/lib/facter/facts/freebsd/puppet_version.rb +15 -0
  38. data/lib/facter/facts/freebsd/ruby/platform.rb +18 -0
  39. data/lib/facter/facts/freebsd/ruby/sitedir.rb +18 -0
  40. data/lib/facter/facts/freebsd/ruby/version.rb +18 -0
  41. data/lib/facter/facts/freebsd/ssh.rb +26 -0
  42. data/lib/facter/facts/freebsd/system_uptime/days.rb +18 -0
  43. data/lib/facter/facts/freebsd/system_uptime/hours.rb +18 -0
  44. data/lib/facter/facts/freebsd/system_uptime/seconds.rb +18 -0
  45. data/lib/facter/facts/freebsd/system_uptime/uptime.rb +18 -0
  46. data/lib/facter/facts/freebsd/timezone.rb +15 -0
  47. data/lib/facter/facts/freebsd/zfs_featurenumbers.rb +14 -0
  48. data/lib/facter/facts/freebsd/zfs_version.rb +14 -0
  49. data/lib/facter/facts/freebsd/zpool_featureflags.rb +14 -0
  50. data/lib/facter/facts/freebsd/zpool_featurenumbers.rb +14 -0
  51. data/lib/facter/facts/freebsd/zpool_version.rb +14 -0
  52. data/lib/facter/facts/linux/mountpoints.rb +1 -1
  53. data/lib/facter/facts/linux/partitions.rb +1 -1
  54. data/lib/facter/facts/linux/ssh.rb +19 -9
  55. data/lib/facter/facts/linux/system_uptime/days.rb +7 -1
  56. data/lib/facter/facts/linux/system_uptime/hours.rb +7 -1
  57. data/lib/facter/facts/linux/system_uptime/seconds.rb +7 -1
  58. data/lib/facter/facts/linux/system_uptime/uptime.rb +7 -1
  59. data/lib/facter/facts/macosx/dhcp_servers.rb +2 -2
  60. data/lib/facter/facts/macosx/interfaces.rb +1 -1
  61. data/lib/facter/facts/macosx/ipaddress6_interfaces.rb +1 -1
  62. data/lib/facter/facts/macosx/ipaddress_interfaces.rb +1 -1
  63. data/lib/facter/facts/macosx/macaddress_interfaces.rb +1 -1
  64. data/lib/facter/facts/macosx/mtu_interfaces.rb +1 -1
  65. data/lib/facter/facts/macosx/netmask6_interfaces.rb +1 -1
  66. data/lib/facter/facts/macosx/netmask_interfaces.rb +1 -1
  67. data/lib/facter/facts/macosx/network6_interfaces.rb +1 -1
  68. data/lib/facter/facts/macosx/network_interfaces.rb +1 -1
  69. data/lib/facter/facts/macosx/networking/dhcp.rb +1 -1
  70. data/lib/facter/facts/macosx/networking/interfaces.rb +1 -1
  71. data/lib/facter/facts/macosx/networking/ip.rb +1 -1
  72. data/lib/facter/facts/macosx/networking/ip6.rb +1 -1
  73. data/lib/facter/facts/macosx/networking/mac.rb +1 -1
  74. data/lib/facter/facts/macosx/networking/mtu.rb +1 -1
  75. data/lib/facter/facts/macosx/networking/netmask.rb +1 -1
  76. data/lib/facter/facts/macosx/networking/netmask6.rb +1 -1
  77. data/lib/facter/facts/macosx/networking/network.rb +1 -1
  78. data/lib/facter/facts/macosx/networking/network6.rb +1 -1
  79. data/lib/facter/facts/macosx/networking/primary.rb +1 -1
  80. data/lib/facter/facts/macosx/networking/scope6.rb +1 -1
  81. data/lib/facter/facts/macosx/scope6_interfaces.rb +2 -2
  82. data/lib/facter/facts/macosx/ssh.rb +19 -11
  83. data/lib/facter/facts/solaris/current_zone.rb +16 -0
  84. data/lib/facter/facts/solaris/disks.rb +14 -0
  85. data/lib/facter/facts/solaris/dmi/bios/release_date.rb +24 -0
  86. data/lib/facter/facts/solaris/dmi/bios/vendor.rb +24 -0
  87. data/lib/facter/facts/solaris/dmi/bios/version.rb +24 -0
  88. data/lib/facter/facts/solaris/dmi/chassis/asset_tag.rb +24 -0
  89. data/lib/facter/facts/solaris/dmi/chassis/type.rb +24 -0
  90. data/lib/facter/facts/solaris/dmi/manufacturer.rb +25 -0
  91. data/lib/facter/facts/solaris/dmi/product/name.rb +27 -0
  92. data/lib/facter/facts/solaris/dmi/product/serial_number.rb +27 -0
  93. data/lib/facter/facts/solaris/dmi/product/uuid.rb +24 -0
  94. data/lib/facter/facts/solaris/mountpoints.rb +1 -1
  95. data/lib/facter/facts/solaris/os/release.rb +3 -3
  96. data/lib/facter/facts/solaris/ssh.rb +19 -9
  97. data/lib/facter/facts/solaris/zfs_featurenumbers.rb +1 -1
  98. data/lib/facter/facts/solaris/zfs_version.rb +1 -1
  99. data/lib/facter/facts/solaris/zones.rb +60 -0
  100. data/lib/facter/facts/solaris/zpool_featureflags.rb +1 -1
  101. data/lib/facter/facts/solaris/zpool_featurenumbers.rb +1 -1
  102. data/lib/facter/facts/solaris/zpool_version.rb +1 -1
  103. data/lib/facter/facts/windows/dhcp_servers.rb +2 -2
  104. data/lib/facter/facts/windows/interfaces.rb +1 -1
  105. data/lib/facter/facts/windows/ipaddress6_interfaces.rb +1 -1
  106. data/lib/facter/facts/windows/ipaddress_interfaces.rb +1 -1
  107. data/lib/facter/facts/windows/macaddress_interfaces.rb +1 -1
  108. data/lib/facter/facts/windows/mtu_interfaces.rb +1 -1
  109. data/lib/facter/facts/windows/netmask6_interfaces.rb +1 -1
  110. data/lib/facter/facts/windows/netmask_interfaces.rb +1 -1
  111. data/lib/facter/facts/windows/network6_interfaces.rb +1 -1
  112. data/lib/facter/facts/windows/network_interfaces.rb +1 -1
  113. data/lib/facter/facts/windows/networking/dhcp.rb +1 -1
  114. data/lib/facter/facts/windows/networking/domain.rb +1 -1
  115. data/lib/facter/facts/windows/networking/fqdn.rb +1 -1
  116. data/lib/facter/facts/windows/networking/interfaces.rb +1 -1
  117. data/lib/facter/facts/windows/networking/ip.rb +1 -1
  118. data/lib/facter/facts/windows/networking/ip6.rb +1 -1
  119. data/lib/facter/facts/windows/networking/mac.rb +1 -1
  120. data/lib/facter/facts/windows/networking/mtu.rb +1 -1
  121. data/lib/facter/facts/windows/networking/netmask.rb +1 -1
  122. data/lib/facter/facts/windows/networking/netmask6.rb +1 -1
  123. data/lib/facter/facts/windows/networking/network.rb +1 -1
  124. data/lib/facter/facts/windows/networking/network6.rb +1 -1
  125. data/lib/facter/facts/windows/networking/primary.rb +1 -1
  126. data/lib/facter/facts/windows/networking/scope6.rb +1 -1
  127. data/lib/facter/facts/windows/scope6_interfaces.rb +1 -1
  128. data/lib/facter/framework/cli/cli.rb +16 -4
  129. data/lib/facter/framework/config/fact_groups.rb +13 -0
  130. data/lib/facter/os_hierarchy.json +3 -6
  131. data/lib/facter/resolvers/base_resolver.rb +1 -1
  132. data/lib/facter/resolvers/ec2.rb +2 -2
  133. data/lib/facter/resolvers/filesystems_resolver.rb +1 -1
  134. data/lib/facter/resolvers/linux/docker_uptime.rb +45 -0
  135. data/lib/facter/resolvers/linux/load_averages.rb +0 -1
  136. data/lib/facter/resolvers/load_averages.rb +2 -0
  137. data/lib/facter/resolvers/mountpoints_resolver.rb +42 -44
  138. data/lib/facter/resolvers/networking_resolver.rb +106 -0
  139. data/lib/facter/resolvers/solaris/disks.rb +51 -0
  140. data/lib/facter/resolvers/solaris/dmi.rb +57 -0
  141. data/lib/facter/resolvers/solaris/dmi_sparc.rb +47 -0
  142. data/lib/facter/resolvers/solaris/{filesystems_resolver.rb → filesystems.rb} +0 -0
  143. data/lib/facter/resolvers/solaris/{ipaddress_resolver.rb → ipaddress.rb} +0 -0
  144. data/lib/facter/resolvers/solaris/{networking_resolver.rb → networking.rb} +0 -0
  145. data/lib/facter/resolvers/solaris/os_release.rb +44 -0
  146. data/lib/facter/resolvers/solaris/zone.rb +51 -0
  147. data/lib/facter/resolvers/solaris/zone_name.rb +31 -0
  148. data/lib/facter/resolvers/uptime_resolver.rb +1 -27
  149. data/lib/facter/resolvers/utils/uptime_helper.rb +32 -0
  150. data/lib/facter/resolvers/windows/networking_resolver.rb +100 -98
  151. data/lib/facter/resolvers/zfs.rb +32 -0
  152. data/lib/facter/resolvers/zpool.rb +34 -0
  153. data/lib/facter/version.rb +1 -1
  154. metadata +77 -16
  155. data/lib/facter/facts/freebsd/solaris_zones/current.rb +0 -15
  156. data/lib/facter/facts/freebsd/solaris_zones/zone.rb +0 -15
  157. data/lib/facter/facts/solaris/solaris_zones/zone.rb +0 -62
  158. data/lib/facter/resolvers/macosx/networking_resolver.rb +0 -108
  159. data/lib/facter/resolvers/solaris/solaris_os_release_resolver.rb +0 -42
  160. data/lib/facter/resolvers/solaris/solaris_zone_name.rb +0 -28
  161. data/lib/facter/resolvers/solaris/zfs_resolver.rb +0 -34
  162. data/lib/facter/resolvers/solaris/zone_resolver.rb +0 -48
  163. data/lib/facter/resolvers/solaris/zpool_resolver.rb +0 -36
@@ -2,131 +2,133 @@
2
2
 
3
3
  module Facter
4
4
  module Resolvers
5
- class Networking < BaseResolver
6
- @log = Facter::Log.new(self)
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) { read_network_information(fact_name) }
14
- end
15
-
16
- def read_network_information(fact_name)
17
- require 'facter/resolvers/windows/ffi/networking_ffi'
5
+ module Windows
6
+ class Networking < BaseResolver
7
+ @log = Facter::Log.new(self)
8
+ @semaphore = Mutex.new
9
+ @fact_list ||= {}
10
+ class << self
11
+ private
12
+
13
+ def post_resolve(fact_name)
14
+ @fact_list.fetch(fact_name) { read_network_information(fact_name) }
15
+ end
18
16
 
19
- size_ptr = FFI::MemoryPointer.new(NetworkingFFI::BUFFER_LENGTH)
20
- adapter_addresses = FFI::MemoryPointer.new(IpAdapterAddressesLh.size, NetworkingFFI::BUFFER_LENGTH)
21
- flags = NetworkingFFI::GAA_FLAG_SKIP_ANYCAST |
22
- NetworkingFFI::GAA_FLAG_SKIP_MULTICAST | NetworkingFFI::GAA_FLAG_SKIP_DNS_SERVER
17
+ def read_network_information(fact_name)
18
+ require 'facter/resolvers/windows/ffi/networking_ffi'
23
19
 
24
- return unless (adapter_addresses = get_adapter_addresses(size_ptr, adapter_addresses, flags))
20
+ size_ptr = FFI::MemoryPointer.new(NetworkingFFI::BUFFER_LENGTH)
21
+ adapter_addresses = FFI::MemoryPointer.new(IpAdapterAddressesLh.size, NetworkingFFI::BUFFER_LENGTH)
22
+ flags = NetworkingFFI::GAA_FLAG_SKIP_ANYCAST |
23
+ NetworkingFFI::GAA_FLAG_SKIP_MULTICAST | NetworkingFFI::GAA_FLAG_SKIP_DNS_SERVER
25
24
 
26
- iterate_list(adapter_addresses)
25
+ return unless (adapter_addresses = get_adapter_addresses(size_ptr, adapter_addresses, flags))
27
26
 
28
- ::Resolvers::Utils::Networking.expand_main_bindings(@fact_list)
27
+ iterate_list(adapter_addresses)
29
28
 
30
- @fact_list[fact_name]
31
- end
29
+ ::Resolvers::Utils::Networking.expand_main_bindings(@fact_list)
32
30
 
33
- def get_adapter_addresses(size_ptr, adapter_addresses, flags)
34
- error = nil
35
- 3.times do
36
- error = NetworkingFFI::GetAdaptersAddresses(NetworkingFFI::AF_UNSPEC, flags,
37
- FFI::Pointer::NULL, adapter_addresses, size_ptr)
38
- break if error == NetworkingFFI::ERROR_SUCCES
39
-
40
- if error == NetworkingFFI::ERROR_BUFFER_OVERFLOW
41
- adapter_addresses = FFI::MemoryPointer.new(IpAdapterAddressesLh.size, NetworkingFFI::BUFFER_LENGTH)
42
- else
43
- @log.debug 'Unable to retrieve networking facts!'
44
- return nil
45
- end
31
+ @fact_list[fact_name]
46
32
  end
47
- return nil unless error.zero?
48
33
 
49
- adapter_addresses
50
- end
34
+ def get_adapter_addresses(size_ptr, adapter_addresses, flags)
35
+ error = nil
36
+ 3.times do
37
+ error = NetworkingFFI::GetAdaptersAddresses(NetworkingFFI::AF_UNSPEC, flags,
38
+ FFI::Pointer::NULL, adapter_addresses, size_ptr)
39
+ break if error == NetworkingFFI::ERROR_SUCCES
40
+
41
+ if error == NetworkingFFI::ERROR_BUFFER_OVERFLOW
42
+ adapter_addresses = FFI::MemoryPointer.new(IpAdapterAddressesLh.size, NetworkingFFI::BUFFER_LENGTH)
43
+ else
44
+ @log.debug 'Unable to retrieve networking facts!'
45
+ return nil
46
+ end
47
+ end
48
+ return nil unless error.zero?
51
49
 
52
- def adapter_down?(adapter)
53
- adapter[:OperStatus] != NetworkingFFI::IF_OPER_STATUS_UP ||
54
- ![NetworkingFFI::IF_TYPE_ETHERNET_CSMACD, NetworkingFFI::IF_TYPE_IEEE80211].include?(adapter[:IfType])
55
- end
50
+ adapter_addresses
51
+ end
56
52
 
57
- def retrieve_dhcp_server(adapter)
58
- if !(adapter[:Flags] & NetworkingFFI::IP_ADAPTER_DHCP_ENABLED).zero? &&
59
- adapter[:Union][:Struct][:Length] >= IpAdapterAddressesLh.size
60
- NetworkUtils.address_to_string(adapter[:Dhcpv4Server])
53
+ def adapter_down?(adapter)
54
+ adapter[:OperStatus] != NetworkingFFI::IF_OPER_STATUS_UP ||
55
+ ![NetworkingFFI::IF_TYPE_ETHERNET_CSMACD, NetworkingFFI::IF_TYPE_IEEE80211].include?(adapter[:IfType])
61
56
  end
62
- end
63
57
 
64
- def iterate_list(adapter_addresses)
65
- net_interface = {}
66
- IpAdapterAddressesLh.read_list(adapter_addresses) do |adapter_address|
67
- if adapter_down?(adapter_address)
68
- adapter_address = IpAdapterAddressesLh.new(adapter_address[:Next])
69
- next
58
+ def retrieve_dhcp_server(adapter)
59
+ if !(adapter[:Flags] & NetworkingFFI::IP_ADAPTER_DHCP_ENABLED).zero? &&
60
+ adapter[:Union][:Struct][:Length] >= IpAdapterAddressesLh.size
61
+ NetworkUtils.address_to_string(adapter[:Dhcpv4Server])
70
62
  end
71
- @fact_list[:domain] ||= adapter_address[:DnsSuffix].read_wide_string_without_length
72
- name = adapter_address[:FriendlyName].read_wide_string_without_length
73
- net_interface[name] = build_interface_info(adapter_address, name)
74
63
  end
75
64
 
76
- @fact_list[:interfaces] = net_interface unless net_interface.empty?
77
- end
65
+ def iterate_list(adapter_addresses)
66
+ net_interface = {}
67
+ IpAdapterAddressesLh.read_list(adapter_addresses) do |adapter_address|
68
+ if adapter_down?(adapter_address)
69
+ adapter_address = IpAdapterAddressesLh.new(adapter_address[:Next])
70
+ next
71
+ end
72
+ @fact_list[:domain] ||= adapter_address[:DnsSuffix].read_wide_string_without_length
73
+ name = adapter_address[:FriendlyName].read_wide_string_without_length
74
+ net_interface[name] = build_interface_info(adapter_address, name)
75
+ end
78
76
 
79
- def build_interface_info(adapter_address, name)
80
- hash = {}
77
+ @fact_list[:interfaces] = net_interface unless net_interface.empty?
78
+ end
81
79
 
82
- hash[:dhcp] = retrieve_dhcp_server(adapter_address)
83
- hash[:mtu] = adapter_address[:Mtu]
80
+ def build_interface_info(adapter_address, name)
81
+ hash = {}
84
82
 
85
- bindings = find_ip_addresses(adapter_address[:FirstUnicastAddress], name)
86
- hash[:bindings] = bindings[:ipv4] unless bindings[:ipv4].empty?
87
- hash[:bindings6] = bindings[:ipv6] unless bindings[:ipv6].empty?
88
- hash[:mac] = NetworkUtils.find_mac_address(adapter_address)
89
- hash
90
- end
83
+ hash[:dhcp] = retrieve_dhcp_server(adapter_address)
84
+ hash[:mtu] = adapter_address[:Mtu]
91
85
 
92
- def find_ip_addresses(unicast_addresses, name)
93
- bindings = {}
94
- bindings[:ipv6] = []
95
- bindings[:ipv4] = []
86
+ bindings = find_ip_addresses(adapter_address[:FirstUnicastAddress], name)
87
+ hash[:bindings] = bindings[:ipv4] unless bindings[:ipv4].empty?
88
+ hash[:bindings6] = bindings[:ipv6] unless bindings[:ipv6].empty?
89
+ hash[:mac] = NetworkUtils.find_mac_address(adapter_address)
90
+ hash
91
+ end
96
92
 
97
- IpAdapterUnicastAddressLH.read_list(unicast_addresses) do |unicast|
98
- addr = NetworkUtils.address_to_string(unicast[:Address])
99
- unless addr
100
- unicast = IpAdapterUnicastAddressLH.new(unicast[:Next])
101
- next
93
+ def find_ip_addresses(unicast_addresses, name)
94
+ bindings = {}
95
+ bindings[:ipv6] = []
96
+ bindings[:ipv4] = []
97
+
98
+ IpAdapterUnicastAddressLH.read_list(unicast_addresses) do |unicast|
99
+ addr = NetworkUtils.address_to_string(unicast[:Address])
100
+ unless addr
101
+ unicast = IpAdapterUnicastAddressLH.new(unicast[:Next])
102
+ next
103
+ end
104
+
105
+ sock_addr = SockAddr.new(unicast[:Address][:lpSockaddr])
106
+ add_ip_data(addr, unicast, sock_addr, bindings)
107
+ find_primary_interface(sock_addr, name, addr)
102
108
  end
103
-
104
- sock_addr = SockAddr.new(unicast[:Address][:lpSockaddr])
105
- add_ip_data(addr, unicast, sock_addr, bindings)
106
- find_primary_interface(sock_addr, name, addr)
109
+ bindings
107
110
  end
108
- bindings
109
- end
110
111
 
111
- def add_ip_data(addr, unicast, sock_addr, bindings)
112
- result = find_bindings(sock_addr, unicast, addr)
113
- return unless result
112
+ def add_ip_data(addr, unicast, sock_addr, bindings)
113
+ result = find_bindings(sock_addr, unicast, addr)
114
+ return unless result
114
115
 
115
- bindings[:ipv6] << result if sock_addr[:sa_family] == NetworkingFFI::AF_INET6
116
- bindings[:ipv4] << result if sock_addr[:sa_family] == NetworkingFFI::AF_INET
117
- end
116
+ bindings[:ipv6] << result if sock_addr[:sa_family] == NetworkingFFI::AF_INET6
117
+ bindings[:ipv4] << result if sock_addr[:sa_family] == NetworkingFFI::AF_INET
118
+ end
118
119
 
119
- def find_bindings(sock_addr, unicast, addr)
120
- return unless [NetworkingFFI::AF_INET, NetworkingFFI::AF_INET6].include?(sock_addr[:sa_family])
120
+ def find_bindings(sock_addr, unicast, addr)
121
+ return unless [NetworkingFFI::AF_INET, NetworkingFFI::AF_INET6].include?(sock_addr[:sa_family])
121
122
 
122
- ::Resolvers::Utils::Networking.build_binding(addr, unicast[:OnLinkPrefixLength])
123
- end
123
+ ::Resolvers::Utils::Networking.build_binding(addr, unicast[:OnLinkPrefixLength])
124
+ end
124
125
 
125
- def find_primary_interface(sock_addr, name, addr)
126
- if !@fact_list[:primary_interface] &&
127
- ([NetworkingFFI::AF_INET, NetworkingFFI::AF_INET6].include?(sock_addr[:sa_family]) &&
128
- !::Resolvers::Utils::Networking.ignored_ip_address(addr))
129
- @fact_list[:primary_interface] = name.to_s
126
+ def find_primary_interface(sock_addr, name, addr)
127
+ if !@fact_list[:primary_interface] &&
128
+ ([NetworkingFFI::AF_INET, NetworkingFFI::AF_INET6].include?(sock_addr[:sa_family]) &&
129
+ !::Resolvers::Utils::Networking.ignored_ip_address(addr))
130
+ @fact_list[:primary_interface] = name.to_s
131
+ end
130
132
  end
131
133
  end
132
134
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facter
4
+ module Resolvers
5
+ class ZFS < 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) { zfs_fact(fact_name) }
13
+ end
14
+
15
+ def zfs_fact(fact_name)
16
+ build_zfs_facts
17
+ @fact_list[fact_name]
18
+ end
19
+
20
+ def build_zfs_facts
21
+ output = Facter::Core::Execution.execute('zfs upgrade -v', logger: log)
22
+ features_list = output.scan(/^\s+(\d+)/).flatten
23
+
24
+ return if features_list.empty?
25
+
26
+ @fact_list[:zfs_featurenumbers] = features_list.join(',')
27
+ @fact_list[:zfs_version] = features_list.last
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facter
4
+ module Resolvers
5
+ class Zpool < 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) { zpool_fact(fact_name) }
13
+ end
14
+
15
+ def zpool_fact(fact_name)
16
+ build_zpool_facts
17
+ @fact_list[fact_name]
18
+ end
19
+
20
+ def build_zpool_facts
21
+ output = Facter::Core::Execution.execute('zpool upgrade -v', logger: log)
22
+ features_list = output.scan(/^\s+(\d+)/).flatten
23
+ features_flags = output.scan(/^([a-z0-9_]+)[[:blank:]]*(\(read-only compatible\))?$/).map(&:first)
24
+
25
+ return if features_list.empty?
26
+
27
+ @fact_list[:zpool_featurenumbers] = features_list.join(',')
28
+ @fact_list[:zpool_featureflags] = features_flags.join(',')
29
+ @fact_list[:zpool_version] = features_flags.any? ? '5000' : features_list.last
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Facter
4
- VERSION = '4.0.34' unless defined?(VERSION)
4
+ VERSION = '4.0.35' unless defined?(VERSION)
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facter
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.34
4
+ version: 4.0.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-12 00:00:00.000000000 Z
11
+ date: 2020-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -285,7 +285,6 @@ files:
285
285
  - lib/facter/facts/aix/system_uptime/seconds.rb
286
286
  - lib/facter/facts/aix/system_uptime/uptime.rb
287
287
  - lib/facter/facts/aix/timezone.rb
288
- - lib/facter/facts/bsd/bsd_example_fact.rb
289
288
  - lib/facter/facts/bsd/kernelmajversion.rb
290
289
  - lib/facter/facts/bsd/kernelversion.rb
291
290
  - lib/facter/facts/bsd/load_averages.rb
@@ -302,6 +301,7 @@ files:
302
301
  - lib/facter/facts/debian/os/distro/id.rb
303
302
  - lib/facter/facts/debian/os/distro/release.rb
304
303
  - lib/facter/facts/debian/os/release.rb
304
+ - lib/facter/facts/freebsd/augeas/version.rb
305
305
  - lib/facter/facts/freebsd/disks.rb
306
306
  - lib/facter/facts/freebsd/dmi/bios/release_date.rb
307
307
  - lib/facter/facts/freebsd/dmi/bios/vendor.rb
@@ -310,6 +310,14 @@ files:
310
310
  - lib/facter/facts/freebsd/dmi/product/name.rb
311
311
  - lib/facter/facts/freebsd/dmi/product/serial_number.rb
312
312
  - lib/facter/facts/freebsd/dmi/product/uuid.rb
313
+ - lib/facter/facts/freebsd/facterversion.rb
314
+ - lib/facter/facts/freebsd/identity/gid.rb
315
+ - lib/facter/facts/freebsd/identity/group.rb
316
+ - lib/facter/facts/freebsd/identity/privileged.rb
317
+ - lib/facter/facts/freebsd/identity/uid.rb
318
+ - lib/facter/facts/freebsd/identity/user.rb
319
+ - lib/facter/facts/freebsd/kernel.rb
320
+ - lib/facter/facts/freebsd/kernelrelease.rb
313
321
  - lib/facter/facts/freebsd/memory/swap/available.rb
314
322
  - lib/facter/facts/freebsd/memory/swap/available_bytes.rb
315
323
  - lib/facter/facts/freebsd/memory/swap/capacity.rb
@@ -325,13 +333,51 @@ files:
325
333
  - lib/facter/facts/freebsd/memory/system/total_bytes.rb
326
334
  - lib/facter/facts/freebsd/memory/system/used.rb
327
335
  - lib/facter/facts/freebsd/memory/system/used_bytes.rb
336
+ - lib/facter/facts/freebsd/mountpoints.rb
337
+ - lib/facter/facts/freebsd/netmask6_interfaces.rb
338
+ - lib/facter/facts/freebsd/netmask_interfaces.rb
339
+ - lib/facter/facts/freebsd/network6_interfaces.rb
340
+ - lib/facter/facts/freebsd/network_interfaces.rb
341
+ - lib/facter/facts/freebsd/networking/dhcp.rb
342
+ - lib/facter/facts/freebsd/networking/domain.rb
343
+ - lib/facter/facts/freebsd/networking/fqdn.rb
344
+ - lib/facter/facts/freebsd/networking/hostname.rb
345
+ - lib/facter/facts/freebsd/networking/interfaces.rb
346
+ - lib/facter/facts/freebsd/networking/ip.rb
347
+ - lib/facter/facts/freebsd/networking/ip6.rb
348
+ - lib/facter/facts/freebsd/networking/mac.rb
349
+ - lib/facter/facts/freebsd/networking/mtu.rb
350
+ - lib/facter/facts/freebsd/networking/netmask.rb
351
+ - lib/facter/facts/freebsd/networking/netmask6.rb
352
+ - lib/facter/facts/freebsd/networking/network.rb
353
+ - lib/facter/facts/freebsd/networking/network6.rb
354
+ - lib/facter/facts/freebsd/networking/primary.rb
355
+ - lib/facter/facts/freebsd/networking/scope6.rb
356
+ - lib/facter/facts/freebsd/os/architecture.rb
357
+ - lib/facter/facts/freebsd/os/hardware.rb
358
+ - lib/facter/facts/freebsd/os/name.rb
328
359
  - lib/facter/facts/freebsd/os/release.rb
329
360
  - lib/facter/facts/freebsd/partitions.rb
361
+ - lib/facter/facts/freebsd/path.rb
330
362
  - lib/facter/facts/freebsd/processors/count.rb
363
+ - lib/facter/facts/freebsd/processors/isa.rb
331
364
  - lib/facter/facts/freebsd/processors/models.rb
332
365
  - lib/facter/facts/freebsd/processors/speed.rb
333
- - lib/facter/facts/freebsd/solaris_zones/current.rb
334
- - lib/facter/facts/freebsd/solaris_zones/zone.rb
366
+ - lib/facter/facts/freebsd/puppet_version.rb
367
+ - lib/facter/facts/freebsd/ruby/platform.rb
368
+ - lib/facter/facts/freebsd/ruby/sitedir.rb
369
+ - lib/facter/facts/freebsd/ruby/version.rb
370
+ - lib/facter/facts/freebsd/ssh.rb
371
+ - lib/facter/facts/freebsd/system_uptime/days.rb
372
+ - lib/facter/facts/freebsd/system_uptime/hours.rb
373
+ - lib/facter/facts/freebsd/system_uptime/seconds.rb
374
+ - lib/facter/facts/freebsd/system_uptime/uptime.rb
375
+ - lib/facter/facts/freebsd/timezone.rb
376
+ - lib/facter/facts/freebsd/zfs_featurenumbers.rb
377
+ - lib/facter/facts/freebsd/zfs_version.rb
378
+ - lib/facter/facts/freebsd/zpool_featureflags.rb
379
+ - lib/facter/facts/freebsd/zpool_featurenumbers.rb
380
+ - lib/facter/facts/freebsd/zpool_version.rb
335
381
  - lib/facter/facts/linux/aio_agent_version.rb
336
382
  - lib/facter/facts/linux/augeas/version.rb
337
383
  - lib/facter/facts/linux/dhcp_servers.rb
@@ -571,7 +617,18 @@ files:
571
617
  - lib/facter/facts/sles/os/release.rb
572
618
  - lib/facter/facts/solaris/aio_agent_version.rb
573
619
  - lib/facter/facts/solaris/augeas/version.rb
620
+ - lib/facter/facts/solaris/current_zone.rb
574
621
  - lib/facter/facts/solaris/dhcp_servers.rb
622
+ - lib/facter/facts/solaris/disks.rb
623
+ - lib/facter/facts/solaris/dmi/bios/release_date.rb
624
+ - lib/facter/facts/solaris/dmi/bios/vendor.rb
625
+ - lib/facter/facts/solaris/dmi/bios/version.rb
626
+ - lib/facter/facts/solaris/dmi/chassis/asset_tag.rb
627
+ - lib/facter/facts/solaris/dmi/chassis/type.rb
628
+ - lib/facter/facts/solaris/dmi/manufacturer.rb
629
+ - lib/facter/facts/solaris/dmi/product/name.rb
630
+ - lib/facter/facts/solaris/dmi/product/serial_number.rb
631
+ - lib/facter/facts/solaris/dmi/product/uuid.rb
575
632
  - lib/facter/facts/solaris/facterversion.rb
576
633
  - lib/facter/facts/solaris/filesystems.rb
577
634
  - lib/facter/facts/solaris/identity/gid.rb
@@ -637,8 +694,6 @@ files:
637
694
  - lib/facter/facts/solaris/ruby/platform.rb
638
695
  - lib/facter/facts/solaris/ruby/sitedir.rb
639
696
  - lib/facter/facts/solaris/ruby/version.rb
640
- - lib/facter/facts/solaris/solaris_zones/current.rb
641
- - lib/facter/facts/solaris/solaris_zones/zone.rb
642
697
  - lib/facter/facts/solaris/ssh.rb
643
698
  - lib/facter/facts/solaris/system_uptime/days.rb
644
699
  - lib/facter/facts/solaris/system_uptime/hours.rb
@@ -647,6 +702,7 @@ files:
647
702
  - lib/facter/facts/solaris/timezone.rb
648
703
  - lib/facter/facts/solaris/zfs_featurenumbers.rb
649
704
  - lib/facter/facts/solaris/zfs_version.rb
705
+ - lib/facter/facts/solaris/zones.rb
650
706
  - lib/facter/facts/solaris/zpool_featureflags.rb
651
707
  - lib/facter/facts/solaris/zpool_featurenumbers.rb
652
708
  - lib/facter/facts/solaris/zpool_version.rb
@@ -815,6 +871,7 @@ files:
815
871
  - lib/facter/resolvers/freebsd/system_memory_resolver.rb
816
872
  - lib/facter/resolvers/hostname_resolver.rb
817
873
  - lib/facter/resolvers/identity_resolver.rb
874
+ - lib/facter/resolvers/linux/docker_uptime.rb
818
875
  - lib/facter/resolvers/linux/load_averages.rb
819
876
  - lib/facter/resolvers/load_averages.rb
820
877
  - lib/facter/resolvers/lpar_resolver.rb
@@ -824,7 +881,6 @@ files:
824
881
  - lib/facter/resolvers/macosx/filesystems_resolver.rb
825
882
  - lib/facter/resolvers/macosx/load_averages_resolver.rb
826
883
  - lib/facter/resolvers/macosx/mountpoints_resolver.rb
827
- - lib/facter/resolvers/macosx/networking_resolver.rb
828
884
  - lib/facter/resolvers/macosx/processor_resolver.rb
829
885
  - lib/facter/resolvers/macosx/swap_memory_resolver.rb
830
886
  - lib/facter/resolvers/macosx/system_memory_resolver.rb
@@ -833,6 +889,7 @@ files:
833
889
  - lib/facter/resolvers/memory_resolver.rb
834
890
  - lib/facter/resolvers/mountpoints_resolver.rb
835
891
  - lib/facter/resolvers/networking_linux_resolver.rb
892
+ - lib/facter/resolvers/networking_resolver.rb
836
893
  - lib/facter/resolvers/open_vz.rb
837
894
  - lib/facter/resolvers/os_level_resolver.rb
838
895
  - lib/facter/resolvers/os_release_resolver.rb
@@ -843,19 +900,20 @@ files:
843
900
  - lib/facter/resolvers/redhat_release_resolver.rb
844
901
  - lib/facter/resolvers/ruby_resolver.rb
845
902
  - lib/facter/resolvers/selinux_resolver.rb
903
+ - lib/facter/resolvers/solaris/disks.rb
904
+ - lib/facter/resolvers/solaris/dmi.rb
905
+ - lib/facter/resolvers/solaris/dmi_sparc.rb
846
906
  - lib/facter/resolvers/solaris/ffi/ffi.rb
847
907
  - lib/facter/resolvers/solaris/ffi/functions.rb
848
908
  - lib/facter/resolvers/solaris/ffi/structs.rb
849
- - lib/facter/resolvers/solaris/filesystems_resolver.rb
850
- - lib/facter/resolvers/solaris/ipaddress_resolver.rb
909
+ - lib/facter/resolvers/solaris/filesystems.rb
910
+ - lib/facter/resolvers/solaris/ipaddress.rb
851
911
  - lib/facter/resolvers/solaris/memory.rb
852
- - lib/facter/resolvers/solaris/networking_resolver.rb
912
+ - lib/facter/resolvers/solaris/networking.rb
913
+ - lib/facter/resolvers/solaris/os_release.rb
853
914
  - lib/facter/resolvers/solaris/processors.rb
854
- - lib/facter/resolvers/solaris/solaris_os_release_resolver.rb
855
- - lib/facter/resolvers/solaris/solaris_zone_name.rb
856
- - lib/facter/resolvers/solaris/zfs_resolver.rb
857
- - lib/facter/resolvers/solaris/zone_resolver.rb
858
- - lib/facter/resolvers/solaris/zpool_resolver.rb
915
+ - lib/facter/resolvers/solaris/zone.rb
916
+ - lib/facter/resolvers/solaris/zone_name.rb
859
917
  - lib/facter/resolvers/ssh_resolver.rb
860
918
  - lib/facter/resolvers/suse_release_resolver.rb
861
919
  - lib/facter/resolvers/sw_vers_resolver.rb
@@ -868,6 +926,7 @@ files:
868
926
  - lib/facter/resolvers/utils/networking.rb
869
927
  - lib/facter/resolvers/utils/ssh.rb
870
928
  - lib/facter/resolvers/utils/ssh_helper.rb
929
+ - lib/facter/resolvers/utils/uptime_helper.rb
871
930
  - lib/facter/resolvers/virt_what.rb
872
931
  - lib/facter/resolvers/vmware.rb
873
932
  - lib/facter/resolvers/windows/aio_agent_version.rb
@@ -902,6 +961,8 @@ files:
902
961
  - lib/facter/resolvers/windows/win_os_description_resolver.rb
903
962
  - lib/facter/resolvers/wpar_resolver.rb
904
963
  - lib/facter/resolvers/xen.rb
964
+ - lib/facter/resolvers/zfs.rb
965
+ - lib/facter/resolvers/zpool.rb
905
966
  - lib/facter/templates/man.erb
906
967
  - lib/facter/util/api_debugger.rb
907
968
  - lib/facter/util/file_helper.rb