facter 4.6.1 → 4.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/docs/generate.rb +6 -1
- data/lib/facter/config.rb +3 -2
- data/lib/facter/custom_facts/core/aggregate.rb +5 -1
- data/lib/facter/custom_facts/util/confine.rb +4 -2
- data/lib/facter/facts/linux/cloud/provider.rb +6 -3
- data/lib/facter/facts/openbsd/augeas/version.rb +19 -0
- data/lib/facter/facts/openbsd/dmi/bios/vendor.rb +19 -0
- data/lib/facter/facts/openbsd/dmi/bios/version.rb +19 -0
- data/lib/facter/facts/openbsd/dmi/manufacturer.rb +17 -0
- data/lib/facter/facts/openbsd/dmi/product/name.rb +19 -0
- data/lib/facter/facts/openbsd/dmi/product/serial_number.rb +19 -0
- data/lib/facter/facts/openbsd/dmi/product/uuid.rb +19 -0
- data/lib/facter/facts/openbsd/ec2_metadata.rb +23 -0
- data/lib/facter/facts/openbsd/ec2_userdata.rb +23 -0
- data/lib/facter/facts/openbsd/facterversion.rb +14 -0
- data/lib/facter/facts/openbsd/identity/gid.rb +16 -0
- data/lib/facter/facts/openbsd/identity/group.rb +18 -0
- data/lib/facter/facts/openbsd/identity/privileged.rb +16 -0
- data/lib/facter/facts/openbsd/identity/uid.rb +16 -0
- data/lib/facter/facts/openbsd/identity/user.rb +17 -0
- data/lib/facter/facts/openbsd/ipaddress6_interfaces.rb +20 -0
- data/lib/facter/facts/openbsd/ipaddress_interfaces.rb +20 -0
- data/lib/facter/facts/openbsd/is_virtual.rb +21 -0
- data/lib/facter/facts/openbsd/kernel.rb +14 -0
- data/lib/facter/facts/openbsd/kernelrelease.rb +14 -0
- data/lib/facter/facts/openbsd/mountpoints.rb +21 -0
- data/lib/facter/facts/openbsd/netmask6_interfaces.rb +20 -0
- data/lib/facter/facts/openbsd/netmask_interfaces.rb +20 -0
- data/lib/facter/facts/openbsd/network6_interfaces.rb +20 -0
- data/lib/facter/facts/openbsd/network_interfaces.rb +20 -0
- data/lib/facter/facts/openbsd/networking/dhcp.rb +17 -0
- data/lib/facter/facts/openbsd/networking/domain.rb +18 -0
- data/lib/facter/facts/openbsd/networking/fqdn.rb +18 -0
- data/lib/facter/facts/openbsd/networking/hostname.rb +18 -0
- data/lib/facter/facts/openbsd/networking/interfaces.rb +17 -0
- data/lib/facter/facts/openbsd/networking/ip.rb +18 -0
- data/lib/facter/facts/openbsd/networking/ip6.rb +18 -0
- data/lib/facter/facts/openbsd/networking/mac.rb +18 -0
- data/lib/facter/facts/openbsd/networking/mtu.rb +17 -0
- data/lib/facter/facts/openbsd/networking/netmask.rb +18 -0
- data/lib/facter/facts/openbsd/networking/netmask6.rb +18 -0
- data/lib/facter/facts/openbsd/networking/network.rb +18 -0
- data/lib/facter/facts/openbsd/networking/network6.rb +18 -0
- data/lib/facter/facts/openbsd/networking/primary.rb +17 -0
- data/lib/facter/facts/openbsd/networking/scope6.rb +17 -0
- data/lib/facter/facts/openbsd/os/architecture.rb +18 -0
- data/lib/facter/facts/openbsd/os/hardware.rb +18 -0
- data/lib/facter/facts/openbsd/os/name.rb +18 -0
- data/lib/facter/facts/openbsd/os/release.rb +23 -0
- data/lib/facter/facts/openbsd/path.rb +15 -0
- data/lib/facter/facts/openbsd/processors/isa.rb +17 -0
- data/lib/facter/facts/openbsd/ruby/platform.rb +18 -0
- data/lib/facter/facts/openbsd/ruby/sitedir.rb +18 -0
- data/lib/facter/facts/openbsd/ruby/version.rb +18 -0
- data/lib/facter/facts/openbsd/ssh.rb +26 -0
- data/lib/facter/facts/openbsd/sshalgorithmkey.rb +17 -0
- data/lib/facter/facts/openbsd/sshfp_algorithm.rb +20 -0
- data/lib/facter/facts/openbsd/system_uptime/days.rb +18 -0
- data/lib/facter/facts/openbsd/system_uptime/hours.rb +18 -0
- data/lib/facter/facts/openbsd/system_uptime/seconds.rb +18 -0
- data/lib/facter/facts/openbsd/system_uptime/uptime.rb +18 -0
- data/lib/facter/facts/openbsd/timezone.rb +15 -0
- data/lib/facter/facts/openbsd/virtual.rb +15 -0
- data/lib/facter/facts/solaris/ldom.rb +1 -1
- data/lib/facter/facts/windows/cloud/provider.rb +6 -3
- data/lib/facter/framework/cli/cli.rb +3 -3
- data/lib/facter/framework/core/file_loader.rb +59 -0
- data/lib/facter/framework/detector/os_detector.rb +2 -0
- data/lib/facter/framework/logging/logger.rb +3 -2
- data/lib/facter/resolvers/aix/serialnumber.rb +1 -1
- data/lib/facter/resolvers/az.rb +1 -1
- data/lib/facter/resolvers/base_resolver.rb +3 -2
- data/lib/facter/resolvers/bsd/processors.rb +0 -1
- data/lib/facter/resolvers/disks.rb +0 -2
- data/lib/facter/resolvers/dmi.rb +0 -2
- data/lib/facter/resolvers/ec2.rb +1 -1
- data/lib/facter/resolvers/filesystems.rb +0 -2
- data/lib/facter/resolvers/fips_enabled.rb +0 -2
- data/lib/facter/resolvers/freebsd/processors.rb +0 -1
- data/lib/facter/resolvers/freebsd/swap_memory.rb +1 -1
- data/lib/facter/resolvers/gce.rb +1 -1
- data/lib/facter/resolvers/hostname.rb +5 -0
- data/lib/facter/resolvers/identity.rb +0 -2
- data/lib/facter/resolvers/macosx/mountpoints.rb +0 -2
- data/lib/facter/resolvers/memory.rb +0 -2
- data/lib/facter/resolvers/mountpoints.rb +0 -2
- data/lib/facter/resolvers/networking.rb +1 -1
- data/lib/facter/resolvers/openbsd/dhcp.rb +21 -0
- data/lib/facter/resolvers/openbsd/dmi.rb +41 -0
- data/lib/facter/resolvers/openbsd/mountpoints.rb +72 -0
- data/lib/facter/resolvers/openbsd/virtual.rb +45 -0
- data/lib/facter/resolvers/partitions.rb +2 -2
- data/lib/facter/resolvers/processors.rb +0 -2
- data/lib/facter/resolvers/solaris/mountpoints.rb +0 -2
- data/lib/facter/resolvers/solaris/networking.rb +0 -1
- data/lib/facter/resolvers/ssh.rb +0 -2
- data/lib/facter/resolvers/windows/dmi_bios.rb +0 -1
- data/lib/facter/resolvers/windows/dmi_computersystem.rb +0 -1
- data/lib/facter/resolvers/windows/hardware_architecture.rb +0 -1
- data/lib/facter/resolvers/windows/identity.rb +0 -1
- data/lib/facter/resolvers/windows/kernel.rb +0 -2
- data/lib/facter/resolvers/windows/memory.rb +0 -2
- data/lib/facter/resolvers/windows/networking.rb +0 -1
- data/lib/facter/resolvers/windows/ssh.rb +0 -2
- data/lib/facter/resolvers/windows/system32.rb +0 -2
- data/lib/facter/resolvers/windows/timezone.rb +0 -1
- data/lib/facter/resolvers/windows/uptime.rb +0 -2
- data/lib/facter/resolvers/windows/virtualization.rb +9 -4
- data/lib/facter/resolvers/windows/win_os_description.rb +0 -2
- data/lib/facter/resolvers/xen.rb +2 -0
- data/lib/facter/templates/man.erb +5 -2
- data/lib/facter/util/api_debugger.rb +2 -2
- data/lib/facter/util/facts/posix/virtual_detector.rb +7 -1
- data/lib/facter/util/resolvers/http.rb +31 -20
- data/lib/facter/version.rb +1 -1
- metadata +99 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 512cdd220f22069dbf686592dfc08d3b4ecccf97702313117b333d5e568ebe8e
|
4
|
+
data.tar.gz: 373406fac7fe5ec363b13e6afa26acabfb6bb62716d9f0b977b1f2e768e6381d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed2f2ac6dcec58364ba37df4acee50fb44f90f46f6de28f8f2524aa89d8d5634e7499be547234e65e4930126e59652b0d6b56f2d602e74598227d7808c504bf7
|
7
|
+
data.tar.gz: ef408018f71cd5884a56cf0dc3aab243fe119978e45c99e4b8069242d4ecf27011a3c106b53f12960665729bc0209aee452a02138e6642749f2c2b51e46a67bc
|
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
|
-
|
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
@@ -109,7 +109,7 @@ module Facter
|
|
109
109
|
# @api private
|
110
110
|
def evaluate(&block)
|
111
111
|
if @last_evaluated
|
112
|
-
msg = "Already evaluated #{@name}"
|
112
|
+
msg = +"Already evaluated #{@name}"
|
113
113
|
msg << " at #{@last_evaluated}" if msg.is_a? String
|
114
114
|
msg << ', reevaluating anyways'
|
115
115
|
log.warn msg
|
@@ -197,6 +197,10 @@ module Facter
|
|
197
197
|
|
198
198
|
private
|
199
199
|
|
200
|
+
def log
|
201
|
+
@log ||= Facter::Log.new(self)
|
202
|
+
end
|
203
|
+
|
200
204
|
def evaluate_params(name)
|
201
205
|
raise ArgumentError, "#{self.class.name}#chunk requires a block" unless block_given?
|
202
206
|
raise ArgumentError, "#{self.class.name}#expected chunk name to be a Symbol" unless name.is_a? Symbol
|
@@ -35,7 +35,7 @@ module LegacyFacter
|
|
35
35
|
end
|
36
36
|
|
37
37
|
# Evaluate the fact, returning true or false.
|
38
|
-
# if we have a block
|
38
|
+
# if we have a block parameter then we only evaluate that instead
|
39
39
|
def true?
|
40
40
|
if @block && !@fact
|
41
41
|
begin
|
@@ -54,9 +54,11 @@ module LegacyFacter
|
|
54
54
|
|
55
55
|
return false if value.nil?
|
56
56
|
|
57
|
+
# We call the block with both the downcased and raw fact value for
|
58
|
+
# backwards-compatibility.
|
57
59
|
if @block
|
58
60
|
begin
|
59
|
-
return !!@block.call(value)
|
61
|
+
return !!@block.call(value) || !!@block.call(fact.value) # rubocop:disable Style/DoubleNegation
|
60
62
|
rescue StandardError => e
|
61
63
|
log.debug "Confine raised #{e.class} #{e}"
|
62
64
|
return false
|
@@ -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
|
-
|
12
|
+
metadata = Facter::Resolvers::Az.resolve(:metadata)
|
13
|
+
'azure' unless metadata.nil? || metadata.empty?
|
13
14
|
when 'kvm', 'xen'
|
14
|
-
|
15
|
+
metadata = Facter::Resolvers::Ec2.resolve(:metadata)
|
16
|
+
'aws' unless metadata.nil? || metadata.empty?
|
15
17
|
when 'gce'
|
16
|
-
|
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
|