facter 4.6.0 → 4.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/lib/docs/generate.rb +6 -1
  3. data/lib/facter/config.rb +3 -2
  4. data/lib/facter/facts/linux/cloud/provider.rb +6 -3
  5. data/lib/facter/facts/openbsd/augeas/version.rb +19 -0
  6. data/lib/facter/facts/openbsd/dmi/bios/vendor.rb +19 -0
  7. data/lib/facter/facts/openbsd/dmi/bios/version.rb +19 -0
  8. data/lib/facter/facts/openbsd/dmi/manufacturer.rb +17 -0
  9. data/lib/facter/facts/openbsd/dmi/product/name.rb +19 -0
  10. data/lib/facter/facts/openbsd/dmi/product/serial_number.rb +19 -0
  11. data/lib/facter/facts/openbsd/dmi/product/uuid.rb +19 -0
  12. data/lib/facter/facts/openbsd/ec2_metadata.rb +23 -0
  13. data/lib/facter/facts/openbsd/ec2_userdata.rb +23 -0
  14. data/lib/facter/facts/openbsd/facterversion.rb +14 -0
  15. data/lib/facter/facts/openbsd/identity/gid.rb +16 -0
  16. data/lib/facter/facts/openbsd/identity/group.rb +18 -0
  17. data/lib/facter/facts/openbsd/identity/privileged.rb +16 -0
  18. data/lib/facter/facts/openbsd/identity/uid.rb +16 -0
  19. data/lib/facter/facts/openbsd/identity/user.rb +17 -0
  20. data/lib/facter/facts/openbsd/ipaddress6_interfaces.rb +20 -0
  21. data/lib/facter/facts/openbsd/ipaddress_interfaces.rb +20 -0
  22. data/lib/facter/facts/openbsd/is_virtual.rb +21 -0
  23. data/lib/facter/facts/openbsd/kernel.rb +14 -0
  24. data/lib/facter/facts/openbsd/kernelrelease.rb +14 -0
  25. data/lib/facter/facts/openbsd/mountpoints.rb +21 -0
  26. data/lib/facter/facts/openbsd/netmask6_interfaces.rb +20 -0
  27. data/lib/facter/facts/openbsd/netmask_interfaces.rb +20 -0
  28. data/lib/facter/facts/openbsd/network6_interfaces.rb +20 -0
  29. data/lib/facter/facts/openbsd/network_interfaces.rb +20 -0
  30. data/lib/facter/facts/openbsd/networking/dhcp.rb +17 -0
  31. data/lib/facter/facts/openbsd/networking/domain.rb +18 -0
  32. data/lib/facter/facts/openbsd/networking/fqdn.rb +18 -0
  33. data/lib/facter/facts/openbsd/networking/hostname.rb +18 -0
  34. data/lib/facter/facts/openbsd/networking/interfaces.rb +17 -0
  35. data/lib/facter/facts/openbsd/networking/ip.rb +18 -0
  36. data/lib/facter/facts/openbsd/networking/ip6.rb +18 -0
  37. data/lib/facter/facts/openbsd/networking/mac.rb +18 -0
  38. data/lib/facter/facts/openbsd/networking/mtu.rb +17 -0
  39. data/lib/facter/facts/openbsd/networking/netmask.rb +18 -0
  40. data/lib/facter/facts/openbsd/networking/netmask6.rb +18 -0
  41. data/lib/facter/facts/openbsd/networking/network.rb +18 -0
  42. data/lib/facter/facts/openbsd/networking/network6.rb +18 -0
  43. data/lib/facter/facts/openbsd/networking/primary.rb +17 -0
  44. data/lib/facter/facts/openbsd/networking/scope6.rb +17 -0
  45. data/lib/facter/facts/openbsd/os/architecture.rb +18 -0
  46. data/lib/facter/facts/openbsd/os/hardware.rb +18 -0
  47. data/lib/facter/facts/openbsd/os/name.rb +18 -0
  48. data/lib/facter/facts/openbsd/os/release.rb +23 -0
  49. data/lib/facter/facts/openbsd/path.rb +15 -0
  50. data/lib/facter/facts/openbsd/processors/isa.rb +17 -0
  51. data/lib/facter/facts/openbsd/ruby/platform.rb +18 -0
  52. data/lib/facter/facts/openbsd/ruby/sitedir.rb +18 -0
  53. data/lib/facter/facts/openbsd/ruby/version.rb +18 -0
  54. data/lib/facter/facts/openbsd/ssh.rb +26 -0
  55. data/lib/facter/facts/openbsd/sshalgorithmkey.rb +17 -0
  56. data/lib/facter/facts/openbsd/sshfp_algorithm.rb +20 -0
  57. data/lib/facter/facts/openbsd/system_uptime/days.rb +18 -0
  58. data/lib/facter/facts/openbsd/system_uptime/hours.rb +18 -0
  59. data/lib/facter/facts/openbsd/system_uptime/seconds.rb +18 -0
  60. data/lib/facter/facts/openbsd/system_uptime/uptime.rb +18 -0
  61. data/lib/facter/facts/openbsd/timezone.rb +15 -0
  62. data/lib/facter/facts/openbsd/virtual.rb +15 -0
  63. data/lib/facter/facts/solaris/ldom.rb +1 -1
  64. data/lib/facter/facts/windows/cloud/provider.rb +6 -3
  65. data/lib/facter/framework/cli/cli.rb +3 -3
  66. data/lib/facter/framework/core/file_loader.rb +59 -0
  67. data/lib/facter/framework/detector/os_detector.rb +2 -0
  68. data/lib/facter/resolvers/aix/serialnumber.rb +1 -1
  69. data/lib/facter/resolvers/freebsd/swap_memory.rb +1 -1
  70. data/lib/facter/resolvers/networking.rb +1 -1
  71. data/lib/facter/resolvers/openbsd/dhcp.rb +21 -0
  72. data/lib/facter/resolvers/openbsd/dmi.rb +41 -0
  73. data/lib/facter/resolvers/openbsd/mountpoints.rb +72 -0
  74. data/lib/facter/resolvers/openbsd/virtual.rb +45 -0
  75. data/lib/facter/resolvers/partitions.rb +2 -2
  76. data/lib/facter/resolvers/windows/product_release.rb +1 -1
  77. data/lib/facter/util/api_debugger.rb +2 -2
  78. data/lib/facter/util/facts/posix/virtual_detector.rb +7 -1
  79. data/lib/facter/version.rb +1 -1
  80. metadata +73 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9cde774257133c7283c2bd6a697e8892d2614ee63d89b52d64648eb6cb8e92c2
4
- data.tar.gz: a24ba725108a86b796e07cfd01f3f9ed11c03558f7fba8df77e213fbc48c3c62
3
+ metadata.gz: 101e10975c853baea839c1f0b5afc9d409f85df720a581d2987cf61cb50101af
4
+ data.tar.gz: 828a50d3cf221d2bec58e90400684d25c9adff0b3fe93c39535e1136dc628e34
5
5
  SHA512:
6
- metadata.gz: 2fa441a192b26deafd97f2cda183d2aff0194dcdbd40fb7c75c610cb8e3678fbefdd29d16d7f262da3d6e45f89f99a87cdaf305100552e1d8bf4050a4fe7562d
7
- data.tar.gz: a512d5720fcd1d4af1b4334a1d99831642c0cecf9f0f6a61d37d9561fa83b2eda4f1724c81b2afb324502a7171a77c7b837275f3f8530de872c6fc51d19c9217
6
+ metadata.gz: 4d367e6d5b5b248767d77464e02f99951219bdd99108990fb2b4af0724c769f9dba18073e382ba244b81413d486547a284ae949779f31a2a0a5299d1b7a448cf
7
+ data.tar.gz: af8d6958c1cc05eb883fc5479c863c6613fb49737ea38c251cb7facd3c05ab6c57990334f419604b3102a05736182756daed55492c5644c849c3f71e1d7acd76
data/lib/docs/generate.rb CHANGED
@@ -17,7 +17,12 @@ def format_facts(fact_hash)
17
17
  scope = OpenStruct.new({
18
18
  facts: fact_hash
19
19
  })
20
- erb = ERB.new(File.read(PATH_TO_TEMPLATE), trim_mode: '-')
20
+
21
+ erb = if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
22
+ ERB.new(File.read(PATH_TO_TEMPLATE), trim_mode: '-')
23
+ else
24
+ ERB.new(File.read(PATH_TO_TEMPLATE), nil, '-')
25
+ end
21
26
  erb.result(scope.instance_eval { binding })
22
27
  end
23
28
 
data/lib/facter/config.rb CHANGED
@@ -44,8 +44,9 @@ module Facter
44
44
  ]
45
45
  },
46
46
  {
47
- 'Bsd' => [
48
- 'Freebsd'
47
+ 'Bsd' => %w[
48
+ Freebsd
49
+ Openbsd
49
50
  ]
50
51
  },
51
52
  'Solaris',
@@ -9,11 +9,14 @@ module Facts
9
9
  def call_the_resolver
10
10
  provider = case Facter::Util::Facts::Posix::VirtualDetector.platform
11
11
  when 'hyperv'
12
- 'azure' unless Facter::Resolvers::Az.resolve(:metadata).empty?
12
+ metadata = Facter::Resolvers::Az.resolve(:metadata)
13
+ 'azure' unless metadata.nil? || metadata.empty?
13
14
  when 'kvm', 'xen'
14
- 'aws' unless Facter::Resolvers::Ec2.resolve(:metadata).empty?
15
+ metadata = Facter::Resolvers::Ec2.resolve(:metadata)
16
+ 'aws' unless metadata.nil? || metadata.empty?
15
17
  when 'gce'
16
- 'gce' unless Facter::Resolvers::Gce.resolve(:metadata).empty?
18
+ metadata = Facter::Resolvers::Gce.resolve(:metadata)
19
+ 'gce' unless metadata.nil? || metadata.empty?
17
20
  end
18
21
 
19
22
  Facter::ResolvedFact.new(FACT_NAME, provider)
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ module Augeas
6
+ class Version
7
+ FACT_NAME = 'augeas.version'
8
+ ALIASES = 'augeasversion'
9
+
10
+ def call_the_resolver
11
+ fact_value = Facter::Resolvers::Augeas.resolve(:augeas_version)
12
+
13
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value),
14
+ Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ module Dmi
6
+ module Bios
7
+ class Vendor
8
+ FACT_NAME = 'dmi.bios.vendor'
9
+ ALIASES = 'bios_vendor'
10
+
11
+ def call_the_resolver
12
+ fact_value = Facter::Resolvers::Openbsd::DmiBios.resolve(:bios_vendor)
13
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ module Dmi
6
+ module Bios
7
+ class Version
8
+ FACT_NAME = 'dmi.bios.version'
9
+ ALIASES = 'bios_version'
10
+
11
+ def call_the_resolver
12
+ fact_value = Facter::Resolvers::Openbsd::DmiBios.resolve(:bios_version)
13
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ module Dmi
6
+ class Manufacturer
7
+ FACT_NAME = 'dmi.manufacturer'
8
+ ALIASES = 'manufacturer'
9
+
10
+ def call_the_resolver
11
+ fact_value = Facter::Resolvers::Openbsd::DmiBios.resolve(:sys_vendor)
12
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ module Dmi
6
+ module Product
7
+ class Name
8
+ FACT_NAME = 'dmi.product.name'
9
+ ALIASES = 'productname'
10
+
11
+ def call_the_resolver
12
+ fact_value = Facter::Resolvers::Openbsd::DmiBios.resolve(:product_name)
13
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ module Dmi
6
+ module Product
7
+ class SerialNumber
8
+ FACT_NAME = 'dmi.product.serial_number'
9
+ ALIASES = 'serialnumber'
10
+
11
+ def call_the_resolver
12
+ fact_value = Facter::Resolvers::Openbsd::DmiBios.resolve(:product_serial)
13
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ module Dmi
6
+ module Product
7
+ class Uuid
8
+ FACT_NAME = 'dmi.product.uuid'
9
+ ALIASES = 'uuid'
10
+
11
+ def call_the_resolver
12
+ fact_value = Facter::Resolvers::Openbsd::DmiBios.resolve(:product_uuid)
13
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ class Ec2Metadata
6
+ FACT_NAME = 'ec2_metadata'
7
+
8
+ def call_the_resolver
9
+ return Facter::ResolvedFact.new(FACT_NAME, nil) unless aws_hypervisors?
10
+
11
+ fact_value = Facter::Resolvers::Ec2.resolve(:metadata)
12
+
13
+ Facter::ResolvedFact.new(FACT_NAME, fact_value&.empty? ? nil : fact_value)
14
+ end
15
+
16
+ private
17
+
18
+ def aws_hypervisors?
19
+ Facter::Util::Facts::Posix::VirtualDetector.platform =~ /kvm|xen|aws/
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ class Ec2Userdata
6
+ FACT_NAME = 'ec2_userdata'
7
+
8
+ def call_the_resolver
9
+ return Facter::ResolvedFact.new(FACT_NAME, nil) unless aws_hypervisors?
10
+
11
+ fact_value = Facter::Resolvers::Ec2.resolve(:userdata)
12
+
13
+ Facter::ResolvedFact.new(FACT_NAME, fact_value&.empty? ? nil : fact_value)
14
+ end
15
+
16
+ private
17
+
18
+ def aws_hypervisors?
19
+ Facter::Util::Facts::Posix::VirtualDetector.platform =~ /kvm|xen|aws/
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ class Facterversion
6
+ FACT_NAME = 'facterversion'
7
+
8
+ def call_the_resolver
9
+ fact_value = Facter::Resolvers::Facterversion.resolve(:facterversion)
10
+ Facter::ResolvedFact.new(FACT_NAME, fact_value)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ module Identity
6
+ class Gid
7
+ FACT_NAME = 'identity.gid'
8
+
9
+ def call_the_resolver
10
+ fact_value = Facter::Resolvers::PosxIdentity.resolve(:gid)
11
+ Facter::ResolvedFact.new(FACT_NAME, fact_value)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ module Identity
6
+ class Group
7
+ FACT_NAME = 'identity.group'
8
+ ALIASES = 'gid'
9
+
10
+ def call_the_resolver
11
+ fact_value = Facter::Resolvers::PosxIdentity.resolve(:group)
12
+
13
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ module Identity
6
+ class Privileged
7
+ FACT_NAME = 'identity.privileged'
8
+
9
+ def call_the_resolver
10
+ fact_value = Facter::Resolvers::PosxIdentity.resolve(:privileged)
11
+ Facter::ResolvedFact.new(FACT_NAME, fact_value)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ module Identity
6
+ class Uid
7
+ FACT_NAME = 'identity.uid'
8
+
9
+ def call_the_resolver
10
+ fact_value = Facter::Resolvers::PosxIdentity.resolve(:uid)
11
+ Facter::ResolvedFact.new(FACT_NAME, fact_value)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ module Identity
6
+ class User
7
+ FACT_NAME = 'identity.user'
8
+ ALIASES = 'id'
9
+
10
+ def call_the_resolver
11
+ fact_value = Facter::Resolvers::PosxIdentity.resolve(:user)
12
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ class Ipaddress6Interfaces
6
+ FACT_NAME = 'ipaddress6_.*'
7
+ TYPE = :legacy
8
+
9
+ def call_the_resolver
10
+ arr = []
11
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
12
+ interfaces&.each do |interface_name, info|
13
+ arr << Facter::ResolvedFact.new("ipaddress6_#{interface_name}", info[:ip6], :legacy) if info[:ip6]
14
+ end
15
+
16
+ arr
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ class IpaddressInterfaces
6
+ FACT_NAME = 'ipaddress_.*'
7
+ TYPE = :legacy
8
+
9
+ def call_the_resolver
10
+ arr = []
11
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
12
+ interfaces&.each do |interface_name, info|
13
+ arr << Facter::ResolvedFact.new("ipaddress_#{interface_name}", info[:ip], :legacy) if info[:ip]
14
+ end
15
+
16
+ arr
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ class IsVirtual
6
+ FACT_NAME = 'is_virtual'
7
+
8
+ def call_the_resolver
9
+ fact_value = Facter::Util::Facts::Posix::VirtualDetector.platform
10
+
11
+ Facter::ResolvedFact.new(FACT_NAME, check_if_virtual(fact_value))
12
+ end
13
+
14
+ private
15
+
16
+ def check_if_virtual(found_vm)
17
+ Facter::Util::Facts::PHYSICAL_HYPERVISORS.count(found_vm).zero?
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ class Kernel
6
+ FACT_NAME = 'kernel'
7
+
8
+ def call_the_resolver
9
+ fact_value = Facter::Resolvers::Uname.resolve(:kernelname)
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 Openbsd
5
+ class Kernelrelease
6
+ FACT_NAME = 'kernelrelease'
7
+
8
+ def call_the_resolver
9
+ fact_value = Facter::Resolvers::Uname.resolve(:kernelrelease)
10
+ Facter::ResolvedFact.new(FACT_NAME, fact_value)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ class Mountpoints
6
+ FACT_NAME = 'mountpoints'
7
+
8
+ def call_the_resolver
9
+ mountpoints = Facter::Resolvers::Openbsd::Mountpoints.resolve(FACT_NAME.to_sym)
10
+ return Facter::ResolvedFact.new(FACT_NAME, nil) unless mountpoints
11
+
12
+ fact = {}
13
+ mountpoints.each do |path, mnt|
14
+ fact[path.to_sym] = mnt.reject { |k| k == :path }
15
+ end
16
+
17
+ Facter::ResolvedFact.new(FACT_NAME, fact)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ class Netmask6Interfaces
6
+ FACT_NAME = 'netmask6_.*'
7
+ TYPE = :legacy
8
+
9
+ def call_the_resolver
10
+ arr = []
11
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
12
+ interfaces&.each do |interface_name, info|
13
+ arr << Facter::ResolvedFact.new("netmask6_#{interface_name}", info[:netmask6], :legacy) if info[:netmask6]
14
+ end
15
+
16
+ arr
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ class NetmaskInterfaces
6
+ FACT_NAME = 'netmask_.*'
7
+ TYPE = :legacy
8
+
9
+ def call_the_resolver
10
+ arr = []
11
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
12
+ interfaces&.each do |interface_name, info|
13
+ arr << Facter::ResolvedFact.new("netmask_#{interface_name}", info[:netmask], :legacy) if info[:netmask]
14
+ end
15
+
16
+ arr
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ class Network6Interfaces
6
+ FACT_NAME = 'network6_.*'
7
+ TYPE = :legacy
8
+
9
+ def call_the_resolver
10
+ arr = []
11
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
12
+ interfaces&.each do |interface_name, info|
13
+ arr << Facter::ResolvedFact.new("network6_#{interface_name}", info[:network6], :legacy) if info[:network6]
14
+ end
15
+
16
+ arr
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ class NetworkInterfaces
6
+ FACT_NAME = 'network_.*'
7
+ TYPE = :legacy
8
+
9
+ def call_the_resolver
10
+ arr = []
11
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
12
+ interfaces&.each do |interface_name, info|
13
+ arr << Facter::ResolvedFact.new("network_#{interface_name}", info[:network], :legacy) if info[:network]
14
+ end
15
+
16
+ arr
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ module Networking
6
+ class Dhcp
7
+ FACT_NAME = 'networking.dhcp'
8
+
9
+ def call_the_resolver
10
+ fact_value = Facter::Resolvers::Openbsd::Dhcp.resolve(:dhcp)
11
+
12
+ Facter::ResolvedFact.new(FACT_NAME, fact_value)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ module Networking
6
+ class Domain
7
+ FACT_NAME = 'networking.domain'
8
+ ALIASES = 'domain'
9
+
10
+ def call_the_resolver
11
+ fact_value = Facter::Resolvers::Hostname.resolve(:domain)
12
+
13
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ module Networking
6
+ class Fqdn
7
+ FACT_NAME = 'networking.fqdn'
8
+ ALIASES = 'fqdn'
9
+
10
+ def call_the_resolver
11
+ fact_value = Facter::Resolvers::Hostname.resolve(:fqdn)
12
+
13
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ module Networking
6
+ class Hostname
7
+ FACT_NAME = 'networking.hostname'
8
+ ALIASES = 'hostname'
9
+
10
+ def call_the_resolver
11
+ fact_value = Facter::Resolvers::Hostname.resolve(:hostname)
12
+
13
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ module Networking
6
+ class Interfaces
7
+ FACT_NAME = 'networking.interfaces'
8
+
9
+ def call_the_resolver
10
+ fact_value = Facter::Resolvers::Networking.resolve(:interfaces)
11
+
12
+ Facter::ResolvedFact.new(FACT_NAME, fact_value)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Openbsd
5
+ module Networking
6
+ class Ip
7
+ FACT_NAME = 'networking.ip'
8
+ ALIASES = 'ipaddress'
9
+
10
+ def call_the_resolver
11
+ fact_value = Facter::Resolvers::Networking.resolve(:ip)
12
+
13
+ [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)]
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end