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
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Freebsd
5
+ class ZfsVersion
6
+ FACT_NAME = 'zfs_version'
7
+
8
+ def call_the_resolver
9
+ fact_value = Facter::Resolvers::ZFS.resolve(:zfs_version)
10
+ Facter::ResolvedFact.new(FACT_NAME, fact_value)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Freebsd
5
+ class ZpoolFeatureflags
6
+ FACT_NAME = 'zpool_featureflags'
7
+
8
+ def call_the_resolver
9
+ fact_value = Facter::Resolvers::Zpool.resolve(:zpool_featureflags)
10
+ Facter::ResolvedFact.new(FACT_NAME, fact_value)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Freebsd
5
+ class ZpoolFeaturenumbers
6
+ FACT_NAME = 'zpool_featurenumbers'
7
+
8
+ def call_the_resolver
9
+ fact_value = Facter::Resolvers::Zpool.resolve(:zpool_featurenumbers)
10
+ Facter::ResolvedFact.new(FACT_NAME, fact_value)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Freebsd
5
+ class ZpoolVersion
6
+ FACT_NAME = 'zpool_version'
7
+
8
+ def call_the_resolver
9
+ fact_value = Facter::Resolvers::Zpool.resolve(:zpool_version)
10
+ Facter::ResolvedFact.new(FACT_NAME, fact_value)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -6,7 +6,7 @@ module Facts
6
6
  FACT_NAME = 'mountpoints'
7
7
 
8
8
  def call_the_resolver
9
- mountpoints = Facter::Resolvers::Linux::Mountpoints.resolve(FACT_NAME.to_sym)
9
+ mountpoints = Facter::Resolvers::Mountpoints.resolve(FACT_NAME.to_sym)
10
10
  return Facter::ResolvedFact.new(FACT_NAME, nil) unless mountpoints
11
11
 
12
12
  fact = {}
@@ -11,7 +11,7 @@ module Facts
11
11
 
12
12
  def partitions
13
13
  parts = Facter::Resolvers::Partitions.resolve(:partitions)
14
- mountpoints = Facter::Resolvers::Linux::Mountpoints.resolve(:mountpoints)
14
+ mountpoints = Facter::Resolvers::Mountpoints.resolve(:mountpoints)
15
15
  return parts unless mountpoints
16
16
 
17
17
  mountpoints.each do |mnt|
@@ -6,20 +6,30 @@ module Facts
6
6
  FACT_NAME = 'ssh'
7
7
 
8
8
  def call_the_resolver
9
- result = Facter::Resolvers::SshResolver.resolve(:ssh)
10
- ssh_facts = {}
11
- result.each { |ssh| ssh_facts.merge!(create_ssh_fact(ssh)) }
12
- Facter::ResolvedFact.new(FACT_NAME, ssh_facts)
9
+ Facter::ResolvedFact.new(FACT_NAME, fact_value)
13
10
  end
14
11
 
15
12
  private
16
13
 
14
+ def fact_value
15
+ resolver_data.map { |el| create_ssh_fact(el) }.inject(:merge)
16
+ end
17
+
18
+ def resolver_data
19
+ Facter::Resolvers::SshResolver.resolve(:ssh)
20
+ end
21
+
17
22
  def create_ssh_fact(ssh)
18
- { ssh.name.to_sym =>
19
- { fingerprints: { sha1: ssh.fingerprint.sha1,
20
- sha256: ssh.fingerprint.sha256 },
21
- key: ssh.key,
22
- type: ssh.type } }
23
+ return {} unless ssh
24
+
25
+ { ssh.name.to_sym => {
26
+ fingerprints: {
27
+ sha1: ssh.fingerprint.sha1,
28
+ sha256: ssh.fingerprint.sha256
29
+ },
30
+ key: ssh.key,
31
+ type: ssh.type
32
+ } }
23
33
  end
24
34
  end
25
35
  end
@@ -8,7 +8,13 @@ module Facts
8
8
  ALIASES = 'uptime_days'
9
9
 
10
10
  def call_the_resolver
11
- fact_value = Facter::Resolvers::Uptime.resolve(:days)
11
+ hypervisors = Facter::Resolvers::Containers.resolve(:hypervisor)
12
+
13
+ fact_value = if hypervisors && hypervisors[:docker]
14
+ Facter::Resolvers::Linux::DockerUptime.resolve(:days)
15
+ else
16
+ Facter::Resolvers::Uptime.resolve(:days)
17
+ end
12
18
 
13
19
  [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
20
  end
@@ -8,7 +8,13 @@ module Facts
8
8
  ALIASES = 'uptime_hours'
9
9
 
10
10
  def call_the_resolver
11
- fact_value = Facter::Resolvers::Uptime.resolve(:hours)
11
+ hypervisors = Facter::Resolvers::Containers.resolve(:hypervisor)
12
+
13
+ fact_value = if hypervisors && hypervisors[:docker]
14
+ Facter::Resolvers::Linux::DockerUptime.resolve(:hours)
15
+ else
16
+ Facter::Resolvers::Uptime.resolve(:hours)
17
+ end
12
18
 
13
19
  [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
20
  end
@@ -8,7 +8,13 @@ module Facts
8
8
  ALIASES = 'uptime_seconds'
9
9
 
10
10
  def call_the_resolver
11
- fact_value = Facter::Resolvers::Uptime.resolve(:seconds)
11
+ hypervisors = Facter::Resolvers::Containers.resolve(:hypervisor)
12
+
13
+ fact_value = if hypervisors && hypervisors[:docker]
14
+ Facter::Resolvers::Linux::DockerUptime.resolve(:seconds)
15
+ else
16
+ Facter::Resolvers::Uptime.resolve(:seconds)
17
+ end
12
18
 
13
19
  [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
20
  end
@@ -8,7 +8,13 @@ module Facts
8
8
  ALIASES = 'uptime'
9
9
 
10
10
  def call_the_resolver
11
- fact_value = Facter::Resolvers::Uptime.resolve(:uptime)
11
+ hypervisors = Facter::Resolvers::Containers.resolve(:hypervisor)
12
+
13
+ fact_value = if hypervisors && hypervisors[:docker]
14
+ Facter::Resolvers::Linux::DockerUptime.resolve(:uptime)
15
+ else
16
+ Facter::Resolvers::Uptime.resolve(:uptime)
17
+ end
12
18
 
13
19
  [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
20
  end
@@ -14,8 +14,8 @@ module Facts
14
14
  private
15
15
 
16
16
  def construct_addresses_hash
17
- primary_dhcp = Facter::Resolvers::Macosx::Networking.resolve(:dhcp)
18
- interfaces = Facter::Resolvers::Macosx::Networking.resolve(:interfaces)
17
+ primary_dhcp = Facter::Resolvers::Networking.resolve(:dhcp)
18
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
19
19
  return unless interfaces
20
20
 
21
21
  servers = { system: primary_dhcp }
@@ -6,7 +6,7 @@ module Facts
6
6
  FACT_NAME = 'interfaces'
7
7
 
8
8
  def call_the_resolver
9
- fact_value = Facter::Resolvers::Macosx::Networking.resolve(:interfaces)
9
+ fact_value = Facter::Resolvers::Networking.resolve(:interfaces)
10
10
 
11
11
  Facter::ResolvedFact.new(FACT_NAME, fact_value ? fact_value.keys.sort.join(',') : nil, :legacy)
12
12
  end
@@ -8,7 +8,7 @@ module Facts
8
8
 
9
9
  def call_the_resolver
10
10
  arr = []
11
- interfaces = Facter::Resolvers::Macosx::Networking.resolve(:interfaces)
11
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
12
12
  interfaces&.each do |interface_name, info|
13
13
  arr << Facter::ResolvedFact.new("ipaddress6_#{interface_name}", info[:ip6], :legacy) if info[:ip6]
14
14
  end
@@ -8,7 +8,7 @@ module Facts
8
8
 
9
9
  def call_the_resolver
10
10
  arr = []
11
- interfaces = Facter::Resolvers::Macosx::Networking.resolve(:interfaces)
11
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
12
12
  interfaces&.each do |interface_name, info|
13
13
  arr << Facter::ResolvedFact.new("ipaddress_#{interface_name}", info[:ip], :legacy) if info[:ip]
14
14
  end
@@ -8,7 +8,7 @@ module Facts
8
8
 
9
9
  def call_the_resolver
10
10
  arr = []
11
- interfaces = Facter::Resolvers::Macosx::Networking.resolve(:interfaces)
11
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
12
12
  interfaces&.each do |interface_name, info|
13
13
  arr << Facter::ResolvedFact.new("macaddress_#{interface_name}", info[:mac], :legacy) if info[:mac]
14
14
  end
@@ -8,7 +8,7 @@ module Facts
8
8
 
9
9
  def call_the_resolver
10
10
  arr = []
11
- interfaces = Facter::Resolvers::Macosx::Networking.resolve(:interfaces)
11
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
12
12
  interfaces&.each do |interface_name, info|
13
13
  arr << Facter::ResolvedFact.new("mtu_#{interface_name}", info[:mtu], :legacy) if info[:mtu]
14
14
  end
@@ -8,7 +8,7 @@ module Facts
8
8
 
9
9
  def call_the_resolver
10
10
  arr = []
11
- interfaces = Facter::Resolvers::Macosx::Networking.resolve(:interfaces)
11
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
12
12
  interfaces&.each do |interface_name, info|
13
13
  arr << Facter::ResolvedFact.new("netmask6_#{interface_name}", info[:netmask6], :legacy) if info[:netmask6]
14
14
  end
@@ -8,7 +8,7 @@ module Facts
8
8
 
9
9
  def call_the_resolver
10
10
  arr = []
11
- interfaces = Facter::Resolvers::Macosx::Networking.resolve(:interfaces)
11
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
12
12
  interfaces&.each do |interface_name, info|
13
13
  arr << Facter::ResolvedFact.new("netmask_#{interface_name}", info[:netmask], :legacy) if info[:netmask]
14
14
  end
@@ -8,7 +8,7 @@ module Facts
8
8
 
9
9
  def call_the_resolver
10
10
  arr = []
11
- interfaces = Facter::Resolvers::Macosx::Networking.resolve(:interfaces)
11
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
12
12
  interfaces&.each do |interface_name, info|
13
13
  arr << Facter::ResolvedFact.new("network6_#{interface_name}", info[:network6], :legacy) if info[:network6]
14
14
  end
@@ -8,7 +8,7 @@ module Facts
8
8
 
9
9
  def call_the_resolver
10
10
  arr = []
11
- interfaces = Facter::Resolvers::Macosx::Networking.resolve(:interfaces)
11
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
12
12
  interfaces&.each do |interface_name, info|
13
13
  arr << Facter::ResolvedFact.new("network_#{interface_name}", info[:network], :legacy) if info[:network]
14
14
  end
@@ -7,7 +7,7 @@ module Facts
7
7
  FACT_NAME = 'networking.dhcp'
8
8
 
9
9
  def call_the_resolver
10
- fact_value = Facter::Resolvers::Macosx::Networking.resolve(:dhcp)
10
+ fact_value = Facter::Resolvers::Networking.resolve(:dhcp)
11
11
 
12
12
  Facter::ResolvedFact.new(FACT_NAME, fact_value)
13
13
  end
@@ -7,7 +7,7 @@ module Facts
7
7
  FACT_NAME = 'networking.interfaces'
8
8
 
9
9
  def call_the_resolver
10
- interfaces = Facter::Resolvers::Macosx::Networking.resolve(:interfaces)
10
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
11
11
 
12
12
  Facter::ResolvedFact.new(FACT_NAME, interfaces)
13
13
  end
@@ -8,7 +8,7 @@ module Facts
8
8
  ALIASES = 'ipaddress'
9
9
 
10
10
  def call_the_resolver
11
- fact_value = Facter::Resolvers::Macosx::Networking.resolve(:ip)
11
+ fact_value = Facter::Resolvers::Networking.resolve(:ip)
12
12
 
13
13
  [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
14
  end
@@ -8,7 +8,7 @@ module Facts
8
8
  ALIASES = 'ipaddress6'
9
9
 
10
10
  def call_the_resolver
11
- fact_value = Facter::Resolvers::Macosx::Networking.resolve(:ip6)
11
+ fact_value = Facter::Resolvers::Networking.resolve(:ip6)
12
12
 
13
13
  [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
14
  end
@@ -8,7 +8,7 @@ module Facts
8
8
  ALIASES = 'macaddress'
9
9
 
10
10
  def call_the_resolver
11
- fact_value = Facter::Resolvers::Macosx::Networking.resolve(:mac)
11
+ fact_value = Facter::Resolvers::Networking.resolve(:mac)
12
12
 
13
13
  [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
14
  end
@@ -7,7 +7,7 @@ module Facts
7
7
  FACT_NAME = 'networking.mtu'
8
8
 
9
9
  def call_the_resolver
10
- fact_value = Facter::Resolvers::Macosx::Networking.resolve(:mtu)
10
+ fact_value = Facter::Resolvers::Networking.resolve(:mtu)
11
11
 
12
12
  Facter::ResolvedFact.new(FACT_NAME, fact_value)
13
13
  end
@@ -8,7 +8,7 @@ module Facts
8
8
  ALIASES = 'netmask'
9
9
 
10
10
  def call_the_resolver
11
- fact_value = Facter::Resolvers::Macosx::Networking.resolve(:netmask)
11
+ fact_value = Facter::Resolvers::Networking.resolve(:netmask)
12
12
 
13
13
  [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
14
  end
@@ -8,7 +8,7 @@ module Facts
8
8
  ALIASES = 'netmask6'
9
9
 
10
10
  def call_the_resolver
11
- fact_value = Facter::Resolvers::Macosx::Networking.resolve(:netmask6)
11
+ fact_value = Facter::Resolvers::Networking.resolve(:netmask6)
12
12
 
13
13
  [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
14
  end
@@ -8,7 +8,7 @@ module Facts
8
8
  ALIASES = 'network'
9
9
 
10
10
  def call_the_resolver
11
- fact_value = Facter::Resolvers::Macosx::Networking.resolve(:network)
11
+ fact_value = Facter::Resolvers::Networking.resolve(:network)
12
12
 
13
13
  [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
14
  end
@@ -8,7 +8,7 @@ module Facts
8
8
  ALIASES = 'network6'
9
9
 
10
10
  def call_the_resolver
11
- fact_value = Facter::Resolvers::Macosx::Networking.resolve(:network6)
11
+ fact_value = Facter::Resolvers::Networking.resolve(:network6)
12
12
 
13
13
  [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
14
  end
@@ -7,7 +7,7 @@ module Facts
7
7
  FACT_NAME = 'networking.primary'
8
8
 
9
9
  def call_the_resolver
10
- fact_value = Facter::Resolvers::Macosx::Networking.resolve(:primary_interface)
10
+ fact_value = Facter::Resolvers::Networking.resolve(:primary_interface)
11
11
 
12
12
  Facter::ResolvedFact.new(FACT_NAME, fact_value)
13
13
  end
@@ -7,7 +7,7 @@ module Facts
7
7
  FACT_NAME = 'networking.scope6'
8
8
 
9
9
  def call_the_resolver
10
- fact_value = Facter::Resolvers::Macosx::Networking.resolve(:scope6)
10
+ fact_value = Facter::Resolvers::Networking.resolve(:scope6)
11
11
 
12
12
  Facter::ResolvedFact.new(FACT_NAME, fact_value)
13
13
  end
@@ -8,8 +8,8 @@ module Facts
8
8
 
9
9
  def call_the_resolver
10
10
  resolved_facts = []
11
- interfaces = Facter::Resolvers::Macosx::Networking.resolve(:interfaces)
12
- primary_scope6 = Facter::Resolvers::Macosx::Networking.resolve(:scope6)
11
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
12
+ primary_scope6 = Facter::Resolvers::Networking.resolve(:scope6)
13
13
 
14
14
  interfaces&.each do |interface_name, info|
15
15
  if info[:scope6]
@@ -6,22 +6,30 @@ module Facts
6
6
  FACT_NAME = 'ssh'
7
7
 
8
8
  def call_the_resolver
9
- result = Facter::Resolvers::SshResolver.resolve(:ssh)
10
- ssh_facts = {}
11
- result.each { |ssh| ssh_facts.merge!(create_ssh_fact(ssh)) }
12
-
13
- ssh_facts = nil if ssh_facts.empty?
14
- Facter::ResolvedFact.new(FACT_NAME, ssh_facts)
9
+ Facter::ResolvedFact.new(FACT_NAME, fact_value)
15
10
  end
16
11
 
17
12
  private
18
13
 
14
+ def fact_value
15
+ resolver_data.map { |el| create_ssh_fact(el) }.inject(:merge)
16
+ end
17
+
18
+ def resolver_data
19
+ Facter::Resolvers::SshResolver.resolve(:ssh)
20
+ end
21
+
19
22
  def create_ssh_fact(ssh)
20
- { ssh.name.to_sym =>
21
- { fingerprints: { sha1: ssh.fingerprint.sha1,
22
- sha256: ssh.fingerprint.sha256 },
23
- key: ssh.key,
24
- type: ssh.type } }
23
+ return {} unless ssh
24
+
25
+ { ssh.name.to_sym => {
26
+ fingerprints: {
27
+ sha1: ssh.fingerprint.sha1,
28
+ sha256: ssh.fingerprint.sha256
29
+ },
30
+ key: ssh.key,
31
+ type: ssh.type
32
+ } }
25
33
  end
26
34
  end
27
35
  end