diff --git a/.rubocop.yml b/.rubocop.yml index 5700491c89..8489273753 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -55,10 +55,27 @@ Metrics/AbcSize: Enabled: false Metrics/PerceivedComplexity: - Enabled: false + Exclude: + - 'lib/facter/custom_facts/util/values.rb' + - 'lib/facter/custom_facts/util/confine.rb' + - 'lib/facter/custom_facts/core/execution/windows.rb' + - 'lib/facter/custom_facts/core/execution/posix.rb' + - 'install.rb' + - 'lib/facter/resolvers/aix/ffi/ffi_helper.rb' Metrics/CyclomaticComplexity: - Enabled: false + Exclude: + - 'lib/facter/resolvers/windows/product_release.rb' + - 'lib/facter/custom_facts/util/values.rb' + - 'lib/facter/custom_facts/util/confine.rb' + - 'lib/facter/custom_facts/core/execution/windows.rb' + - 'lib/facter/custom_facts/core/execution/posix.rb' + - 'lib/facter/facts/linux/cloud/provider.rb' + - 'lib/facter/facts/windows/cloud/provider.rb' + - 'lib/facter/framework/detector/os_detector.rb' + - 'install.rb' + - 'scripts/generate_changelog.rb' + - 'lib/facter/resolvers/aix/ffi/ffi_helper.rb' Metrics/ClassLength: Enabled: false diff --git a/lib/facter/config.rb b/lib/facter/config.rb index 4ae2dc5d79..2f236cb8c2 100644 --- a/lib/facter/config.rb +++ b/lib/facter/config.rb @@ -44,9 +44,8 @@ module Config ] }, { - 'Bsd' => %w[ - Freebsd - Openbsd + 'Bsd' => [ + 'Freebsd' ] }, 'Solaris', diff --git a/lib/facter/facts/openbsd/augeas/version.rb b/lib/facter/facts/openbsd/augeas/version.rb deleted file mode 100644 index 50c31da1d1..0000000000 --- a/lib/facter/facts/openbsd/augeas/version.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Augeas - class Version - FACT_NAME = 'augeas.version' - ALIASES = 'augeasversion' - - def call_the_resolver - fact_value = Facter::Resolvers::Augeas.resolve(:augeas_version) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), - Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/dmi/bios/vendor.rb b/lib/facter/facts/openbsd/dmi/bios/vendor.rb deleted file mode 100644 index 46f084d9d0..0000000000 --- a/lib/facter/facts/openbsd/dmi/bios/vendor.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Dmi - module Bios - class Vendor - FACT_NAME = 'dmi.bios.vendor' - ALIASES = 'bios_vendor' - - def call_the_resolver - fact_value = Facter::Resolvers::Openbsd::DmiBios.resolve(:bios_vendor) - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/dmi/bios/version.rb b/lib/facter/facts/openbsd/dmi/bios/version.rb deleted file mode 100644 index ed4d5a8ea2..0000000000 --- a/lib/facter/facts/openbsd/dmi/bios/version.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Dmi - module Bios - class Version - FACT_NAME = 'dmi.bios.version' - ALIASES = 'bios_version' - - def call_the_resolver - fact_value = Facter::Resolvers::Openbsd::DmiBios.resolve(:bios_version) - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/dmi/manufacturer.rb b/lib/facter/facts/openbsd/dmi/manufacturer.rb deleted file mode 100644 index b0b27499ee..0000000000 --- a/lib/facter/facts/openbsd/dmi/manufacturer.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Dmi - class Manufacturer - FACT_NAME = 'dmi.manufacturer' - ALIASES = 'manufacturer' - - def call_the_resolver - fact_value = Facter::Resolvers::Openbsd::DmiBios.resolve(:sys_vendor) - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/dmi/product/name.rb b/lib/facter/facts/openbsd/dmi/product/name.rb deleted file mode 100644 index 74f5759327..0000000000 --- a/lib/facter/facts/openbsd/dmi/product/name.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Dmi - module Product - class Name - FACT_NAME = 'dmi.product.name' - ALIASES = 'productname' - - def call_the_resolver - fact_value = Facter::Resolvers::Openbsd::DmiBios.resolve(:product_name) - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/dmi/product/serial_number.rb b/lib/facter/facts/openbsd/dmi/product/serial_number.rb deleted file mode 100644 index 6927564f65..0000000000 --- a/lib/facter/facts/openbsd/dmi/product/serial_number.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Dmi - module Product - class SerialNumber - FACT_NAME = 'dmi.product.serial_number' - ALIASES = 'serialnumber' - - def call_the_resolver - fact_value = Facter::Resolvers::Openbsd::DmiBios.resolve(:product_serial) - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/dmi/product/uuid.rb b/lib/facter/facts/openbsd/dmi/product/uuid.rb deleted file mode 100644 index d990504d5a..0000000000 --- a/lib/facter/facts/openbsd/dmi/product/uuid.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Dmi - module Product - class Uuid - FACT_NAME = 'dmi.product.uuid' - ALIASES = 'uuid' - - def call_the_resolver - fact_value = Facter::Resolvers::Openbsd::DmiBios.resolve(:product_uuid) - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/ec2_metadata.rb b/lib/facter/facts/openbsd/ec2_metadata.rb deleted file mode 100644 index eadec9d1d7..0000000000 --- a/lib/facter/facts/openbsd/ec2_metadata.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class Ec2Metadata - FACT_NAME = 'ec2_metadata' - - def call_the_resolver - return Facter::ResolvedFact.new(FACT_NAME, nil) unless aws_hypervisors? - - fact_value = Facter::Resolvers::Ec2.resolve(:metadata) - - Facter::ResolvedFact.new(FACT_NAME, fact_value&.empty? ? nil : fact_value) - end - - private - - def aws_hypervisors? - Facter::Util::Facts::Posix::VirtualDetector.platform =~ /kvm|xen|aws/ - end - end - end -end diff --git a/lib/facter/facts/openbsd/ec2_userdata.rb b/lib/facter/facts/openbsd/ec2_userdata.rb deleted file mode 100644 index 223eed91c4..0000000000 --- a/lib/facter/facts/openbsd/ec2_userdata.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class Ec2Userdata - FACT_NAME = 'ec2_userdata' - - def call_the_resolver - return Facter::ResolvedFact.new(FACT_NAME, nil) unless aws_hypervisors? - - fact_value = Facter::Resolvers::Ec2.resolve(:userdata) - - Facter::ResolvedFact.new(FACT_NAME, fact_value&.empty? ? nil : fact_value) - end - - private - - def aws_hypervisors? - Facter::Util::Facts::Posix::VirtualDetector.platform =~ /kvm|xen|aws/ - end - end - end -end diff --git a/lib/facter/facts/openbsd/facterversion.rb b/lib/facter/facts/openbsd/facterversion.rb deleted file mode 100644 index 1cf7baeb1d..0000000000 --- a/lib/facter/facts/openbsd/facterversion.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class Facterversion - FACT_NAME = 'facterversion' - - def call_the_resolver - fact_value = Facter::Resolvers::Facterversion.resolve(:facterversion) - Facter::ResolvedFact.new(FACT_NAME, fact_value) - end - end - end -end diff --git a/lib/facter/facts/openbsd/identity/gid.rb b/lib/facter/facts/openbsd/identity/gid.rb deleted file mode 100644 index cdb2e604ac..0000000000 --- a/lib/facter/facts/openbsd/identity/gid.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Identity - class Gid - FACT_NAME = 'identity.gid' - - def call_the_resolver - fact_value = Facter::Resolvers::PosxIdentity.resolve(:gid) - Facter::ResolvedFact.new(FACT_NAME, fact_value) - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/identity/group.rb b/lib/facter/facts/openbsd/identity/group.rb deleted file mode 100644 index 6b6b67dad9..0000000000 --- a/lib/facter/facts/openbsd/identity/group.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Identity - class Group - FACT_NAME = 'identity.group' - ALIASES = 'gid' - - def call_the_resolver - fact_value = Facter::Resolvers::PosxIdentity.resolve(:group) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/identity/privileged.rb b/lib/facter/facts/openbsd/identity/privileged.rb deleted file mode 100644 index bf1d47fc5d..0000000000 --- a/lib/facter/facts/openbsd/identity/privileged.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Identity - class Privileged - FACT_NAME = 'identity.privileged' - - def call_the_resolver - fact_value = Facter::Resolvers::PosxIdentity.resolve(:privileged) - Facter::ResolvedFact.new(FACT_NAME, fact_value) - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/identity/uid.rb b/lib/facter/facts/openbsd/identity/uid.rb deleted file mode 100644 index b19fdb3ad8..0000000000 --- a/lib/facter/facts/openbsd/identity/uid.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Identity - class Uid - FACT_NAME = 'identity.uid' - - def call_the_resolver - fact_value = Facter::Resolvers::PosxIdentity.resolve(:uid) - Facter::ResolvedFact.new(FACT_NAME, fact_value) - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/identity/user.rb b/lib/facter/facts/openbsd/identity/user.rb deleted file mode 100644 index 21181ccddc..0000000000 --- a/lib/facter/facts/openbsd/identity/user.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Identity - class User - FACT_NAME = 'identity.user' - ALIASES = 'id' - - def call_the_resolver - fact_value = Facter::Resolvers::PosxIdentity.resolve(:user) - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/ipaddress6_interfaces.rb b/lib/facter/facts/openbsd/ipaddress6_interfaces.rb deleted file mode 100644 index fad08d2466..0000000000 --- a/lib/facter/facts/openbsd/ipaddress6_interfaces.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class Ipaddress6Interfaces - FACT_NAME = 'ipaddress6_.*' - TYPE = :legacy - - def call_the_resolver - arr = [] - interfaces = Facter::Resolvers::Networking.resolve(:interfaces) - interfaces&.each do |interface_name, info| - arr << Facter::ResolvedFact.new("ipaddress6_#{interface_name}", info[:ip6], :legacy) if info[:ip6] - end - - arr - end - end - end -end diff --git a/lib/facter/facts/openbsd/ipaddress_interfaces.rb b/lib/facter/facts/openbsd/ipaddress_interfaces.rb deleted file mode 100644 index c2f8e947b0..0000000000 --- a/lib/facter/facts/openbsd/ipaddress_interfaces.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class IpaddressInterfaces - FACT_NAME = 'ipaddress_.*' - TYPE = :legacy - - def call_the_resolver - arr = [] - interfaces = Facter::Resolvers::Networking.resolve(:interfaces) - interfaces&.each do |interface_name, info| - arr << Facter::ResolvedFact.new("ipaddress_#{interface_name}", info[:ip], :legacy) if info[:ip] - end - - arr - end - end - end -end diff --git a/lib/facter/facts/openbsd/is_virtual.rb b/lib/facter/facts/openbsd/is_virtual.rb deleted file mode 100644 index 0ee5f01007..0000000000 --- a/lib/facter/facts/openbsd/is_virtual.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class IsVirtual - FACT_NAME = 'is_virtual' - - def call_the_resolver - fact_value = Facter::Util::Facts::Posix::VirtualDetector.platform - - Facter::ResolvedFact.new(FACT_NAME, check_if_virtual(fact_value)) - end - - private - - def check_if_virtual(found_vm) - Facter::Util::Facts::PHYSICAL_HYPERVISORS.count(found_vm).zero? - end - end - end -end diff --git a/lib/facter/facts/openbsd/kernel.rb b/lib/facter/facts/openbsd/kernel.rb deleted file mode 100644 index cb5a9e8ada..0000000000 --- a/lib/facter/facts/openbsd/kernel.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class Kernel - FACT_NAME = 'kernel' - - def call_the_resolver - fact_value = Facter::Resolvers::Uname.resolve(:kernelname) - Facter::ResolvedFact.new(FACT_NAME, fact_value) - end - end - end -end diff --git a/lib/facter/facts/openbsd/kernelrelease.rb b/lib/facter/facts/openbsd/kernelrelease.rb deleted file mode 100644 index eaee8fbdc6..0000000000 --- a/lib/facter/facts/openbsd/kernelrelease.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class Kernelrelease - FACT_NAME = 'kernelrelease' - - def call_the_resolver - fact_value = Facter::Resolvers::Uname.resolve(:kernelrelease) - Facter::ResolvedFact.new(FACT_NAME, fact_value) - end - end - end -end diff --git a/lib/facter/facts/openbsd/mountpoints.rb b/lib/facter/facts/openbsd/mountpoints.rb deleted file mode 100644 index 57b5577cf3..0000000000 --- a/lib/facter/facts/openbsd/mountpoints.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class Mountpoints - FACT_NAME = 'mountpoints' - - def call_the_resolver - mountpoints = Facter::Resolvers::Openbsd::Mountpoints.resolve(FACT_NAME.to_sym) - return Facter::ResolvedFact.new(FACT_NAME, nil) unless mountpoints - - fact = {} - mountpoints.each do |path, mnt| - fact[path.to_sym] = mnt.reject { |k| k == :path } - end - - Facter::ResolvedFact.new(FACT_NAME, fact) - end - end - end -end diff --git a/lib/facter/facts/openbsd/netmask6_interfaces.rb b/lib/facter/facts/openbsd/netmask6_interfaces.rb deleted file mode 100644 index 5c39957fca..0000000000 --- a/lib/facter/facts/openbsd/netmask6_interfaces.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class Netmask6Interfaces - FACT_NAME = 'netmask6_.*' - TYPE = :legacy - - def call_the_resolver - arr = [] - interfaces = Facter::Resolvers::Networking.resolve(:interfaces) - interfaces&.each do |interface_name, info| - arr << Facter::ResolvedFact.new("netmask6_#{interface_name}", info[:netmask6], :legacy) if info[:netmask6] - end - - arr - end - end - end -end diff --git a/lib/facter/facts/openbsd/netmask_interfaces.rb b/lib/facter/facts/openbsd/netmask_interfaces.rb deleted file mode 100644 index bdfe39168a..0000000000 --- a/lib/facter/facts/openbsd/netmask_interfaces.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class NetmaskInterfaces - FACT_NAME = 'netmask_.*' - TYPE = :legacy - - def call_the_resolver - arr = [] - interfaces = Facter::Resolvers::Networking.resolve(:interfaces) - interfaces&.each do |interface_name, info| - arr << Facter::ResolvedFact.new("netmask_#{interface_name}", info[:netmask], :legacy) if info[:netmask] - end - - arr - end - end - end -end diff --git a/lib/facter/facts/openbsd/network6_interfaces.rb b/lib/facter/facts/openbsd/network6_interfaces.rb deleted file mode 100644 index 9756905f72..0000000000 --- a/lib/facter/facts/openbsd/network6_interfaces.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class Network6Interfaces - FACT_NAME = 'network6_.*' - TYPE = :legacy - - def call_the_resolver - arr = [] - interfaces = Facter::Resolvers::Networking.resolve(:interfaces) - interfaces&.each do |interface_name, info| - arr << Facter::ResolvedFact.new("network6_#{interface_name}", info[:network6], :legacy) if info[:network6] - end - - arr - end - end - end -end diff --git a/lib/facter/facts/openbsd/network_interfaces.rb b/lib/facter/facts/openbsd/network_interfaces.rb deleted file mode 100644 index 28c099f6ce..0000000000 --- a/lib/facter/facts/openbsd/network_interfaces.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class NetworkInterfaces - FACT_NAME = 'network_.*' - TYPE = :legacy - - def call_the_resolver - arr = [] - interfaces = Facter::Resolvers::Networking.resolve(:interfaces) - interfaces&.each do |interface_name, info| - arr << Facter::ResolvedFact.new("network_#{interface_name}", info[:network], :legacy) if info[:network] - end - - arr - end - end - end -end diff --git a/lib/facter/facts/openbsd/networking/dhcp.rb b/lib/facter/facts/openbsd/networking/dhcp.rb deleted file mode 100644 index 84c073f470..0000000000 --- a/lib/facter/facts/openbsd/networking/dhcp.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Networking - class Dhcp - FACT_NAME = 'networking.dhcp' - - def call_the_resolver - fact_value = Facter::Resolvers::Openbsd::Dhcp.resolve(:dhcp) - - Facter::ResolvedFact.new(FACT_NAME, fact_value) - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/networking/domain.rb b/lib/facter/facts/openbsd/networking/domain.rb deleted file mode 100644 index 02304e3f15..0000000000 --- a/lib/facter/facts/openbsd/networking/domain.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Networking - class Domain - FACT_NAME = 'networking.domain' - ALIASES = 'domain' - - def call_the_resolver - fact_value = Facter::Resolvers::Hostname.resolve(:domain) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/networking/fqdn.rb b/lib/facter/facts/openbsd/networking/fqdn.rb deleted file mode 100644 index fbf2810fe5..0000000000 --- a/lib/facter/facts/openbsd/networking/fqdn.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Networking - class Fqdn - FACT_NAME = 'networking.fqdn' - ALIASES = 'fqdn' - - def call_the_resolver - fact_value = Facter::Resolvers::Hostname.resolve(:fqdn) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/networking/hostname.rb b/lib/facter/facts/openbsd/networking/hostname.rb deleted file mode 100644 index ec7592a7e0..0000000000 --- a/lib/facter/facts/openbsd/networking/hostname.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Networking - class Hostname - FACT_NAME = 'networking.hostname' - ALIASES = 'hostname' - - def call_the_resolver - fact_value = Facter::Resolvers::Hostname.resolve(:hostname) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/networking/interfaces.rb b/lib/facter/facts/openbsd/networking/interfaces.rb deleted file mode 100644 index bfc80d0e2b..0000000000 --- a/lib/facter/facts/openbsd/networking/interfaces.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Networking - class Interfaces - FACT_NAME = 'networking.interfaces' - - def call_the_resolver - fact_value = Facter::Resolvers::Networking.resolve(:interfaces) - - Facter::ResolvedFact.new(FACT_NAME, fact_value) - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/networking/ip.rb b/lib/facter/facts/openbsd/networking/ip.rb deleted file mode 100644 index 67fdbc04a8..0000000000 --- a/lib/facter/facts/openbsd/networking/ip.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Networking - class Ip - FACT_NAME = 'networking.ip' - ALIASES = 'ipaddress' - - def call_the_resolver - fact_value = Facter::Resolvers::Networking.resolve(:ip) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/networking/ip6.rb b/lib/facter/facts/openbsd/networking/ip6.rb deleted file mode 100644 index 9a01fd9e3f..0000000000 --- a/lib/facter/facts/openbsd/networking/ip6.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Networking - class Ip6 - FACT_NAME = 'networking.ip6' - ALIASES = 'ipaddress6' - - def call_the_resolver - fact_value = Facter::Resolvers::Networking.resolve(:ip6) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/networking/mac.rb b/lib/facter/facts/openbsd/networking/mac.rb deleted file mode 100644 index 7e5ada8673..0000000000 --- a/lib/facter/facts/openbsd/networking/mac.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Networking - class Mac - FACT_NAME = 'networking.mac' - ALIASES = 'macaddress' - - def call_the_resolver - fact_value = Facter::Resolvers::Networking.resolve(:mac) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/networking/mtu.rb b/lib/facter/facts/openbsd/networking/mtu.rb deleted file mode 100644 index 0403f663e8..0000000000 --- a/lib/facter/facts/openbsd/networking/mtu.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Networking - class Mtu - FACT_NAME = 'networking.mtu' - - def call_the_resolver - fact_value = Facter::Resolvers::Networking.resolve(:mtu) - - Facter::ResolvedFact.new(FACT_NAME, fact_value) - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/networking/netmask.rb b/lib/facter/facts/openbsd/networking/netmask.rb deleted file mode 100644 index cac415d80a..0000000000 --- a/lib/facter/facts/openbsd/networking/netmask.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Networking - class Netmask - FACT_NAME = 'networking.netmask' - ALIASES = 'netmask' - - def call_the_resolver - fact_value = Facter::Resolvers::Networking.resolve(:netmask) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/networking/netmask6.rb b/lib/facter/facts/openbsd/networking/netmask6.rb deleted file mode 100644 index f14884831c..0000000000 --- a/lib/facter/facts/openbsd/networking/netmask6.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Networking - class Netmask6 - FACT_NAME = 'networking.netmask6' - ALIASES = 'netmask6' - - def call_the_resolver - fact_value = Facter::Resolvers::Networking.resolve(:netmask6) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/networking/network.rb b/lib/facter/facts/openbsd/networking/network.rb deleted file mode 100644 index eba2a57e1d..0000000000 --- a/lib/facter/facts/openbsd/networking/network.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Networking - class Network - FACT_NAME = 'networking.network' - ALIASES = 'network' - - def call_the_resolver - fact_value = Facter::Resolvers::Networking.resolve(:network) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/networking/network6.rb b/lib/facter/facts/openbsd/networking/network6.rb deleted file mode 100644 index 4de2b96e2a..0000000000 --- a/lib/facter/facts/openbsd/networking/network6.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Networking - class Network6 - FACT_NAME = 'networking.network6' - ALIASES = 'network6' - - def call_the_resolver - fact_value = Facter::Resolvers::Networking.resolve(:network6) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/networking/primary.rb b/lib/facter/facts/openbsd/networking/primary.rb deleted file mode 100644 index 4c59b07bb7..0000000000 --- a/lib/facter/facts/openbsd/networking/primary.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Networking - class Primary - FACT_NAME = 'networking.primary' - - def call_the_resolver - fact_value = Facter::Resolvers::Networking.resolve(:primary_interface) - - Facter::ResolvedFact.new(FACT_NAME, fact_value) - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/networking/scope6.rb b/lib/facter/facts/openbsd/networking/scope6.rb deleted file mode 100644 index 08ad8f43c2..0000000000 --- a/lib/facter/facts/openbsd/networking/scope6.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Networking - class Scope6 - FACT_NAME = 'networking.scope6' - - def call_the_resolver - fact_value = Facter::Resolvers::Networking.resolve(:scope6) - - Facter::ResolvedFact.new(FACT_NAME, fact_value) - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/os/architecture.rb b/lib/facter/facts/openbsd/os/architecture.rb deleted file mode 100644 index cba807dfa9..0000000000 --- a/lib/facter/facts/openbsd/os/architecture.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Os - class Architecture - FACT_NAME = 'os.architecture' - ALIASES = 'architecture' - - def call_the_resolver - fact_value = Facter::Resolvers::Uname.resolve(:machine) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/os/hardware.rb b/lib/facter/facts/openbsd/os/hardware.rb deleted file mode 100644 index f44046709e..0000000000 --- a/lib/facter/facts/openbsd/os/hardware.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Os - class Hardware - FACT_NAME = 'os.hardware' - ALIASES = 'hardwaremodel' - - def call_the_resolver - fact_value = Facter::Resolvers::Uname.resolve(:machine) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/os/name.rb b/lib/facter/facts/openbsd/os/name.rb deleted file mode 100644 index dd877e59bf..0000000000 --- a/lib/facter/facts/openbsd/os/name.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Os - class Name - FACT_NAME = 'os.name' - ALIASES = 'operatingsystem' - - def call_the_resolver - fact_value = Facter::Resolvers::Uname.resolve(:kernelname) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/os/release.rb b/lib/facter/facts/openbsd/os/release.rb deleted file mode 100644 index 618b1b4bc3..0000000000 --- a/lib/facter/facts/openbsd/os/release.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Os - class Release - FACT_NAME = 'os.release' - ALIASES = %w[operatingsystemmajrelease operatingsystemrelease].freeze - - def call_the_resolver - # From Freebsd - # Facter::ResolvedFact.new(ALIASES.last, installed_userland, :legacy)] - - version = Facter::Resolvers::Uname.resolve(:kernelrelease) - major, minor = version.split('.') - [Facter::ResolvedFact.new(FACT_NAME, full: version, major: major, minor: minor), - Facter::ResolvedFact.new(ALIASES.first, major, :legacy), - Facter::ResolvedFact.new(ALIASES.last, version, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/path.rb b/lib/facter/facts/openbsd/path.rb deleted file mode 100644 index 9fae66bbe0..0000000000 --- a/lib/facter/facts/openbsd/path.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class Path - FACT_NAME = 'path' - - def call_the_resolver - fact_value = Facter::Resolvers::Path.resolve(:path) - - Facter::ResolvedFact.new(FACT_NAME, fact_value) - end - end - end -end diff --git a/lib/facter/facts/openbsd/processors/isa.rb b/lib/facter/facts/openbsd/processors/isa.rb deleted file mode 100644 index fa1f4da68f..0000000000 --- a/lib/facter/facts/openbsd/processors/isa.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Processors - class Isa - FACT_NAME = 'processors.isa' - ALIASES = 'hardwareisa' - - def call_the_resolver - fact_value = Facter::Resolvers::Uname.resolve(:processor) - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/ruby/platform.rb b/lib/facter/facts/openbsd/ruby/platform.rb deleted file mode 100644 index 2ccce2908d..0000000000 --- a/lib/facter/facts/openbsd/ruby/platform.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Ruby - class Platform - FACT_NAME = 'ruby.platform' - ALIASES = 'rubyplatform' - - def call_the_resolver - fact_value = Facter::Resolvers::Ruby.resolve(:platform) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/ruby/sitedir.rb b/lib/facter/facts/openbsd/ruby/sitedir.rb deleted file mode 100644 index ac1cce45bc..0000000000 --- a/lib/facter/facts/openbsd/ruby/sitedir.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Ruby - class Sitedir - FACT_NAME = 'ruby.sitedir' - ALIASES = 'rubysitedir' - - def call_the_resolver - fact_value = Facter::Resolvers::Ruby.resolve(:sitedir) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/ruby/version.rb b/lib/facter/facts/openbsd/ruby/version.rb deleted file mode 100644 index c5f74ece8d..0000000000 --- a/lib/facter/facts/openbsd/ruby/version.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module Ruby - class Version - FACT_NAME = 'ruby.version' - ALIASES = 'rubyversion' - - def call_the_resolver - fact_value = Facter::Resolvers::Ruby.resolve(:version) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/ssh.rb b/lib/facter/facts/openbsd/ssh.rb deleted file mode 100644 index 74b93c09f2..0000000000 --- a/lib/facter/facts/openbsd/ssh.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class Ssh - FACT_NAME = 'ssh' - - def call_the_resolver - result = Facter::Resolvers::Ssh.resolve(:ssh) - ssh_facts = {} - result.each { |ssh| ssh_facts.merge!(create_ssh_fact(ssh)) } - Facter::ResolvedFact.new(FACT_NAME, ssh_facts) - end - - private - - def create_ssh_fact(ssh) - { ssh.name.to_sym => - { fingerprints: { sha1: ssh.fingerprint.sha1, - sha256: ssh.fingerprint.sha256 }, - key: ssh.key, - type: ssh.type } } - end - end - end -end diff --git a/lib/facter/facts/openbsd/sshalgorithmkey.rb b/lib/facter/facts/openbsd/sshalgorithmkey.rb deleted file mode 100644 index 3fda0c5653..0000000000 --- a/lib/facter/facts/openbsd/sshalgorithmkey.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class Sshalgorithmkey - FACT_NAME = 'ssh.*key' - TYPE = :legacy - - def call_the_resolver - facts = [] - result = Facter::Resolvers::Ssh.resolve(:ssh) - result.each { |ssh| facts << Facter::ResolvedFact.new("ssh#{ssh.name.to_sym}key", ssh.key, :legacy) } - facts - end - end - end -end diff --git a/lib/facter/facts/openbsd/sshfp_algorithm.rb b/lib/facter/facts/openbsd/sshfp_algorithm.rb deleted file mode 100644 index d9da6cc990..0000000000 --- a/lib/facter/facts/openbsd/sshfp_algorithm.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class SshfpAlgorithm - FACT_NAME = 'sshfp_.*' - TYPE = :legacy - - def call_the_resolver - facts = [] - result = Facter::Resolvers::Ssh.resolve(:ssh) - result.each do |ssh| - facts << Facter::ResolvedFact.new("sshfp_#{ssh.name.to_sym}", - "#{ssh.fingerprint.sha1}\n#{ssh.fingerprint.sha256}", :legacy) - end - facts - end - end - end -end diff --git a/lib/facter/facts/openbsd/system_uptime/days.rb b/lib/facter/facts/openbsd/system_uptime/days.rb deleted file mode 100644 index e76608b1bb..0000000000 --- a/lib/facter/facts/openbsd/system_uptime/days.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module SystemUptime - class Days - FACT_NAME = 'system_uptime.days' - ALIASES = 'uptime_days' - - def call_the_resolver - fact_value = Facter::Resolvers::Uptime.resolve(:days) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/system_uptime/hours.rb b/lib/facter/facts/openbsd/system_uptime/hours.rb deleted file mode 100644 index cc5c3485cb..0000000000 --- a/lib/facter/facts/openbsd/system_uptime/hours.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module SystemUptime - class Hours - FACT_NAME = 'system_uptime.hours' - ALIASES = 'uptime_hours' - - def call_the_resolver - fact_value = Facter::Resolvers::Uptime.resolve(:hours) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/system_uptime/seconds.rb b/lib/facter/facts/openbsd/system_uptime/seconds.rb deleted file mode 100644 index 3795c1419d..0000000000 --- a/lib/facter/facts/openbsd/system_uptime/seconds.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module SystemUptime - class Seconds - FACT_NAME = 'system_uptime.seconds' - ALIASES = 'uptime_seconds' - - def call_the_resolver - fact_value = Facter::Resolvers::Uptime.resolve(:seconds) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/system_uptime/uptime.rb b/lib/facter/facts/openbsd/system_uptime/uptime.rb deleted file mode 100644 index 5e640b9ee4..0000000000 --- a/lib/facter/facts/openbsd/system_uptime/uptime.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - module SystemUptime - class Uptime - FACT_NAME = 'system_uptime.uptime' - ALIASES = 'uptime' - - def call_the_resolver - fact_value = Facter::Resolvers::Uptime.resolve(:uptime) - - [Facter::ResolvedFact.new(FACT_NAME, fact_value), Facter::ResolvedFact.new(ALIASES, fact_value, :legacy)] - end - end - end - end -end diff --git a/lib/facter/facts/openbsd/timezone.rb b/lib/facter/facts/openbsd/timezone.rb deleted file mode 100644 index bb2c8f191c..0000000000 --- a/lib/facter/facts/openbsd/timezone.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class Timezone - FACT_NAME = 'timezone' - - def call_the_resolver - fact_value = Facter::Resolvers::Timezone.resolve(:timezone) - - Facter::ResolvedFact.new(FACT_NAME, fact_value) - end - end - end -end diff --git a/lib/facter/facts/openbsd/virtual.rb b/lib/facter/facts/openbsd/virtual.rb deleted file mode 100644 index 2649d64978..0000000000 --- a/lib/facter/facts/openbsd/virtual.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Facts - module Openbsd - class Virtual - FACT_NAME = 'virtual' - - def call_the_resolver - fact_value = Facter::Util::Facts::Posix::VirtualDetector.platform - - Facter::ResolvedFact.new(FACT_NAME, fact_value) - end - end - end -end diff --git a/lib/facter/framework/core/file_loader.rb b/lib/facter/framework/core/file_loader.rb index 2bf8b1e721..59cab3625c 100644 --- a/lib/facter/framework/core/file_loader.rb +++ b/lib/facter/framework/core/file_loader.rb @@ -647,65 +647,6 @@ require_relative '../../facts/ol/os/distro/description.rb' require_relative '../../facts/ol/os/distro/id.rb' - when 'openbsd' - require_relative '../../facts/openbsd/augeas/version.rb' - require_relative '../../facts/openbsd/ec2_metadata.rb' - require_relative '../../facts/openbsd/ec2_userdata.rb' - require_relative '../../facts/openbsd/facterversion.rb' - require_relative '../../facts/openbsd/is_virtual.rb' - require_relative '../../facts/openbsd/kernel.rb' - require_relative '../../facts/openbsd/kernelrelease.rb' - require_relative '../../facts/openbsd/mountpoints.rb' - require_relative '../../facts/openbsd/path.rb' - require_relative '../../facts/openbsd/ssh.rb' - require_relative '../../facts/openbsd/sshalgorithmkey.rb' - require_relative '../../facts/openbsd/sshfp_algorithm.rb' - require_relative '../../facts/openbsd/timezone.rb' - require_relative '../../facts/openbsd/virtual.rb' - require_relative '../../facts/openbsd/dmi/bios/vendor.rb' - require_relative '../../facts/openbsd/dmi/bios/version.rb' - require_relative '../../facts/openbsd/dmi/manufacturer.rb' - require_relative '../../facts/openbsd/dmi/product/name.rb' - require_relative '../../facts/openbsd/dmi/product/serial_number.rb' - require_relative '../../facts/openbsd/dmi/product/uuid.rb' - require_relative '../../facts/openbsd/identity/group.rb' - require_relative '../../facts/openbsd/identity/gid.rb' - require_relative '../../facts/openbsd/identity/privileged.rb' - require_relative '../../facts/openbsd/identity/uid.rb' - require_relative '../../facts/openbsd/identity/user.rb' - require_relative '../../facts/openbsd/networking/dhcp.rb' - require_relative '../../facts/openbsd/networking/domain.rb' - require_relative '../../facts/openbsd/networking/fqdn.rb' - require_relative '../../facts/openbsd/networking/hostname.rb' - require_relative '../../facts/openbsd/networking/interfaces.rb' - require_relative '../../facts/openbsd/networking/ip.rb' - require_relative '../../facts/openbsd/networking/ip6.rb' - require_relative '../../facts/openbsd/networking/mac.rb' - require_relative '../../facts/openbsd/networking/mtu.rb' - require_relative '../../facts/openbsd/networking/netmask.rb' - require_relative '../../facts/openbsd/networking/netmask6.rb' - require_relative '../../facts/openbsd/networking/network.rb' - require_relative '../../facts/openbsd/networking/network6.rb' - require_relative '../../facts/openbsd/networking/primary.rb' - require_relative '../../facts/openbsd/networking/scope6.rb' - require_relative '../../facts/openbsd/os/architecture.rb' - require_relative '../../facts/openbsd/os/hardware.rb' - require_relative '../../facts/openbsd/os/name.rb' - require_relative '../../facts/openbsd/os/release.rb' - require_relative '../../facts/openbsd/processors/isa.rb' - require_relative '../../facts/openbsd/ruby/platform.rb' - require_relative '../../facts/openbsd/ruby/sitedir.rb' - require_relative '../../facts/openbsd/ruby/version.rb' - require_relative '../../facts/openbsd/system_uptime/days.rb' - require_relative '../../facts/openbsd/system_uptime/hours.rb' - require_relative '../../facts/openbsd/system_uptime/seconds.rb' - require_relative '../../facts/openbsd/system_uptime/uptime.rb' - - require_relative '../../resolvers/openbsd/dhcp.rb' - require_relative '../../resolvers/openbsd/dmi.rb' - require_relative '../../resolvers/openbsd/mountpoints.rb' - require_relative '../../resolvers/openbsd/virtual.rb' - when 'openwrt' require_relative '../../facts/openwrt/os/release.rb' diff --git a/lib/facter/framework/detector/os_detector.rb b/lib/facter/framework/detector/os_detector.rb index 4b0e9f5640..95e54346b2 100644 --- a/lib/facter/framework/detector/os_detector.rb +++ b/lib/facter/framework/detector/os_detector.rb @@ -26,8 +26,6 @@ def detect detect_distro when /freebsd/ :freebsd - when /openbsd/i - :openbsd when /bsd/ :bsd when /solaris/ diff --git a/lib/facter/resolvers/openbsd/dhcp.rb b/lib/facter/resolvers/openbsd/dhcp.rb deleted file mode 100644 index 3a311bb91d..0000000000 --- a/lib/facter/resolvers/openbsd/dhcp.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -require_relative '../networking' - -module Facter - module Resolvers - module Openbsd - class Dhcp < Facter::Resolvers::Networking - init_resolver - class << self - def extract_dhcp(interface_name, raw_data, parsed_interface_data) - return unless raw_data.match?(/status:\s+active/) - - result = Facter::Core::Execution.execute("dhcpleasectl -l #{interface_name}", logger: log) - parsed_interface_data[:dhcp] = extract_values(result, /\sdhcp server (\S+)/).first unless result.empty? - end - end - end - end - end -end diff --git a/lib/facter/resolvers/openbsd/dmi.rb b/lib/facter/resolvers/openbsd/dmi.rb deleted file mode 100644 index d17fab47ed..0000000000 --- a/lib/facter/resolvers/openbsd/dmi.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -module Facter - module Resolvers - module Openbsd - class DmiBios < BaseResolver - init_resolver - - class << self - private - - def post_resolve(fact_name, _options) - @fact_list.fetch(fact_name) { read_facts(fact_name) } - end - - CTL_HW = 6 - HW_VENDOR = 14 - HW_PRODUCT = 15 - HW_VERSION = 16 - HW_SERIALNO = 17 - HW_UUID = 18 - - def read_facts(fact_name) - require 'facter/resolvers/bsd/ffi/ffi_helper' - - @fact_list[:bios_vendor] = Facter::Bsd::FfiHelper.sysctl(:string, [CTL_HW, HW_VENDOR]) - @fact_list[:bios_version] = Facter::Bsd::FfiHelper.sysctl(:string, [CTL_HW, HW_VERSION]) - - @fact_list[:product_name] = Facter::Bsd::FfiHelper.sysctl(:string, [CTL_HW, HW_PRODUCT]) - @fact_list[:product_serial] = Facter::Bsd::FfiHelper.sysctl(:string, [CTL_HW, HW_SERIALNO]) - @fact_list[:product_uuid] = Facter::Bsd::FfiHelper.sysctl(:string, [CTL_HW, HW_UUID]) - - @fact_list[:sys_vendor] = Facter::Bsd::FfiHelper.sysctl(:string, [CTL_HW, HW_VENDOR]) - - @fact_list[fact_name] - end - end - end - end - end -end diff --git a/lib/facter/resolvers/openbsd/mountpoints.rb b/lib/facter/resolvers/openbsd/mountpoints.rb deleted file mode 100644 index 379472176b..0000000000 --- a/lib/facter/resolvers/openbsd/mountpoints.rb +++ /dev/null @@ -1,72 +0,0 @@ -# frozen_string_literal: true - -module Facter - module Resolvers - module Openbsd - class Mountpoints < BaseResolver - init_resolver - - BLOCK_SIZE = 512 - - class << self - private - - def post_resolve(fact_name, _options) - @fact_list.fetch(fact_name) { read_mount(fact_name) } - end - - def read_mount(fact_name) - @fact_list[:mountpoints] = {} - output = Facter::Core::Execution.execute('mount', logger: log) - output.split("\n").map do |line| - add_mount_points_fact(line) - end - - retrieve_sizes_for_mounts - @fact_list[fact_name] - end - - def add_mount_points_fact(line) - elem = line.split("\s") - options = elem.drop(5) - options.each { |option| option.tr!('(),', '') } - @fact_list[:mountpoints][elem[2]] = { device: elem[0], filesystem: elem[4], - options: options } - end - - def retrieve_sizes_for_mounts - output = Facter::Core::Execution.execute('df -P', logger: log) - output.split("\n").drop(1).map do |line| - next if line.match?(/-\s+-\s+-/) - - mount_info = line.split("\s") - mount_info[3] = translate_to_bytes(mount_info[3]) - mount_info[2] = translate_to_bytes(mount_info[2]) - mount_info[1] = translate_to_bytes(mount_info[1]) - compute_sizes(mount_info) - end - end - - def translate_to_bytes(strin_size) - strin_size.to_i * BLOCK_SIZE - end - - def compute_sizes(info) - available_bytes = info[3] - used_bytes = info[2] - size_bytes = info[1] - @fact_list[:mountpoints][info.last].merge!( - capacity: Facter::Util::Resolvers::FilesystemHelper.compute_capacity(used_bytes, size_bytes), - available_bytes: available_bytes, - used_bytes: used_bytes, - size_bytes: size_bytes, - available: Facter::Util::Facts::UnitConverter.bytes_to_human_readable(available_bytes), - used: Facter::Util::Facts::UnitConverter.bytes_to_human_readable(used_bytes), - size: Facter::Util::Facts::UnitConverter.bytes_to_human_readable(size_bytes) - ) - end - end - end - end - end -end diff --git a/lib/facter/resolvers/openbsd/virtual.rb b/lib/facter/resolvers/openbsd/virtual.rb deleted file mode 100644 index 9d9c5df245..0000000000 --- a/lib/facter/resolvers/openbsd/virtual.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -module Facter - module Resolvers - module Openbsd - class Virtual < BaseResolver - init_resolver - - class << self - #:model - - VM_GUEST_SYSCTL_NAMES = { - 'VMM' => 'vmm', - 'vServer' => 'vserver', - 'oracle' => 'virtualbox', - 'xen' => 'xenu', - 'none' => nil - }.freeze - - private - - def post_resolve(fact_name, _options) - @fact_list.fetch(fact_name) { read_facts(fact_name) } - end - - CTL_HW = 6 - HW_PRODUCT = 15 - - def read_facts(fact_name) - require 'facter/resolvers/bsd/ffi/ffi_helper' - - vm = Facter::Bsd::FfiHelper.sysctl(:string, [CTL_HW, HW_PRODUCT]) - vm = VM_GUEST_SYSCTL_NAMES[vm] if VM_GUEST_SYSCTL_NAMES.key?(vm) - @fact_list[:vm] = vm - @fact_list[fact_name] - end - end - end - end - end -end diff --git a/lib/facter/util/facts/posix/virtual_detector.rb b/lib/facter/util/facts/posix/virtual_detector.rb index 24bf14e4f2..d17573525e 100644 --- a/lib/facter/util/facts/posix/virtual_detector.rb +++ b/lib/facter/util/facts/posix/virtual_detector.rb @@ -9,7 +9,7 @@ class << self def platform @@fact_value ||= check_docker_lxc || check_freebsd || check_gce || retrieve_from_virt_what @@fact_value ||= check_vmware || check_open_vz || check_vserver || check_xen || check_other_facts - @@fact_value ||= check_openbsd || check_lspci || 'physical' + @@fact_value ||= check_lspci || 'physical' @@fact_value end @@ -51,12 +51,6 @@ def check_freebsd Facter::Resolvers::Freebsd::Virtual.resolve(:vm) end - def check_openbsd - return unless Object.const_defined?('Facter::Resolvers::Openbsd::Virtual') - - Facter::Resolvers::Openbsd::Virtual.resolve(:vm) - end - def check_other_facts bios_vendor = Facter::Resolvers::Linux::DmiBios.resolve(:bios_vendor) return 'kvm' if bios_vendor&.include?('Amazon EC2') diff --git a/spec/facter/facts/openbsd/augeas/version_spec.rb b/spec/facter/facts/openbsd/augeas/version_spec.rb deleted file mode 100644 index 405c746e6e..0000000000 --- a/spec/facter/facts/openbsd/augeas/version_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Augeas::Version do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Augeas::Version.new } - - let(:version) { '1.12.0' } - - before do - allow(Facter::Resolvers::Augeas).to \ - receive(:resolve).with(:augeas_version).and_return(version) - end - - it 'calls Facter::Resolvers::Augeas' do - fact.call_the_resolver - expect(Facter::Resolvers::Augeas).to have_received(:resolve).with(:augeas_version) - end - - it 'returns a resolved fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'augeas.version', value: version), - an_object_having_attributes(name: 'augeasversion', value: version, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/dmi/bios/vendor_spec.rb b/spec/facter/facts/openbsd/dmi/bios/vendor_spec.rb deleted file mode 100644 index 23d0d77d43..0000000000 --- a/spec/facter/facts/openbsd/dmi/bios/vendor_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Dmi::Bios::Vendor do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Dmi::Bios::Vendor.new } - - let(:vendor) { 'Phoenix Technologies LTD' } - - before do - allow(Facter::Resolvers::Openbsd::DmiBios).to \ - receive(:resolve).with(:bios_vendor).and_return(vendor) - end - - it 'calls Facter::Resolvers::Openbsd::DmiBios' do - fact.call_the_resolver - expect(Facter::Resolvers::Openbsd::DmiBios).to have_received(:resolve).with(:bios_vendor) - end - - it 'returns bios vendor fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'dmi.bios.vendor', value: vendor), - an_object_having_attributes(name: 'bios_vendor', value: vendor, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/dmi/bios/version_spec.rb b/spec/facter/facts/openbsd/dmi/bios/version_spec.rb deleted file mode 100644 index 2fd4e162e7..0000000000 --- a/spec/facter/facts/openbsd/dmi/bios/version_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Dmi::Bios::Version do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Dmi::Bios::Version.new } - - let(:version) { '6.00' } - - before do - allow(Facter::Resolvers::Openbsd::DmiBios).to \ - receive(:resolve).with(:bios_version).and_return(version) - end - - it 'calls Facter::Resolvers::Openbsd::DmiBios' do - fact.call_the_resolver - expect(Facter::Resolvers::Openbsd::DmiBios).to have_received(:resolve).with(:bios_version) - end - - it 'returns bios version fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'dmi.bios.version', value: version), - an_object_having_attributes(name: 'bios_version', value: version, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/dmi/manufacturer_spec.rb b/spec/facter/facts/openbsd/dmi/manufacturer_spec.rb deleted file mode 100644 index 874fa54196..0000000000 --- a/spec/facter/facts/openbsd/dmi/manufacturer_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Dmi::Manufacturer do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Dmi::Manufacturer.new } - - let(:sys_vendor) { 'OpenBSD' } - - before do - allow(Facter::Resolvers::Openbsd::DmiBios).to \ - receive(:resolve).with(:sys_vendor).and_return(sys_vendor) - end - - it 'calls Facter::Resolvers::Openbsd::DmiBios' do - fact.call_the_resolver - expect(Facter::Resolvers::Openbsd::DmiBios).to have_received(:resolve).with(:sys_vendor) - end - - it 'returns manufacturer fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'dmi.manufacturer', value: sys_vendor), - an_object_having_attributes(name: 'manufacturer', value: sys_vendor, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/dmi/product/name_spec.rb b/spec/facter/facts/openbsd/dmi/product/name_spec.rb deleted file mode 100644 index cbf6a668fb..0000000000 --- a/spec/facter/facts/openbsd/dmi/product/name_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Dmi::Product::Name do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Dmi::Product::Name.new } - - let(:product_name) { 'VMM' } - - before do - allow(Facter::Resolvers::Openbsd::DmiBios).to \ - receive(:resolve).with(:product_name).and_return(product_name) - end - - it 'calls Facter::Resolvers::Openbsd::DmiBios' do - fact.call_the_resolver - expect(Facter::Resolvers::Openbsd::DmiBios).to have_received(:resolve).with(:product_name) - end - - it 'returns product name fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'dmi.product.name', value: product_name), - an_object_having_attributes(name: 'productname', value: product_name, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/dmi/product/serial_number_spec.rb b/spec/facter/facts/openbsd/dmi/product/serial_number_spec.rb deleted file mode 100644 index 444cb102be..0000000000 --- a/spec/facter/facts/openbsd/dmi/product/serial_number_spec.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Dmi::Product::SerialNumber do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Dmi::Product::SerialNumber.new } - - context 'when resolver returns serial number' do - let(:serial_number) { '17425315' } - - before do - allow(Facter::Resolvers::Openbsd::DmiBios).to \ - receive(:resolve).with(:product_serial).and_return(serial_number) - end - - it 'calls Facter::Resolvers::Openbsd::DmiBios' do - fact.call_the_resolver - expect(Facter::Resolvers::Openbsd::DmiBios).to have_received(:resolve).with(:product_serial) - end - - it 'returns resolved facts' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'dmi.product.serial_number', value: serial_number), - an_object_having_attributes(name: 'serialnumber', value: serial_number, type: :legacy)) - end - end - - context 'when resolver returns nil' do - before do - allow(Facter::Resolvers::Openbsd::DmiBios).to \ - receive(:resolve).with(:product_serial).and_return(nil) - end - - it 'returns serial information' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'dmi.product.serial_number', value: nil), - an_object_having_attributes(name: 'serialnumber', value: nil, type: :legacy)) - end - end - end -end diff --git a/spec/facter/facts/openbsd/dmi/product/uuid_spec.rb b/spec/facter/facts/openbsd/dmi/product/uuid_spec.rb deleted file mode 100644 index d558e9809f..0000000000 --- a/spec/facter/facts/openbsd/dmi/product/uuid_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Dmi::Product::Uuid do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Dmi::Product::Uuid.new } - - let(:product_uuid) { '421aa929-318f-fae9-7d69-2e2321b00c45' } - - before do - allow(Facter::Resolvers::Openbsd::DmiBios).to \ - receive(:resolve).with(:product_uuid).and_return(product_uuid) - end - - it 'calls Facter::Resolvers::Openbsd::DmiBios' do - fact.call_the_resolver - expect(Facter::Resolvers::Openbsd::DmiBios).to have_received(:resolve).with(:product_uuid) - end - - it 'returns resolved facts' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'dmi.product.uuid', value: product_uuid), - an_object_having_attributes(name: 'uuid', value: product_uuid, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/ec2_metadata_spec.rb b/spec/facter/facts/openbsd/ec2_metadata_spec.rb deleted file mode 100644 index 9907424c5f..0000000000 --- a/spec/facter/facts/openbsd/ec2_metadata_spec.rb +++ /dev/null @@ -1,79 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Ec2Metadata do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Ec2Metadata.new } - - let(:virtual_detector_double) { class_spy(Facter::Util::Facts::Posix::VirtualDetector) } - - before do - allow(Facter::Resolvers::Ec2).to receive(:resolve).with(:metadata).and_return(value) - end - - context 'when physical machine with no hypervisor' do - let(:value) { nil } - - before do - allow(Facter::Util::Facts::Posix::VirtualDetector).to receive(:platform).and_return(nil) - end - - it 'returns ec2 metadata fact as nil' do - expect(fact.call_the_resolver).to be_an_instance_of(Facter::ResolvedFact).and \ - have_attributes(name: 'ec2_metadata', value: value) - end - - it "doesn't call Ec2 resolver" do - fact.call_the_resolver - expect(Facter::Resolvers::Ec2).not_to have_received(:resolve).with(:metadata) - end - end - - shared_examples 'check ec2 resolver called with metadata' do - it 'calls ec2 resolver' do - fact.call_the_resolver - - expect(Facter::Resolvers::Ec2).to have_received(:resolve).with(:metadata) - end - end - - shared_examples 'check resolved fact value' do - it 'returns ec2 metadata fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Facter::ResolvedFact).and \ - have_attributes(name: 'ec2_metadata', value: value) - end - end - - context 'when platform is kvm' do - let(:value) { { 'info' => 'value' } } - - before do - allow(Facter::Util::Facts::Posix::VirtualDetector).to receive(:platform).and_return('kvm') - end - - it_behaves_like 'check ec2 resolver called with metadata' - it_behaves_like 'check resolved fact value' - end - - context 'when platform is xen' do - let(:value) { { 'info' => 'value' } } - - before do - allow(Facter::Util::Facts::Posix::VirtualDetector).to receive(:platform).and_return('xen') - end - - it_behaves_like 'check ec2 resolver called with metadata' - it_behaves_like 'check resolved fact value' - end - - context 'when platform is aws' do - let(:value) { { 'info' => 'value' } } - - before do - allow(Facter::Util::Facts::Posix::VirtualDetector).to receive(:platform).and_return('aws') - end - - it_behaves_like 'check ec2 resolver called with metadata' - it_behaves_like 'check resolved fact value' - end - end -end diff --git a/spec/facter/facts/openbsd/ec2_userdata_spec.rb b/spec/facter/facts/openbsd/ec2_userdata_spec.rb deleted file mode 100644 index 2db4273ebc..0000000000 --- a/spec/facter/facts/openbsd/ec2_userdata_spec.rb +++ /dev/null @@ -1,79 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Ec2Userdata do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Ec2Userdata.new } - - let(:virtual_detector_double) { class_spy(Facter::Util::Facts::Posix::VirtualDetector) } - - before do - allow(Facter::Resolvers::Ec2).to receive(:resolve).with(:userdata).and_return(value) - end - - context 'when physical machine with no hypervisor' do - let(:value) { nil } - - before do - allow(Facter::Util::Facts::Posix::VirtualDetector).to receive(:platform).and_return('nil') - end - - it 'returns ec2 userdata fact as nil' do - expect(fact.call_the_resolver).to be_an_instance_of(Facter::ResolvedFact).and \ - have_attributes(name: 'ec2_userdata', value: value) - end - - it "doesn't call Ec2 resolver" do - fact.call_the_resolver - expect(Facter::Resolvers::Ec2).not_to have_received(:resolve).with(:userdata) - end - end - - shared_examples 'check ec2 resolver called with userdata' do - it 'calls ec2 resolver' do - fact.call_the_resolver - - expect(Facter::Resolvers::Ec2).to have_received(:resolve).with(:userdata) - end - end - - shared_examples 'check resolved fact value' do - it 'returns ec2 userdata fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Facter::ResolvedFact).and \ - have_attributes(name: 'ec2_userdata', value: value) - end - end - - context 'when platform is kvm' do - let(:value) { { 'info' => 'value' } } - - before do - allow(Facter::Util::Facts::Posix::VirtualDetector).to receive(:platform).and_return('kvm') - end - - it_behaves_like 'check ec2 resolver called with userdata' - it_behaves_like 'check resolved fact value' - end - - context 'when platform is xen' do - let(:value) { { 'info' => 'value' } } - - before do - allow(Facter::Util::Facts::Posix::VirtualDetector).to receive(:platform).and_return('xen') - end - - it_behaves_like 'check ec2 resolver called with userdata' - it_behaves_like 'check resolved fact value' - end - - context 'when platform is aws' do - let(:value) { { 'info' => 'value' } } - - before do - allow(Facter::Util::Facts::Posix::VirtualDetector).to receive(:platform).and_return('aws') - end - - it_behaves_like 'check ec2 resolver called with userdata' - it_behaves_like 'check resolved fact value' - end - end -end diff --git a/spec/facter/facts/openbsd/facterversion_spec.rb b/spec/facter/facts/openbsd/facterversion_spec.rb deleted file mode 100644 index d904c080f7..0000000000 --- a/spec/facter/facts/openbsd/facterversion_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Facterversion do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Facterversion.new } - - let(:value) { '4.0.3' } - - before do - allow(Facter::Resolvers::Facterversion).to receive(:resolve).with(:facterversion).and_return(value) - end - - it 'calls Facter::Resolvers::Facterversion' do - fact.call_the_resolver - expect(Facter::Resolvers::Facterversion).to have_received(:resolve).with(:facterversion) - end - - it 'returns facterversion fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Facter::ResolvedFact).and \ - have_attributes(name: 'facterversion', value: value) - end - end -end diff --git a/spec/facter/facts/openbsd/identity/gid_spec.rb b/spec/facter/facts/openbsd/identity/gid_spec.rb deleted file mode 100644 index ab18b1d3cc..0000000000 --- a/spec/facter/facts/openbsd/identity/gid_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Identity::Gid do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Identity::Gid.new } - - let(:value) { '20' } - - before do - allow(Facter::Resolvers::PosxIdentity).to receive(:resolve).with(:gid).and_return(value) - end - - it 'calls Facter::Resolvers::PosxIdentity' do - fact.call_the_resolver - expect(Facter::Resolvers::PosxIdentity).to have_received(:resolve).with(:gid) - end - - it 'returns identity gid fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Facter::ResolvedFact).and \ - have_attributes(name: 'identity.gid', value: value) - end - end -end diff --git a/spec/facter/facts/openbsd/identity/group_spec.rb b/spec/facter/facts/openbsd/identity/group_spec.rb deleted file mode 100644 index 7716b25b19..0000000000 --- a/spec/facter/facts/openbsd/identity/group_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Identity::Group do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Identity::Group.new } - - let(:value) { 'staff' } - - before do - allow(Facter::Resolvers::PosxIdentity).to receive(:resolve).with(:group).and_return(value) - end - - it 'calls Facter::Resolvers::PosxIdentity' do - fact.call_the_resolver - expect(Facter::Resolvers::PosxIdentity).to have_received(:resolve).with(:group) - end - - it 'returns identity group fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'identity.group', value: value), - an_object_having_attributes(name: 'gid', value: value, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/identity/privileged_spec.rb b/spec/facter/facts/openbsd/identity/privileged_spec.rb deleted file mode 100644 index b533538e51..0000000000 --- a/spec/facter/facts/openbsd/identity/privileged_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Identity::Privileged do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Identity::Privileged.new } - - let(:value) { 'false' } - - before do - allow(Facter::Resolvers::PosxIdentity).to receive(:resolve).with(:privileged).and_return(value) - end - - it 'calls Facter::Resolvers::PosxIdentity' do - fact.call_the_resolver - expect(Facter::Resolvers::PosxIdentity).to have_received(:resolve).with(:privileged) - end - - it 'returns identity privileged fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Facter::ResolvedFact).and \ - have_attributes(name: 'identity.privileged', value: value) - end - end -end diff --git a/spec/facter/facts/openbsd/identity/uid_spec.rb b/spec/facter/facts/openbsd/identity/uid_spec.rb deleted file mode 100644 index 86ef507f60..0000000000 --- a/spec/facter/facts/openbsd/identity/uid_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Identity::Uid do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Identity::Uid.new } - - let(:value) { '501' } - - before do - allow(Facter::Resolvers::PosxIdentity).to receive(:resolve).with(:uid).and_return(value) - end - - it 'calls Facter::Resolvers::PosxIdentity' do - fact.call_the_resolver - expect(Facter::Resolvers::PosxIdentity).to have_received(:resolve).with(:uid) - end - - it 'returns identity uid fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Facter::ResolvedFact).and \ - have_attributes(name: 'identity.uid', value: value) - end - end -end diff --git a/spec/facter/facts/openbsd/identity/user_spec.rb b/spec/facter/facts/openbsd/identity/user_spec.rb deleted file mode 100644 index 8eede4a2a0..0000000000 --- a/spec/facter/facts/openbsd/identity/user_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Identity::User do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Identity::User.new } - - let(:value) { 'root' } - - before do - allow(Facter::Resolvers::PosxIdentity).to receive(:resolve).with(:user).and_return(value) - end - - it 'calls Facter::Resolvers::PosxIdentity' do - fact.call_the_resolver - expect(Facter::Resolvers::PosxIdentity).to have_received(:resolve).with(:user) - end - - it 'returns id and identity user name' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'identity.user', value: value), - an_object_having_attributes(name: 'id', value: value, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/ipaddress6_interfaces_spec.rb b/spec/facter/facts/openbsd/ipaddress6_interfaces_spec.rb deleted file mode 100644 index ff062c8735..0000000000 --- a/spec/facter/facts/openbsd/ipaddress6_interfaces_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Ipaddress6Interfaces do - subject(:fact) { Facts::Openbsd::Ipaddress6Interfaces.new } - - before do - allow(Facter::Resolvers::Networking).to receive(:resolve).with(:interfaces).and_return(interfaces) - end - - describe '#call_the_resolver' do - let(:interfaces) { { 'em0' => { ip6: 'fe80::99bf:da20:ad3:9bfe' }, 'vio0' => { ip6: 'fe80::99bf:da20:ad3:9bfe' } } } - - it 'calls Facter::Resolvers::NetworkingOpenBSD' do - fact.call_the_resolver - expect(Facter::Resolvers::Networking).to have_received(:resolve).with(:interfaces) - end - - it 'returns legacy facts with names ipaddress6_' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'ipaddress6_em0', - value: interfaces['em0'][:ip6], type: :legacy), - an_object_having_attributes(name: 'ipaddress6_vio0', - value: interfaces['vio0'][:ip6], type: :legacy)) - end - end - - describe '#call_the_resolver when resolver returns nil' do - let(:interfaces) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and contain_exactly - end - end -end diff --git a/spec/facter/facts/openbsd/ipaddress_interfaces_spec.rb b/spec/facter/facts/openbsd/ipaddress_interfaces_spec.rb deleted file mode 100644 index 54696290b7..0000000000 --- a/spec/facter/facts/openbsd/ipaddress_interfaces_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::IpaddressInterfaces do - subject(:fact) { Facts::Openbsd::IpaddressInterfaces.new } - - before do - allow(Facter::Resolvers::Networking).to receive(:resolve).with(:interfaces).and_return(interfaces) - end - - describe '#call_the_resolver' do - let(:interfaces) { { 'em0' => { ip: '10.16.117.100' }, 'vio0' => { ip: '10.16.117.255' } } } - - it 'calls Facter::Resolvers::NetworkingOpenBSD' do - fact.call_the_resolver - expect(Facter::Resolvers::Networking).to have_received(:resolve).with(:interfaces) - end - - it 'returns legacy facts with names ipaddress_' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'ipaddress_em0', - value: interfaces['em0'][:ip], type: :legacy), - an_object_having_attributes(name: 'ipaddress_vio0', - value: interfaces['vio0'][:ip], type: :legacy)) - end - end - - describe '#call_the_resolver when resolver returns nil' do - let(:interfaces) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and contain_exactly - end - end -end diff --git a/spec/facter/facts/openbsd/is_virtual_spec.rb b/spec/facter/facts/openbsd/is_virtual_spec.rb deleted file mode 100644 index 1cf8bb8ee2..0000000000 --- a/spec/facter/facts/openbsd/is_virtual_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::IsVirtual do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::IsVirtual.new } - - let(:virtual_detector_double) { class_spy(Facter::Util::Facts::Posix::VirtualDetector) } - - before do - allow(Facter::Util::Facts::Posix::VirtualDetector).to receive(:platform).and_return(virtual_value) - end - - context 'when not in a virtual environment' do - let(:virtual_value) { 'physical' } - - it 'return resolved fact with nil value' do - expect(fact.call_the_resolver) - .to be_an_instance_of(Facter::ResolvedFact) - .and have_attributes(name: 'is_virtual', value: false) - end - end - - context 'when in a virtual environment' do - let(:virtual_value) { 'vmm' } - - it 'return resolved fact with nil value' do - expect(fact.call_the_resolver) - .to be_an_instance_of(Facter::ResolvedFact) - .and have_attributes(name: 'is_virtual', value: true) - end - end - end -end diff --git a/spec/facter/facts/openbsd/kernel_spec.rb b/spec/facter/facts/openbsd/kernel_spec.rb deleted file mode 100644 index b2a5d2ae4e..0000000000 --- a/spec/facter/facts/openbsd/kernel_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Kernel do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Kernel.new } - - let(:value) { 'OpenBSD' } - - before do - allow(Facter::Resolvers::Uname).to receive(:resolve).with(:kernelname).and_return(value) - end - - it 'calls Facter::Resolvers::Uname' do - fact.call_the_resolver - expect(Facter::Resolvers::Uname).to have_received(:resolve).with(:kernelname) - end - - it 'returns kernel fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Facter::ResolvedFact).and \ - have_attributes(name: 'kernel', value: value) - end - end -end diff --git a/spec/facter/facts/openbsd/kernelrelease_spec.rb b/spec/facter/facts/openbsd/kernelrelease_spec.rb deleted file mode 100644 index ad1b9a877c..0000000000 --- a/spec/facter/facts/openbsd/kernelrelease_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Kernelrelease do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Kernelrelease.new } - - let(:value) { '7.2' } - - before do - allow(Facter::Resolvers::Uname).to receive(:resolve).with(:kernelrelease).and_return(value) - end - - it 'calls Facter::Resolvers::Uname' do - fact.call_the_resolver - expect(Facter::Resolvers::Uname).to have_received(:resolve).with(:kernelrelease) - end - - it 'returns kernelrelease fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Facter::ResolvedFact).and \ - have_attributes(name: 'kernelrelease', value: value) - end - end -end diff --git a/spec/facter/facts/openbsd/mountpoints_spec.rb b/spec/facter/facts/openbsd/mountpoints_spec.rb deleted file mode 100644 index ec7c15f833..0000000000 --- a/spec/facter/facts/openbsd/mountpoints_spec.rb +++ /dev/null @@ -1,62 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Mountpoints do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Mountpoints.new } - - context 'when resolver returns hash' do - let(:resolver_output) do - { '/var': { available: '15.18 GiB', - available_bytes: 16_299_800_576, - capacity: '12.49%', - device: '/dev/sd0j', - filesystem: 'ffs', - options: %w[local nodev nosuid], - size: '18.40 GiB', - size_bytes: 19_754_121_216, - used: '2.30 GiB', - used_bytes: 2_466_615_296 } } - end - let(:parsed_fact) do - { '/var' => { 'available' => '15.18 GiB', - 'available_bytes' => 16_299_800_576, - 'capacity' => '12.49%', - 'device' => '/dev/sd0j', - 'filesystem' => 'ffs', - 'options' => %w[local nodev nosuid], - 'size' => '18.40 GiB', - 'size_bytes' => 19_754_121_216, - 'used' => '2.30 GiB', - 'used_bytes' => 2_466_615_296 } } - end - - before do - allow(Facter::Resolvers::Openbsd::Mountpoints).to \ - receive(:resolve).with(:mountpoints).and_return(resolver_output) - end - - it 'calls Facter::Resolvers::Openbsd::Mountpoints' do - fact.call_the_resolver - expect(Facter::Resolvers::Openbsd::Mountpoints).to \ - have_received(:resolve).with(:mountpoints) - end - - it 'returns mountpoints information' do - expect(fact.call_the_resolver).to be_an_instance_of(Facter::ResolvedFact).and \ - have_attributes(name: 'mountpoints', value: parsed_fact) - end - end - - context 'when resolver returns nil' do - before do - allow(Facter::Resolvers::Openbsd::Mountpoints).to \ - receive(:resolve).with(:mountpoints).and_return(nil) - end - - it 'returns mountpoints information' do - expect(fact.call_the_resolver).to be_an_instance_of(Facter::ResolvedFact).and \ - have_attributes(name: 'mountpoints', value: nil) - end - end - end -end diff --git a/spec/facter/facts/openbsd/netmask6_interfaces_spec.rb b/spec/facter/facts/openbsd/netmask6_interfaces_spec.rb deleted file mode 100644 index dad59941f7..0000000000 --- a/spec/facter/facts/openbsd/netmask6_interfaces_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Netmask6Interfaces do - subject(:fact) { Facts::Openbsd::Netmask6Interfaces.new } - - before do - allow(Facter::Resolvers::Networking).to receive(:resolve).with(:interfaces).and_return(interfaces) - end - - describe '#call_the_resolver' do - let(:interfaces) do - { 'em0' => { netmask6: 'fe80::99bf:da20:ad3:9bfe' }, - 'vio0' => { netmask6: 'fe80::99bf:da20:ad3:9bfe' } } - end - - it 'calls Facter::Resolvers::NetworkingOpenBSD' do - fact.call_the_resolver - expect(Facter::Resolvers::Networking).to have_received(:resolve).with(:interfaces) - end - - it 'returns legacy facts with names netmask6_' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'netmask6_em0', - value: interfaces['em0'][:netmask6], type: :legacy), - an_object_having_attributes(name: 'netmask6_vio0', - value: interfaces['vio0'][:netmask6], type: :legacy)) - end - end - - describe '#call_the_resolver when resolver return nil' do - let(:interfaces) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and contain_exactly - end - end -end diff --git a/spec/facter/facts/openbsd/netmask_interfaces_spec.rb b/spec/facter/facts/openbsd/netmask_interfaces_spec.rb deleted file mode 100644 index e34d2641e7..0000000000 --- a/spec/facter/facts/openbsd/netmask_interfaces_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::NetmaskInterfaces do - subject(:fact) { Facts::Openbsd::NetmaskInterfaces.new } - - before do - allow(Facter::Resolvers::Networking).to receive(:resolve).with(:interfaces).and_return(interfaces) - end - - describe '#call_the_resolver' do - let(:interfaces) { { 'em0' => { netmask: '10.255.255.255' }, 'vio0' => { netmask: '10.17.255.255' } } } - - it 'calls Facter::Resolvers::NetworkingOpenBSD' do - fact.call_the_resolver - expect(Facter::Resolvers::Networking).to have_received(:resolve).with(:interfaces) - end - - it 'returns legacy facts with names netmask_' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'netmask_em0', - value: interfaces['em0'][:netmask], type: :legacy), - an_object_having_attributes(name: 'netmask_vio0', - value: interfaces['vio0'][:netmask], type: :legacy)) - end - end - - describe '#call_the_resolver when resolver returns nil' do - let(:interfaces) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and contain_exactly - end - end -end diff --git a/spec/facter/facts/openbsd/network6_interfaces_spec.rb b/spec/facter/facts/openbsd/network6_interfaces_spec.rb deleted file mode 100644 index 67423aba2f..0000000000 --- a/spec/facter/facts/openbsd/network6_interfaces_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Network6Interfaces do - subject(:fact) { Facts::Openbsd::Network6Interfaces.new } - - before do - allow(Facter::Resolvers::Networking).to receive(:resolve).with(:interfaces).and_return(interfaces) - end - - describe '#call_the_resolver' do - let(:interfaces) { { 'em0' => { network6: '::1' }, 'vio0' => { network6: 'fe80::' } } } - - it 'calls Facter::Resolvers::NetworkingOpenBSD' do - fact.call_the_resolver - expect(Facter::Resolvers::Networking).to have_received(:resolve).with(:interfaces) - end - - it 'returns legacy facts with names network6_' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'network6_em0', - value: interfaces['em0'][:network6], type: :legacy), - an_object_having_attributes(name: 'network6_vio0', - value: interfaces['vio0'][:network6], type: :legacy)) - end - end - - describe '#call_the_resolver when resolver returns nil' do - let(:interfaces) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and contain_exactly - end - end -end diff --git a/spec/facter/facts/openbsd/network_interfaces_spec.rb b/spec/facter/facts/openbsd/network_interfaces_spec.rb deleted file mode 100644 index 321128f3dc..0000000000 --- a/spec/facter/facts/openbsd/network_interfaces_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::NetworkInterfaces do - subject(:fact) { Facts::Openbsd::NetworkInterfaces.new } - - before do - allow(Facter::Resolvers::Networking).to receive(:resolve).with(:interfaces).and_return(interfaces) - end - - describe '#call_the_resolver' do - let(:interfaces) { { 'em0' => { network: '10.255.255.255' }, 'vio0' => { network: '10.17.255.255' } } } - - it 'calls Facter::Resolvers::NetworkingOpenBSD' do - fact.call_the_resolver - expect(Facter::Resolvers::Networking).to have_received(:resolve).with(:interfaces) - end - - it 'returns legacy facts with names network_' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'network_em0', - value: interfaces['em0'][:network], type: :legacy), - an_object_having_attributes(name: 'network_vio0', - value: interfaces['vio0'][:network], type: :legacy)) - end - end - - describe '#call_the_resolver when resolver returns nil' do - let(:interfaces) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and contain_exactly - end - end -end diff --git a/spec/facter/facts/openbsd/networking/dhcp_spec.rb b/spec/facter/facts/openbsd/networking/dhcp_spec.rb deleted file mode 100644 index 8e3ac19e9f..0000000000 --- a/spec/facter/facts/openbsd/networking/dhcp_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Networking::Dhcp do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Networking::Dhcp.new } - - let(:value) { '192.168.158.6' } - - before do - allow(Facter::Resolvers::Networking).to receive(:resolve).with(:dhcp).and_return(value) - end - - it 'calls Facter::Resolvers::Networking' do - fact.call_the_resolver - expect(Facter::Resolvers::Networking).to have_received(:resolve).with(:dhcp) - end - - it 'returns networking.dhcp fact' do - expect(fact.call_the_resolver) - .to be_an_instance_of(Facter::ResolvedFact).and have_attributes(name: 'networking.dhcp', value: value) - end - - context 'when dhcp can not be retrieved' do - let(:value) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver) - .to be_an_instance_of(Facter::ResolvedFact).and have_attributes(name: 'networking.dhcp', value: value) - end - end - end -end diff --git a/spec/facter/facts/openbsd/networking/domain_spec.rb b/spec/facter/facts/openbsd/networking/domain_spec.rb deleted file mode 100644 index 854a97c81a..0000000000 --- a/spec/facter/facts/openbsd/networking/domain_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Networking::Domain do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Networking::Domain.new } - - let(:value) { 'domain' } - - before do - allow(Facter::Resolvers::Hostname).to receive(:resolve).with(:domain).and_return(value) - end - - it 'calls Facter::Resolvers::Hostname' do - fact.call_the_resolver - expect(Facter::Resolvers::Hostname).to have_received(:resolve).with(:domain) - end - - it 'returns domain fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.domain', value: value), - an_object_having_attributes(name: 'domain', value: value, type: :legacy)) - end - - context 'when domain can not be retrieved' do - let(:value) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.domain', value: value), - an_object_having_attributes(name: 'domain', value: value, type: :legacy)) - end - end - end -end diff --git a/spec/facter/facts/openbsd/networking/fqdn_spec.rb b/spec/facter/facts/openbsd/networking/fqdn_spec.rb deleted file mode 100644 index 9fd6e419b7..0000000000 --- a/spec/facter/facts/openbsd/networking/fqdn_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Networking::Fqdn do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Networking::Fqdn.new } - - let(:value) { 'host.domain' } - - before do - allow(Facter::Resolvers::Hostname).to receive(:resolve).with(:fqdn).and_return(value) - end - - it 'calls Facter::Resolvers::Hostname' do - fact.call_the_resolver - expect(Facter::Resolvers::Hostname).to have_received(:resolve).with(:fqdn) - end - - it 'returns fqdn fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.fqdn', value: value), - an_object_having_attributes(name: 'fqdn', value: value, type: :legacy)) - end - - context 'when fqdn can not be retrieved' do - let(:value) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.fqdn', value: value), - an_object_having_attributes(name: 'fqdn', value: value, type: :legacy)) - end - end - end -end diff --git a/spec/facter/facts/openbsd/networking/hostname_spec.rb b/spec/facter/facts/openbsd/networking/hostname_spec.rb deleted file mode 100644 index 6d5a79a662..0000000000 --- a/spec/facter/facts/openbsd/networking/hostname_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Networking::Hostname do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Networking::Hostname.new } - - let(:value) { 'host' } - - before do - allow(Facter::Resolvers::Hostname).to receive(:resolve).with(:hostname).and_return(value) - end - - it 'calls Facter::Resolvers::Hostname' do - fact.call_the_resolver - expect(Facter::Resolvers::Hostname).to have_received(:resolve).with(:hostname) - end - - it 'returns hostname fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.hostname', value: value), - an_object_having_attributes(name: 'hostname', value: value, type: :legacy)) - end - - context 'when hostname can not be retrieved' do - let(:value) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.hostname', value: value), - an_object_having_attributes(name: 'hostname', value: value, type: :legacy)) - end - end - end -end diff --git a/spec/facter/facts/openbsd/networking/interfaces_spec.rb b/spec/facter/facts/openbsd/networking/interfaces_spec.rb deleted file mode 100644 index 437f21080f..0000000000 --- a/spec/facter/facts/openbsd/networking/interfaces_spec.rb +++ /dev/null @@ -1,130 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Networking::Interfaces do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Networking::Interfaces.new } - - let(:interfaces) do - { - 'awdl0' => - { mtu: 1484, - mac: '2e:ba:e4:83:4b:b7', - bindings6: - [{ address: 'fe80::2cba:e4ff:fe83:4bb7', - netmask: 'ffff:ffff:ffff:ffff::', - network: 'fe80::' }], - ip6: 'fe80::2cba:e4ff:fe83:4bb7', - netmask6: 'ffff:ffff:ffff:ffff::', - network6: 'fe80::' }, - 'bridge0' => { mtu: 1500, mac: '82:17:0e:93:9d:00' }, - 'en0' => - { dhcp: '192.587.6.9', - mtu: 1500, - mac: '64:5a:ed:ea:5c:81', - bindings: - [{ address: '192.168.1.2', - netmask: '255.255.255.0', - network: '192.168.1.0' }], - ip: '192.168.1.2', - netmask: '255.255.255.0', - network: '192.168.1.0' }, - 'gif0' => { mtu: 1280 }, - 'lo0' => - { mtu: 16_384, - bindings: - [{ address: '127.0.0.1', netmask: '255.0.0.0', network: '127.0.0.0' }], - bindings6: - [{ address: '::1', - netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', - network: '::1' }, - { address: 'fe80::1', - netmask: 'ffff:ffff:ffff:ffff::', - network: 'fe80::' }], - ip: '127.0.0.1', - netmask: '255.0.0.0', - network: '127.0.0.0', - ip6: '::1', - netmask6: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', - network6: '::1' } - } - end - - before do - allow(Facter::Resolvers::Networking).to receive(:resolve).with(:interfaces).and_return(interfaces) - end - - it 'calls Facter::Resolvers::Networking with interfaces' do - fact.call_the_resolver - expect(Facter::Resolvers::Networking).to have_received(:resolve).with(:interfaces) - end - - it 'returns networking.interfaces fact' do - expect(fact.call_the_resolver) - .to be_an_instance_of(Facter::ResolvedFact) - .and have_attributes(name: 'networking.interfaces', value: anything) - end - - it 'returns all interfaces' do - interfaces = %w[awdl0 bridge0 en0 gif0 lo0] - - result = fact.call_the_resolver - - expect(result.value).to include(*interfaces) - end - - it 'returns the interface awdl0 correctly' do - expected = { 'mtu' => 1484, - 'mac' => '2e:ba:e4:83:4b:b7', - 'bindings6' => - [{ 'address' => 'fe80::2cba:e4ff:fe83:4bb7', - 'netmask' => 'ffff:ffff:ffff:ffff::', - 'network' => 'fe80::' }], - 'ip6' => 'fe80::2cba:e4ff:fe83:4bb7', - 'netmask6' => 'ffff:ffff:ffff:ffff::', - 'network6' => 'fe80::' } - - result = fact.call_the_resolver - - expect(result.value['awdl0']).to match(expected) - end - - it 'returns the interface bridge0 correctly' do - result = fact.call_the_resolver - - expect(result.value['bridge0']).to match({ 'mtu' => 1500, 'mac' => '82:17:0e:93:9d:00' }) - end - - it 'returns the interface en0 correctly' do - expected = { 'mtu' => 1500, - 'mac' => '64:5a:ed:ea:5c:81', - 'bindings' => - [{ 'address' => '192.168.1.2', - 'netmask' => '255.255.255.0', - 'network' => '192.168.1.0' }], - 'ip' => '192.168.1.2', - 'netmask' => '255.255.255.0', - 'network' => '192.168.1.0', - 'dhcp' => '192.587.6.9' } - - result = fact.call_the_resolver - - expect(result.value['en0']).to match(expected) - end - - it 'returns the interface gif0 correctly' do - result = fact.call_the_resolver - - expect(result.value['gif0']).to match({ 'mtu' => 1280 }) - end - - context 'when interfaces can not be retrieved' do - let(:interfaces) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver) - .to be_an_instance_of(Facter::ResolvedFact) - .and have_attributes(name: 'networking.interfaces', value: interfaces) - end - end - end -end diff --git a/spec/facter/facts/openbsd/networking/ip6_spec.rb b/spec/facter/facts/openbsd/networking/ip6_spec.rb deleted file mode 100644 index 091c2447bd..0000000000 --- a/spec/facter/facts/openbsd/networking/ip6_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Networking::Ip6 do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Networking::Ip6.new } - - let(:value) { 'fe80::2cba:e4ff:fe83:4bb7' } - - before do - allow(Facter::Resolvers::Networking).to receive(:resolve).with(:ip6).and_return(value) - end - - it 'calls Facter::Resolvers::Networking with :ip6' do - fact.call_the_resolver - expect(Facter::Resolvers::Networking).to have_received(:resolve).with(:ip6) - end - - it 'returns the ip6 fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.ip6', value: value), - an_object_having_attributes(name: 'ipaddress6', value: value, type: :legacy)) - end - - context 'when ip6 can not be retrieved' do - let(:value) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.ip6', value: value), - an_object_having_attributes(name: 'ipaddress6', value: value, type: :legacy)) - end - end - end -end diff --git a/spec/facter/facts/openbsd/networking/ip_spec.rb b/spec/facter/facts/openbsd/networking/ip_spec.rb deleted file mode 100644 index a4bffb5197..0000000000 --- a/spec/facter/facts/openbsd/networking/ip_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Networking::Ip do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Networking::Ip.new } - - let(:value) { '10.0.0.1' } - - before do - allow(Facter::Resolvers::Networking).to receive(:resolve).with(:ip).and_return(value) - end - - it 'calls Facter::Resolvers::Networking with :ip' do - fact.call_the_resolver - expect(Facter::Resolvers::Networking).to have_received(:resolve).with(:ip) - end - - it 'returns the ip6 fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.ip', value: value), - an_object_having_attributes(name: 'ipaddress', value: value, type: :legacy)) - end - - context 'when ip can not be retrieved' do - let(:value) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.ip', value: value), - an_object_having_attributes(name: 'ipaddress', value: value, type: :legacy)) - end - end - end -end diff --git a/spec/facter/facts/openbsd/networking/mac_spec.rb b/spec/facter/facts/openbsd/networking/mac_spec.rb deleted file mode 100644 index f4e1339715..0000000000 --- a/spec/facter/facts/openbsd/networking/mac_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Networking::Mac do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Networking::Mac.new } - - let(:value) { '64:5a:ed:ea:c3:25' } - - before do - allow(Facter::Resolvers::Networking).to receive(:resolve).with(:mac).and_return(value) - end - - it 'calls Facter::Resolvers::Networking with :mac' do - fact.call_the_resolver - expect(Facter::Resolvers::Networking).to have_received(:resolve).with(:mac) - end - - it 'returns macaddress fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.mac', value: value), - an_object_having_attributes(name: 'macaddress', value: value, type: :legacy)) - end - - context 'when mac can not be retrieved' do - let(:value) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.mac', value: value), - an_object_having_attributes(name: 'macaddress', value: value, type: :legacy)) - end - end - end -end diff --git a/spec/facter/facts/openbsd/networking/mtu_spec.rb b/spec/facter/facts/openbsd/networking/mtu_spec.rb deleted file mode 100644 index 20447af686..0000000000 --- a/spec/facter/facts/openbsd/networking/mtu_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Networking::Mtu do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Networking::Mtu.new } - - let(:value) { 1500 } - - before do - allow(Facter::Resolvers::Networking).to receive(:resolve).with(:mtu).and_return(value) - end - - it 'calls Facter::Resolvers::Networking with :mtu' do - fact.call_the_resolver - expect(Facter::Resolvers::Networking).to have_received(:resolve).with(:mtu) - end - - it 'returns mtu fact' do - expect(fact.call_the_resolver) - .to be_an_instance_of(Facter::ResolvedFact).and have_attributes(name: 'networking.mtu', value: value) - end - - context 'when mtu can not be retrieved' do - let(:value) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver) - .to be_an_instance_of(Facter::ResolvedFact).and have_attributes(name: 'networking.mtu', value: value) - end - end - end -end diff --git a/spec/facter/facts/openbsd/networking/netmask6_spec.rb b/spec/facter/facts/openbsd/networking/netmask6_spec.rb deleted file mode 100644 index db293180cf..0000000000 --- a/spec/facter/facts/openbsd/networking/netmask6_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Networking::Netmask6 do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Networking::Netmask6.new } - - let(:value) { 'ffff:ffff:ffff:ffff::' } - - before do - allow(Facter::Resolvers::Networking).to receive(:resolve).with(:netmask6).and_return(value) - end - - it 'calls Facter::Resolvers::Networking with :netmask6' do - fact.call_the_resolver - expect(Facter::Resolvers::Networking).to have_received(:resolve).with(:netmask6) - end - - it 'returns the netmask6 fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.netmask6', value: value), - an_object_having_attributes(name: 'netmask6', value: value, type: :legacy)) - end - - context 'when netmask6 can not be retrieved' do - let(:value) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.netmask6', value: value), - an_object_having_attributes(name: 'netmask6', value: value, type: :legacy)) - end - end - end -end diff --git a/spec/facter/facts/openbsd/networking/netmask_spec.rb b/spec/facter/facts/openbsd/networking/netmask_spec.rb deleted file mode 100644 index acd23fd2c9..0000000000 --- a/spec/facter/facts/openbsd/networking/netmask_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Networking::Netmask do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Networking::Netmask.new } - - let(:value) { '255.255.255.0' } - - before do - allow(Facter::Resolvers::Networking).to receive(:resolve).with(:netmask).and_return(value) - end - - it 'calls Facter::Resolvers::Networking with :netmask' do - fact.call_the_resolver - expect(Facter::Resolvers::Networking).to have_received(:resolve).with(:netmask) - end - - it 'returns the netmask fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.netmask', value: value), - an_object_having_attributes(name: 'netmask', value: value, type: :legacy)) - end - - context 'when netmask can not be retrieved' do - let(:value) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.netmask', value: value), - an_object_having_attributes(name: 'netmask', value: value, type: :legacy)) - end - end - end -end diff --git a/spec/facter/facts/openbsd/networking/network6_spec.rb b/spec/facter/facts/openbsd/networking/network6_spec.rb deleted file mode 100644 index 4484eaea41..0000000000 --- a/spec/facter/facts/openbsd/networking/network6_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Networking::Network6 do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Networking::Network6.new } - - let(:value) { 'ff80:3454::' } - - before do - allow(Facter::Resolvers::Networking).to receive(:resolve).with(:network6).and_return(value) - end - - it 'calls Facter::Resolvers::Networking with :network6' do - fact.call_the_resolver - expect(Facter::Resolvers::Networking).to have_received(:resolve).with(:network6) - end - - it 'returns the network6 fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.network6', value: value), - an_object_having_attributes(name: 'network6', value: value, type: :legacy)) - end - - context 'when network6 can not be retrieved' do - let(:value) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.network6', value: value), - an_object_having_attributes(name: 'network6', value: value, type: :legacy)) - end - end - end -end diff --git a/spec/facter/facts/openbsd/networking/network_spec.rb b/spec/facter/facts/openbsd/networking/network_spec.rb deleted file mode 100644 index 7abf5faefd..0000000000 --- a/spec/facter/facts/openbsd/networking/network_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Networking::Network do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Networking::Network.new } - - let(:value) { '192.168.143.0' } - - before do - allow(Facter::Resolvers::Networking).to receive(:resolve).with(:network).and_return(value) - end - - it 'calls Facter::Resolvers::Networking with :network' do - fact.call_the_resolver - expect(Facter::Resolvers::Networking).to have_received(:resolve).with(:network) - end - - it 'returns the network fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.network', value: value), - an_object_having_attributes(name: 'network', value: value, type: :legacy)) - end - - context 'when network can not be retrieved' do - let(:value) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'networking.network', value: value), - an_object_having_attributes(name: 'network', value: value, type: :legacy)) - end - end - end -end diff --git a/spec/facter/facts/openbsd/networking/primary_spec.rb b/spec/facter/facts/openbsd/networking/primary_spec.rb deleted file mode 100644 index 1f19391673..0000000000 --- a/spec/facter/facts/openbsd/networking/primary_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Networking::Primary do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Networking::Primary.new } - - let(:value) { 'em0' } - - before do - allow(Facter::Resolvers::Networking).to receive(:resolve).with(:primary_interface).and_return(value) - end - - it 'calls Facter::Resolvers::Networking with :primary_interface' do - fact.call_the_resolver - expect(Facter::Resolvers::Networking).to have_received(:resolve).with(:primary_interface) - end - - it 'returns networking.primary fact' do - expect(fact.call_the_resolver) - .to be_an_instance_of(Facter::ResolvedFact).and have_attributes(name: 'networking.primary', value: value) - end - - context 'when primary interface can not be retrieved' do - let(:value) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver) - .to be_an_instance_of(Facter::ResolvedFact).and have_attributes(name: 'networking.primary', value: value) - end - end - end -end diff --git a/spec/facter/facts/openbsd/networking/scope6_spec.rb b/spec/facter/facts/openbsd/networking/scope6_spec.rb deleted file mode 100644 index a1621a1c4f..0000000000 --- a/spec/facter/facts/openbsd/networking/scope6_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Networking::Scope6 do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Networking::Scope6.new } - - let(:value) { 'link' } - - before do - allow(Facter::Resolvers::Networking).to receive(:resolve).with(:scope6).and_return(value) - end - - it 'calls Facter::Resolvers::Networking with scope6' do - fact.call_the_resolver - expect(Facter::Resolvers::Networking).to have_received(:resolve).with(:scope6) - end - - it 'returns scope6 fact' do - expect(fact.call_the_resolver) - .to be_an_instance_of(Facter::ResolvedFact) - .and have_attributes(name: 'networking.scope6', value: value) - end - - context 'when scope6 can not be resolved' do - let(:value) { nil } - - it 'returns nil' do - expect(fact.call_the_resolver) - .to be_an_instance_of(Facter::ResolvedFact) - .and have_attributes(name: 'networking.scope6', value: value) - end - end - end -end diff --git a/spec/facter/facts/openbsd/os/architecture_spec.rb b/spec/facter/facts/openbsd/os/architecture_spec.rb deleted file mode 100644 index ff6d8f328a..0000000000 --- a/spec/facter/facts/openbsd/os/architecture_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Os::Architecture do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Os::Architecture.new } - - let(:value) { 'amd64' } - - before do - allow(Facter::Resolvers::Uname).to receive(:resolve).with(:machine).and_return(value) - end - - it 'calls Facter::Resolvers::Uname' do - fact.call_the_resolver - expect(Facter::Resolvers::Uname).to have_received(:resolve).with(:machine) - end - - it 'returns architecture fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'os.architecture', value: value), - an_object_having_attributes(name: 'architecture', value: value, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/os/hardware_spec.rb b/spec/facter/facts/openbsd/os/hardware_spec.rb deleted file mode 100644 index c86b97397f..0000000000 --- a/spec/facter/facts/openbsd/os/hardware_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Os::Hardware do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Os::Hardware.new } - - let(:value) { 'amd64' } - - before do - allow(Facter::Resolvers::Uname).to receive(:resolve).with(:machine).and_return(value) - end - - it 'calls Facter::Resolvers::HardwareArchitecture' do - fact.call_the_resolver - expect(Facter::Resolvers::Uname).to have_received(:resolve).with(:machine) - end - - it 'returns hardware model fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'os.hardware', value: value), - an_object_having_attributes(name: 'hardwaremodel', value: value, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/os/name_spec.rb b/spec/facter/facts/openbsd/os/name_spec.rb deleted file mode 100644 index 23f544befb..0000000000 --- a/spec/facter/facts/openbsd/os/name_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Os::Name do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Os::Name.new } - - let(:value) { 'OpenBSD' } - - before do - allow(Facter::Resolvers::Uname).to receive(:resolve).with(:kernelname).and_return(value) - end - - it 'calls Facter::Resolvers::Uname' do - fact.call_the_resolver - expect(Facter::Resolvers::Uname).to have_received(:resolve).with(:kernelname) - end - - it 'returns operating system name fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'os.name', value: value), - an_object_having_attributes(name: 'operatingsystem', value: value, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/os/release_spec.rb b/spec/facter/facts/openbsd/os/release_spec.rb deleted file mode 100644 index a0d75bcd29..0000000000 --- a/spec/facter/facts/openbsd/os/release_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Os::Release do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Os::Release.new } - - before do - allow(Facter::Resolvers::Uname).to receive(:resolve).with(:kernelrelease).and_return(value) - end - - context 'when OpenBSD RELEASE' do - let(:value) { '7.2' } - - it 'calls Facter::Resolvers::Uname' do - fact.call_the_resolver - expect(Facter::Resolvers::Uname).to have_received(:resolve).with(:kernelrelease) - end - - it 'returns release fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'os.release', value: { 'full' => value, - 'major' => '7', - 'minor' => '2' }), - an_object_having_attributes(name: 'operatingsystemmajrelease', value: '7', - type: :legacy), - an_object_having_attributes(name: 'operatingsystemrelease', value: value, type: :legacy)) - end - end - end -end diff --git a/spec/facter/facts/openbsd/path_spec.rb b/spec/facter/facts/openbsd/path_spec.rb deleted file mode 100644 index 53084a5cca..0000000000 --- a/spec/facter/facts/openbsd/path_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Path do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Path.new } - - let(:value) { '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin' } - - before do - allow(Facter::Resolvers::Path).to \ - receive(:resolve).with(:path).and_return(value) - end - - it 'calls Facter::Resolvers::Path' do - fact.call_the_resolver - expect(Facter::Resolvers::Path).to have_received(:resolve).with(:path) - end - - it 'returns path fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Facter::ResolvedFact).and \ - have_attributes(name: 'path', value: value) - end - end -end diff --git a/spec/facter/facts/openbsd/processors/isa_spec.rb b/spec/facter/facts/openbsd/processors/isa_spec.rb deleted file mode 100644 index ceac928df2..0000000000 --- a/spec/facter/facts/openbsd/processors/isa_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Processors::Isa do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Processors::Isa.new } - - let(:isa) { 'amd64' } - - before do - allow(Facter::Resolvers::Uname).to \ - receive(:resolve).with(:processor).and_return(isa) - end - - it 'calls Facter::Resolvers::Uname' do - fact.call_the_resolver - expect(Facter::Resolvers::Uname).to have_received(:resolve).with(:processor) - end - - it 'returns a resolved fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'processors.isa', value: isa), - an_object_having_attributes(name: 'hardwareisa', value: isa, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/ruby/platform_spec.rb b/spec/facter/facts/openbsd/ruby/platform_spec.rb deleted file mode 100644 index 49dcd2ae09..0000000000 --- a/spec/facter/facts/openbsd/ruby/platform_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Ruby::Platform do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Ruby::Platform.new } - - let(:value) { 'x86_64-openbsd' } - - before do - allow(Facter::Resolvers::Ruby).to receive(:resolve).with(:platform).and_return(value) - end - - it 'calls Facter::Resolvers::Ruby' do - fact.call_the_resolver - expect(Facter::Resolvers::Ruby).to have_received(:resolve).with(:platform) - end - - it 'return ruby.platform fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'ruby.platform', value: value), - an_object_having_attributes(name: 'rubyplatform', value: value, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/ruby/sitedir_spec.rb b/spec/facter/facts/openbsd/ruby/sitedir_spec.rb deleted file mode 100644 index 6907a58196..0000000000 --- a/spec/facter/facts/openbsd/ruby/sitedir_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Ruby::Sitedir do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Ruby::Sitedir.new } - - let(:value) { '/usr/local/lib/ruby/site_ruby/3.1' } - - before do - allow(Facter::Resolvers::Ruby).to receive(:resolve).with(:sitedir).and_return(value) - end - - it 'calls Facter::Resolvers::Ruby' do - fact.call_the_resolver - expect(Facter::Resolvers::Ruby).to have_received(:resolve).with(:sitedir) - end - - it 'return ruby sitedir fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'ruby.sitedir', value: value), - an_object_having_attributes(name: 'rubysitedir', value: value, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/ruby/version_spec.rb b/spec/facter/facts/openbsd/ruby/version_spec.rb deleted file mode 100644 index 2243fdcc4b..0000000000 --- a/spec/facter/facts/openbsd/ruby/version_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Ruby::Version do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Ruby::Version.new } - - let(:value) { '3.1.2' } - - before do - allow(Facter::Resolvers::Ruby).to receive(:resolve).with(:version).and_return(value) - end - - it 'calls Facter::Resolvers::Ruby' do - fact.call_the_resolver - expect(Facter::Resolvers::Ruby).to have_received(:resolve).with(:version) - end - - it 'returns ruby version fact' do - expect(fact.call_the_resolver) - .to be_an_instance_of(Array) - .and contain_exactly(an_object_having_attributes(name: 'ruby.version', value: value), - an_object_having_attributes(name: 'rubyversion', value: value, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/ssh_spec.rb b/spec/facter/facts/openbsd/ssh_spec.rb deleted file mode 100644 index ab2958a12e..0000000000 --- a/spec/facter/facts/openbsd/ssh_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Ssh do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Ssh.new } - - let(:ssh) do - [Facter::Util::Resolvers::Ssh.new(Facter::Util::Resolvers::FingerPrint - .new('test', 'test'), 'ecdsa', 'test', 'ecdsa')] - end - let(:value) do - { 'ecdsa' => { 'fingerprints' => - { 'sha1' => 'test', 'sha256' => 'test' }, - 'key' => 'test', - 'type' => 'ecdsa' } } - end - - before do - allow(Facter::Resolvers::Ssh).to \ - receive(:resolve).with(:ssh).and_return(ssh) - end - - it 'calls Facter::Resolvers::Ssh' do - fact.call_the_resolver - expect(Facter::Resolvers::Ssh).to have_received(:resolve).with(:ssh) - end - - it 'returns a resolved fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Facter::ResolvedFact).and \ - have_attributes(name: 'ssh', value: value) - end - end -end diff --git a/spec/facter/facts/openbsd/sshalgorithmkey_spec.rb b/spec/facter/facts/openbsd/sshalgorithmkey_spec.rb deleted file mode 100644 index fabb0223fb..0000000000 --- a/spec/facter/facts/openbsd/sshalgorithmkey_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Sshalgorithmkey do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Sshalgorithmkey.new } - - let(:ssh) do - [Facter::Util::Resolvers::Ssh.new(Facter::Util::Resolvers::FingerPrint - .new('test', 'test'), 'ecdsa', 'test', 'ecdsa'), - Facter::Util::Resolvers::Ssh.new(Facter::Util::Resolvers::FingerPrint - .new('test', 'test'), 'rsa', 'test', 'rsa')] - end - let(:legacy_fact1) { { name: 'ecdsa', value: 'test' } } - let(:legacy_fact2) { { name: 'rsa', value: 'test' } } - - before do - allow(Facter::Resolvers::Ssh).to \ - receive(:resolve).with(:ssh).and_return(ssh) - end - - it 'calls Facter::Resolvers::Ssh' do - fact.call_the_resolver - expect(Facter::Resolvers::Ssh).to have_received(:resolve).with(:ssh) - end - - it 'returns a resolved fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: "ssh#{legacy_fact1[:name]}key", value: legacy_fact1[:value]), - an_object_having_attributes(name: "ssh#{legacy_fact2[:name]}key", value: legacy_fact2[:value])) - end - end -end diff --git a/spec/facter/facts/openbsd/sshfp_algorithm_spec.rb b/spec/facter/facts/openbsd/sshfp_algorithm_spec.rb deleted file mode 100644 index 1bc5c8e6ed..0000000000 --- a/spec/facter/facts/openbsd/sshfp_algorithm_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::SshfpAlgorithm do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::SshfpAlgorithm.new } - - let(:ssh) do - [Facter::Util::Resolvers::Ssh.new(Facter::Util::Resolvers::FingerPrint - .new('sha11', 'sha2561'), 'ecdsa', 'test', 'ecdsa'), - Facter::Util::Resolvers::Ssh.new(Facter::Util::Resolvers::FingerPrint - .new('sha12', 'sha2562'), 'rsa', 'test', 'rsa')] - end - let(:legacy_fact1) { { name: 'ecdsa', value: "sha11\nsha2561" } } - let(:legacy_fact2) { { name: 'rsa', value: "sha12\nsha2562" } } - - before do - allow(Facter::Resolvers::Ssh).to \ - receive(:resolve).with(:ssh).and_return(ssh) - end - - it 'calls Facter::Resolvers::Ssh' do - fact.call_the_resolver - expect(Facter::Resolvers::Ssh).to have_received(:resolve).with(:ssh) - end - - it 'returns a resolved fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: "sshfp_#{legacy_fact1[:name]}", value: legacy_fact1[:value]), - an_object_having_attributes(name: "sshfp_#{legacy_fact2[:name]}", value: legacy_fact2[:value])) - end - end -end diff --git a/spec/facter/facts/openbsd/system_uptime/days_spec.rb b/spec/facter/facts/openbsd/system_uptime/days_spec.rb deleted file mode 100644 index 170ad51e6d..0000000000 --- a/spec/facter/facts/openbsd/system_uptime/days_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::SystemUptime::Days do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::SystemUptime::Days.new } - - let(:value) { '2' } - - before do - allow(Facter::Resolvers::Uptime).to receive(:resolve).with(:days).and_return(value) - end - - it 'calls Facter::Resolvers::Uptime' do - fact.call_the_resolver - expect(Facter::Resolvers::Uptime).to have_received(:resolve).with(:days) - end - - it 'returns days since last boot' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'system_uptime.days', value: value), - an_object_having_attributes(name: 'uptime_days', value: value, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/system_uptime/hours_spec.rb b/spec/facter/facts/openbsd/system_uptime/hours_spec.rb deleted file mode 100644 index bf456e3135..0000000000 --- a/spec/facter/facts/openbsd/system_uptime/hours_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::SystemUptime::Hours do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::SystemUptime::Hours.new } - - let(:value) { '2' } - - before do - allow(Facter::Resolvers::Uptime).to receive(:resolve).with(:hours).and_return(value) - end - - it 'calls Facter::Resolvers::Uptime' do - fact.call_the_resolver - expect(Facter::Resolvers::Uptime).to have_received(:resolve).with(:hours) - end - - it 'returns hours since last boot' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'system_uptime.hours', value: value), - an_object_having_attributes(name: 'uptime_hours', value: value, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/system_uptime/seconds_spec.rb b/spec/facter/facts/openbsd/system_uptime/seconds_spec.rb deleted file mode 100644 index 87fb8df05b..0000000000 --- a/spec/facter/facts/openbsd/system_uptime/seconds_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::SystemUptime::Seconds do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::SystemUptime::Seconds.new } - - let(:value) { 3600 } - - before do - allow(Facter::Resolvers::Uptime).to receive(:resolve).with(:seconds).and_return(value) - end - - it 'calls Facter::Resolvers::Uptime' do - fact.call_the_resolver - expect(Facter::Resolvers::Uptime).to have_received(:resolve).with(:seconds) - end - - it 'returns minutes since last boot' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'system_uptime.seconds', value: value), - an_object_having_attributes(name: 'uptime_seconds', value: value, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/system_uptime/uptime_spec.rb b/spec/facter/facts/openbsd/system_uptime/uptime_spec.rb deleted file mode 100644 index 65dd96eb8d..0000000000 --- a/spec/facter/facts/openbsd/system_uptime/uptime_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::SystemUptime::Uptime do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::SystemUptime::Uptime.new } - - let(:value) { '6 days' } - - before do - allow(Facter::Resolvers::Uptime).to receive(:resolve).with(:uptime).and_return(value) - end - - it 'calls Facter::Resolvers::Uptime' do - fact.call_the_resolver - expect(Facter::Resolvers::Uptime).to have_received(:resolve).with(:uptime) - end - - it 'returns total uptime since last boot' do - expect(fact.call_the_resolver).to be_an_instance_of(Array).and \ - contain_exactly(an_object_having_attributes(name: 'system_uptime.uptime', value: value), - an_object_having_attributes(name: 'uptime', value: value, type: :legacy)) - end - end -end diff --git a/spec/facter/facts/openbsd/timezone_spec.rb b/spec/facter/facts/openbsd/timezone_spec.rb deleted file mode 100644 index e272ac8672..0000000000 --- a/spec/facter/facts/openbsd/timezone_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Timezone do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Timezone.new } - - let(:timezone) { 'UTC' } - - before do - allow(Facter::Resolvers::Timezone).to \ - receive(:resolve).with(:timezone).and_return(timezone) - end - - it 'calls Facter::Resolvers::Timezone' do - fact.call_the_resolver - expect(Facter::Resolvers::Timezone).to have_received(:resolve).with(:timezone) - end - - it 'returns a resolved fact' do - expect(fact.call_the_resolver).to be_an_instance_of(Facter::ResolvedFact).and \ - have_attributes(name: 'timezone', value: timezone) - end - end -end diff --git a/spec/facter/facts/openbsd/virtual_spec.rb b/spec/facter/facts/openbsd/virtual_spec.rb deleted file mode 100644 index 70dd50f93f..0000000000 --- a/spec/facter/facts/openbsd/virtual_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -describe Facts::Openbsd::Virtual do - describe '#call_the_resolver' do - subject(:fact) { Facts::Openbsd::Virtual.new } - - let(:virtual_detector_double) { class_spy(Facter::Util::Facts::Posix::VirtualDetector) } - let(:log_spy) { instance_spy(Facter::Log) } - - before do - allow(Facter::Log).to receive(:new).and_return(log_spy) - allow(Facter::Util::Facts::Posix::VirtualDetector).to receive(:platform).and_return(value) - end - - shared_examples 'check resolved fact value' do - it 'return resolved fact with nil value' do - expect(fact.call_the_resolver) - .to be_an_instance_of(Facter::ResolvedFact) - .and have_attributes(name: 'virtual', value: value) - end - end - - context 'when not in a virtual environment' do - let(:value) { 'physical' } - - it_behaves_like 'check resolved fact value' - end - - context 'when in a virtual environment' do - let(:value) { 'vmm' } - - it_behaves_like 'check resolved fact value' - end - end -end diff --git a/spec/facter/resolvers/openbsd/dmi_bios_spec.rb b/spec/facter/resolvers/openbsd/dmi_bios_spec.rb deleted file mode 100644 index 1fbc2f219f..0000000000 --- a/spec/facter/resolvers/openbsd/dmi_bios_spec.rb +++ /dev/null @@ -1,81 +0,0 @@ -# frozen_string_literal: true - -describe Facter::Resolvers::Openbsd::DmiBios do - describe '#resolve' do - subject(:resolver) { Facter::Resolvers::Openbsd::DmiBios } - - let(:bios_vendor) { 'Phoenix Technologies LTD' } - let(:bios_version) { '6.00' } - let(:product_name) { 'VMware Virtual Platform' } - let(:product_serial) { 'VMware-42 1a 02 ea e6 27 76 b8-a1 23 a7 8a d3 12 ee cf' } - let(:product_uuid) { 'ea021a42-27e6-b876-a123-a78ad312eecf' } - let(:sys_vendor) { 'Phoenix Technologies LTD' } - - before do - allow(Facter::Bsd::FfiHelper) - .to receive(:sysctl) - .with(:string, [6, 14]) - .and_return(bios_vendor) - allow(Facter::Bsd::FfiHelper) - .to receive(:sysctl) - .with(:string, [6, 16]) - .and_return(bios_version) - allow(Facter::Bsd::FfiHelper) - .to receive(:sysctl) - .with(:string, [6, 15]) - .and_return(product_name) - allow(Facter::Bsd::FfiHelper) - .to receive(:sysctl) - .with(:string, [6, 17]) - .and_return(product_serial) - allow(Facter::Bsd::FfiHelper) - .to receive(:sysctl) - .with(:string, [6, 18]) - .and_return(product_uuid) - allow(Facter::Bsd::FfiHelper) - .to receive(:sysctl) - .with(:string, [6, 14]) - .and_return(sys_vendor) - end - - after do - Facter::Resolvers::Openbsd::DmiBios.invalidate_cache - end - - context 'when bios_vendor is available' do - it 'returns bios_release_date' do - expect(resolver.resolve(:bios_vendor)).to eq(bios_vendor) - end - end - - context 'when bios_version is available' do - it 'returns bios_version' do - expect(resolver.resolve(:bios_version)).to eq(bios_version) - end - end - - context 'when sys_vendor is available' do - it ' returns sys_vendor' do - expect(resolver.resolve(:sys_vendor)).to eq(sys_vendor) - end - end - - context 'when product_name is available' do - it 'returns product_name' do - expect(resolver.resolve(:product_name)).to eq(product_name) - end - end - - context 'when product_serial is available' do - it 'returns product_serial_number' do - expect(resolver.resolve(:product_serial)).to eq(product_serial) - end - end - - context 'when product_uuid is available' do - it 'returns product_uuid' do - expect(resolver.resolve(:product_uuid)).to eq(product_uuid) - end - end - end -end diff --git a/spec/facter/resolvers/openbsd/mountpoints_spec.rb b/spec/facter/resolvers/openbsd/mountpoints_spec.rb deleted file mode 100644 index 387c815e1d..0000000000 --- a/spec/facter/resolvers/openbsd/mountpoints_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -describe Facter::Resolvers::Openbsd::Mountpoints do - let(:mountpoints) do - { '/' => { available: '738.97 MiB', available_bytes: 774_868_992, capacity: '20.04%', device: '/dev/sd0a', - filesystem: 'ffs', options: ['local'], size: '985.76 MiB', size_bytes: 1_033_648_128, - used: '197.50 MiB', used_bytes: 207_097_856 }, - '/usr' => { available: '157.56 MiB', available_bytes: 165_216_256, capacity: '79.02%', device: '/dev/sd0d', - filesystem: 'ffs', options: %w[local nodev], size: '985.76 MiB', size_bytes: 1_033_648_128, - used: '778.91 MiB', used_bytes: 816_750_592 }, - '/usr/local' => { available: '1.10 GiB', available_bytes: 1_178_118_144, capacity: '57.17%', - device: '/dev/sd0e', filesystem: 'ffs', options: %w[local nodev wxallowed], - size: '2.90 GiB', size_bytes: 3_114_448_896, used: '1.66 GiB', - used_bytes: 1_780_609_024 } } - end - let(:log_spy) { instance_spy(Facter::Log) } - - before do - Facter::Resolvers::Openbsd::Mountpoints.instance_variable_set(:@log, log_spy) - allow(Facter::Core::Execution).to receive(:execute) - .with('mount', { logger: log_spy }) - .and_return(load_fixture('openbsd_filesystems').read) - allow(Facter::Core::Execution).to receive(:execute) - .with('df -P', { logger: log_spy }) - .and_return(load_fixture('openbsd_df').read) - end - - it 'returns mountpoints' do - result = Facter::Resolvers::Openbsd::Mountpoints.resolve(:mountpoints) - - expect(result).to eq(mountpoints) - end -end diff --git a/spec/facter/resolvers/openbsd/virtual_spec.rb b/spec/facter/resolvers/openbsd/virtual_spec.rb deleted file mode 100644 index 607296d866..0000000000 --- a/spec/facter/resolvers/openbsd/virtual_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -describe Facter::Resolvers::Openbsd::Virtual do - subject(:resolver) { Facter::Resolvers::Openbsd::Virtual } - - let(:vm) { 'VMM' } - - after do - resolver.invalidate_cache - end - - before do - allow(Facter::Bsd::FfiHelper) - .to receive(:sysctl) - .with(:string, [6, 15]) - .and_return(vm) - end - - context 'when running on bare metal' do - let(:vm) { nil } - - it 'returns nil' do - expect(resolver.resolve(:vm)).to be_nil - end - end - - context 'when running in a vm' do - it 'returns VMM' do - expect(resolver.resolve(:vm)).to eq('vmm') - end - end -end diff --git a/spec/fixtures/openbsd_df b/spec/fixtures/openbsd_df deleted file mode 100644 index e94c930d2d..0000000000 --- a/spec/fixtures/openbsd_df +++ /dev/null @@ -1,4 +0,0 @@ -Filesystem 512-blocks Used Available Capacity Mounted on -/dev/sd0a 2018844 404488 1513416 21% / -/dev/sd0d 2018844 1595216 322688 83% /usr -/dev/sd0e 6082908 3477752 2301012 60% /usr/local diff --git a/spec/fixtures/openbsd_filesystems b/spec/fixtures/openbsd_filesystems deleted file mode 100644 index 1b97e80847..0000000000 --- a/spec/fixtures/openbsd_filesystems +++ /dev/null @@ -1,3 +0,0 @@ -/dev/sd0a on / type ffs (local) -/dev/sd0d on /usr type ffs (local, nodev) -/dev/sd0e on /usr/local type ffs (local, nodev, wxallowed)