summaryrefslogtreecommitdiff
path: root/lib/ohai
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-05-15 10:33:04 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2019-05-15 10:36:31 -0700
commit537596bbfed43d08a0bfcbe6b685a026e60c9a09 (patch)
tree159b568306da8a5807f7bca538a2ac515c66d60b /lib/ohai
parent62a879800c77cd6c1808e7a247976d7c910f6209 (diff)
downloadohai-537596bbfed43d08a0bfcbe6b685a026e60c9a09.tar.gz
Apply require speedups to ohailcg/require-speedups
Same kinds of fixes from chef core with require_relative and idempotency checks. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/ohai')
-rw-r--r--lib/ohai/application.rb6
-rw-r--r--lib/ohai/config.rb4
-rw-r--r--lib/ohai/dsl.rb4
-rw-r--r--lib/ohai/dsl/plugin.rb10
-rw-r--r--lib/ohai/hints.rb2
-rw-r--r--lib/ohai/loader.rb8
-rw-r--r--lib/ohai/mixin/azure_metadata.rb2
-rw-r--r--lib/ohai/mixin/command.rb6
-rw-r--r--lib/ohai/mixin/do_metadata.rb2
-rw-r--r--lib/ohai/mixin/ec2_metadata.rb2
-rw-r--r--lib/ohai/mixin/gce_metadata.rb2
-rw-r--r--lib/ohai/mixin/http_helper.rb2
-rw-r--r--lib/ohai/mixin/scaleway_metadata.rb2
-rw-r--r--lib/ohai/mixin/softlayer_metadata.rb2
-rw-r--r--lib/ohai/plugin_config.rb2
-rw-r--r--lib/ohai/plugins/azure.rb4
-rw-r--r--lib/ohai/plugins/bsd/virtualization.rb2
-rw-r--r--lib/ohai/plugins/digital_ocean.rb4
-rw-r--r--lib/ohai/plugins/dmi.rb2
-rw-r--r--lib/ohai/plugins/ec2.rb4
-rw-r--r--lib/ohai/plugins/eucalyptus.rb4
-rw-r--r--lib/ohai/plugins/gce.rb4
-rw-r--r--lib/ohai/plugins/hostname.rb4
-rw-r--r--lib/ohai/plugins/kernel.rb2
-rw-r--r--lib/ohai/plugins/linux/fips.rb2
-rw-r--r--lib/ohai/plugins/linux/virtualization.rb2
-rw-r--r--lib/ohai/plugins/network.rb2
-rw-r--r--lib/ohai/plugins/openstack.rb4
-rw-r--r--lib/ohai/plugins/os.rb2
-rw-r--r--lib/ohai/plugins/packages.rb2
-rw-r--r--lib/ohai/plugins/passwd.rb2
-rw-r--r--lib/ohai/plugins/scaleway.rb4
-rw-r--r--lib/ohai/plugins/scsi.rb2
-rw-r--r--lib/ohai/plugins/softlayer.rb2
-rw-r--r--lib/ohai/plugins/solaris2/dmi.rb2
-rw-r--r--lib/ohai/plugins/solaris2/virtualization.rb2
-rw-r--r--lib/ohai/plugins/uptime.rb2
-rw-r--r--lib/ohai/plugins/windows/fips.rb2
-rw-r--r--lib/ohai/plugins/windows/virtualization.rb2
-rw-r--r--lib/ohai/provides_map.rb8
-rw-r--r--lib/ohai/runner.rb2
-rw-r--r--lib/ohai/system.rb30
-rw-r--r--lib/ohai/util/win32.rb2
43 files changed, 81 insertions, 81 deletions
diff --git a/lib/ohai/application.rb b/lib/ohai/application.rb
index b1455cab..a469fc56 100644
--- a/lib/ohai/application.rb
+++ b/lib/ohai/application.rb
@@ -17,9 +17,9 @@
require "chef-config/path_helper"
require "chef-config/workstation_config_loader"
-require "ohai"
-require "ohai/log"
-require "mixlib/cli"
+require_relative "../ohai"
+require_relative "log"
+require "mixlib/cli" unless defined?(Mixlib::CLI)
require "benchmark"
# The Application class is what is called by the Ohai CLI binary. It handles:
diff --git a/lib/ohai/config.rb b/lib/ohai/config.rb
index 6029a26f..66790d98 100644
--- a/lib/ohai/config.rb
+++ b/lib/ohai/config.rb
@@ -18,8 +18,8 @@
#
require "chef-config/config"
-require "ohai/exception"
-require "ohai/plugin_config"
+require_relative "exception"
+require_relative "plugin_config"
module Ohai
Config = ChefConfig::Config
diff --git a/lib/ohai/dsl.rb b/lib/ohai/dsl.rb
index 7ee6645a..a899a7f4 100644
--- a/lib/ohai/dsl.rb
+++ b/lib/ohai/dsl.rb
@@ -17,5 +17,5 @@
# limitations under the License.
#
-require "ohai/dsl/plugin"
-require "ohai/dsl/plugin/versionvii"
+require_relative "dsl/plugin"
+require_relative "dsl/plugin/versionvii"
diff --git a/lib/ohai/dsl/plugin.rb b/lib/ohai/dsl/plugin.rb
index b102edc0..0abb160d 100644
--- a/lib/ohai/dsl/plugin.rb
+++ b/lib/ohai/dsl/plugin.rb
@@ -18,11 +18,11 @@
# limitations under the License.
#
-require "ohai/mixin/os"
-require "ohai/mixin/command"
-require "ohai/mixin/seconds_to_human"
-require "ohai/hints"
-require "ohai/util/file_helper"
+require_relative "../mixin/os"
+require_relative "../mixin/command"
+require_relative "../mixin/seconds_to_human"
+require_relative "../hints"
+require_relative "../util/file_helper"
module Ohai
diff --git a/lib/ohai/hints.rb b/lib/ohai/hints.rb
index ffa02a43..c1ec22a3 100644
--- a/lib/ohai/hints.rb
+++ b/lib/ohai/hints.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "ffi_yajl"
+require "ffi_yajl" unless defined?(FFI_Yajl)
module Ohai
# Ohai hints are json files on disk that give ohai a hint to things that are often
diff --git a/lib/ohai/loader.rb b/lib/ohai/loader.rb
index 663d1d4e..733aab57 100644
--- a/lib/ohai/loader.rb
+++ b/lib/ohai/loader.rb
@@ -17,10 +17,10 @@
#
require "chef-config/path_helper"
-require "ohai/log"
-require "ohai/mash"
-require "ohai/dsl"
-require "pathname"
+require_relative "log"
+require_relative "mash"
+require_relative "dsl"
+require "pathname" unless defined?(Pathname)
module Ohai
diff --git a/lib/ohai/mixin/azure_metadata.rb b/lib/ohai/mixin/azure_metadata.rb
index 1087fcb8..783ef8a9 100644
--- a/lib/ohai/mixin/azure_metadata.rb
+++ b/lib/ohai/mixin/azure_metadata.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "net/http"
+require "net/http" unless defined?(Net::HTTP)
module Ohai
module Mixin
diff --git a/lib/ohai/mixin/command.rb b/lib/ohai/mixin/command.rb
index eb4844b5..f791c7f1 100644
--- a/lib/ohai/mixin/command.rb
+++ b/lib/ohai/mixin/command.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require "ohai/exception"
-require "ohai/log"
-require "mixlib/shellout"
+require_relative "../exception"
+require_relative "../log"
+require "mixlib/shellout" unless defined?(Mixlib::ShellOut)
module Ohai
module Mixin
diff --git a/lib/ohai/mixin/do_metadata.rb b/lib/ohai/mixin/do_metadata.rb
index b41b80b8..10d850ca 100644
--- a/lib/ohai/mixin/do_metadata.rb
+++ b/lib/ohai/mixin/do_metadata.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "net/http"
+require "net/http" unless defined?(Net::HTTP)
module Ohai
module Mixin
diff --git a/lib/ohai/mixin/ec2_metadata.rb b/lib/ohai/mixin/ec2_metadata.rb
index 4c878e72..d050c473 100644
--- a/lib/ohai/mixin/ec2_metadata.rb
+++ b/lib/ohai/mixin/ec2_metadata.rb
@@ -17,7 +17,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "net/http"
+require "net/http" unless defined?(Net::HTTP)
module Ohai
module Mixin
diff --git a/lib/ohai/mixin/gce_metadata.rb b/lib/ohai/mixin/gce_metadata.rb
index 929928c7..6200cab6 100644
--- a/lib/ohai/mixin/gce_metadata.rb
+++ b/lib/ohai/mixin/gce_metadata.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "net/http"
+require "net/http" unless defined?(Net::HTTP)
module Ohai
module Mixin
diff --git a/lib/ohai/mixin/http_helper.rb b/lib/ohai/mixin/http_helper.rb
index 28a99b79..007476e6 100644
--- a/lib/ohai/mixin/http_helper.rb
+++ b/lib/ohai/mixin/http_helper.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "socket"
+require "socket" unless defined?(Socket)
module Ohai
module Mixin
diff --git a/lib/ohai/mixin/scaleway_metadata.rb b/lib/ohai/mixin/scaleway_metadata.rb
index eb281035..ab88559f 100644
--- a/lib/ohai/mixin/scaleway_metadata.rb
+++ b/lib/ohai/mixin/scaleway_metadata.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "net/http"
+require "net/http" unless defined?(Net::HTTP)
module Ohai
module Mixin
diff --git a/lib/ohai/mixin/softlayer_metadata.rb b/lib/ohai/mixin/softlayer_metadata.rb
index cc2b25f6..d2270380 100644
--- a/lib/ohai/mixin/softlayer_metadata.rb
+++ b/lib/ohai/mixin/softlayer_metadata.rb
@@ -18,7 +18,7 @@
# limitations under the License.
require "net/https"
-require "uri"
+require "uri" unless defined?(URI)
# https://softlayer.github.io/reference/services/SoftLayer_Resource_Metadata/
module ::Ohai::Mixin::SoftlayerMetadata
diff --git a/lib/ohai/plugin_config.rb b/lib/ohai/plugin_config.rb
index b757af21..73c6e432 100644
--- a/lib/ohai/plugin_config.rb
+++ b/lib/ohai/plugin_config.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require "ohai/exception"
+require_relative "exception"
module Ohai
class PluginConfig < Hash
diff --git a/lib/ohai/plugins/azure.rb b/lib/ohai/plugins/azure.rb
index 781a55a7..d0a12567 100644
--- a/lib/ohai/plugins/azure.rb
+++ b/lib/ohai/plugins/azure.rb
@@ -15,8 +15,8 @@
#
Ohai.plugin(:Azure) do
- require "ohai/mixin/azure_metadata"
- require "ohai/mixin/http_helper"
+ require_relative "../mixin/azure_metadata"
+ require_relative "../mixin/http_helper"
include Ohai::Mixin::AzureMetadata
include Ohai::Mixin::HttpHelper
diff --git a/lib/ohai/plugins/bsd/virtualization.rb b/lib/ohai/plugins/bsd/virtualization.rb
index 9635070f..2e2c3a76 100644
--- a/lib/ohai/plugins/bsd/virtualization.rb
+++ b/lib/ohai/plugins/bsd/virtualization.rb
@@ -20,7 +20,7 @@
Ohai.plugin(:Virtualization) do
provides "virtualization"
depends "dmi"
- require "ohai/mixin/dmi_decode"
+ require_relative "../../mixin/dmi_decode"
include Ohai::Mixin::DmiDecode
collect_data(:freebsd, :openbsd, :netbsd, :dragonflybsd) do
diff --git a/lib/ohai/plugins/digital_ocean.rb b/lib/ohai/plugins/digital_ocean.rb
index 8e6b3028..4ee39e2f 100644
--- a/lib/ohai/plugins/digital_ocean.rb
+++ b/lib/ohai/plugins/digital_ocean.rb
@@ -16,8 +16,8 @@
# limitations under the License.
Ohai.plugin(:DigitalOcean) do
- require "ohai/mixin/do_metadata"
- require "ohai/mixin/http_helper"
+ require_relative "../mixin/do_metadata"
+ require_relative "../mixin/http_helper"
include Ohai::Mixin::DOMetadata
include Ohai::Mixin::HttpHelper
diff --git a/lib/ohai/plugins/dmi.rb b/lib/ohai/plugins/dmi.rb
index 10fe46c3..7c3e5f4b 100644
--- a/lib/ohai/plugins/dmi.rb
+++ b/lib/ohai/plugins/dmi.rb
@@ -22,7 +22,7 @@ Ohai.plugin(:DMI) do
# dmidecode does not return data without access to /dev/mem (or its equivalent)
collect_data do
- require "ohai/common/dmi"
+ require_relative "../common/dmi"
dmi Mash.new
# all output lines should fall within one of these patterns
diff --git a/lib/ohai/plugins/ec2.rb b/lib/ohai/plugins/ec2.rb
index 8df09c3f..bd75588e 100644
--- a/lib/ohai/plugins/ec2.rb
+++ b/lib/ohai/plugins/ec2.rb
@@ -26,8 +26,8 @@
# 4. Kernel data mentioned Amazon. This catches Windows HVM & paravirt instances
Ohai.plugin(:EC2) do
- require "ohai/mixin/ec2_metadata"
- require "ohai/mixin/http_helper"
+ require_relative "../mixin/ec2_metadata"
+ require_relative "../mixin/http_helper"
require "base64"
include Ohai::Mixin::Ec2Metadata
diff --git a/lib/ohai/plugins/eucalyptus.rb b/lib/ohai/plugins/eucalyptus.rb
index 81049194..2b34bf6d 100644
--- a/lib/ohai/plugins/eucalyptus.rb
+++ b/lib/ohai/plugins/eucalyptus.rb
@@ -19,8 +19,8 @@
Ohai.plugin(:Eucalyptus) do
# eucalyptus metadata service is compatible with the ec2 service calls
- require "ohai/mixin/ec2_metadata"
- require "ohai/mixin/http_helper"
+ require_relative "../mixin/ec2_metadata"
+ require_relative "../mixin/http_helper"
include Ohai::Mixin::Ec2Metadata
include Ohai::Mixin::HttpHelper
diff --git a/lib/ohai/plugins/gce.rb b/lib/ohai/plugins/gce.rb
index b38cf7fc..974adaff 100644
--- a/lib/ohai/plugins/gce.rb
+++ b/lib/ohai/plugins/gce.rb
@@ -15,8 +15,8 @@
# limitations under the License.
Ohai.plugin(:GCE) do
- require "ohai/mixin/gce_metadata"
- require "ohai/mixin/http_helper"
+ require_relative "../mixin/gce_metadata"
+ require_relative "../mixin/http_helper"
include Ohai::Mixin::GCEMetadata
include Ohai::Mixin::HttpHelper
diff --git a/lib/ohai/plugins/hostname.rb b/lib/ohai/plugins/hostname.rb
index f333bf4a..911a7d9b 100644
--- a/lib/ohai/plugins/hostname.rb
+++ b/lib/ohai/plugins/hostname.rb
@@ -26,7 +26,7 @@
#
Ohai.plugin(:Hostname) do
- require "socket"
+ require "socket" unless defined?(Socket)
require "ipaddr"
provides "domain", "hostname", "fqdn", "machinename"
@@ -161,7 +161,7 @@ Ohai.plugin(:Hostname) do
collect_data(:windows) do
require "wmi-lite/wmi"
- require "socket"
+ require "socket" unless defined?(Socket)
wmi = WmiLite::Wmi.new
host = wmi.first_of("Win32_ComputerSystem")
diff --git a/lib/ohai/plugins/kernel.rb b/lib/ohai/plugins/kernel.rb
index b3964c4c..204af478 100644
--- a/lib/ohai/plugins/kernel.rb
+++ b/lib/ohai/plugins/kernel.rb
@@ -247,7 +247,7 @@ Ohai.plugin(:Kernel) do
end
collect_data(:windows) do
- require "win32ole"
+ require "win32ole" unless defined?(WIN32OLE)
require "wmi-lite/wmi"
WIN32OLE.codepage = WIN32OLE::CP_UTF8
diff --git a/lib/ohai/plugins/linux/fips.rb b/lib/ohai/plugins/linux/fips.rb
index 70d5e142..2f90ea94 100644
--- a/lib/ohai/plugins/linux/fips.rb
+++ b/lib/ohai/plugins/linux/fips.rb
@@ -28,7 +28,7 @@ Ohai.plugin(:Fips) do
collect_data(:linux) do
fips Mash.new
- require "openssl"
+ require "openssl" unless defined?(OpenSSL)
if defined?(OpenSSL.fips_mode) && OpenSSL.fips_mode && !$FIPS_TEST_MODE
fips["kernel"] = { "enabled" => true }
else
diff --git a/lib/ohai/plugins/linux/virtualization.rb b/lib/ohai/plugins/linux/virtualization.rb
index fdc4b197..e99997eb 100644
--- a/lib/ohai/plugins/linux/virtualization.rb
+++ b/lib/ohai/plugins/linux/virtualization.rb
@@ -19,7 +19,7 @@
Ohai.plugin(:Virtualization) do
provides "virtualization"
depends "dmi"
- require "ohai/mixin/dmi_decode"
+ require_relative "../../mixin/dmi_decode"
include Ohai::Mixin::DmiDecode
def lxc_version_exists?
diff --git a/lib/ohai/plugins/network.rb b/lib/ohai/plugins/network.rb
index 88c72226..9b9811dc 100644
--- a/lib/ohai/plugins/network.rb
+++ b/lib/ohai/plugins/network.rb
@@ -18,7 +18,7 @@
Ohai.plugin(:NetworkAddresses) do
require "ipaddress"
- require "ohai/mixin/network_constants"
+ require_relative "../mixin/network_constants"
include Ohai::Mixin::NetworkConstants
provides "ipaddress", "ip6address", "macaddress"
diff --git a/lib/ohai/plugins/openstack.rb b/lib/ohai/plugins/openstack.rb
index 22d4db57..cd2731da 100644
--- a/lib/ohai/plugins/openstack.rb
+++ b/lib/ohai/plugins/openstack.rb
@@ -17,8 +17,8 @@
# limitations under the License.
Ohai.plugin(:Openstack) do
- require "ohai/mixin/ec2_metadata"
- require "ohai/mixin/http_helper"
+ require_relative "../mixin/ec2_metadata"
+ require_relative "../mixin/http_helper"
include Ohai::Mixin::Ec2Metadata
include Ohai::Mixin::HttpHelper
diff --git a/lib/ohai/plugins/os.rb b/lib/ohai/plugins/os.rb
index 5955f73f..d46e70af 100644
--- a/lib/ohai/plugins/os.rb
+++ b/lib/ohai/plugins/os.rb
@@ -20,7 +20,7 @@
#
Ohai.plugin(:OS) do
- require "ohai/mixin/os"
+ require_relative "../mixin/os"
provides "os", "os_version"
depends "kernel"
diff --git a/lib/ohai/plugins/packages.rb b/lib/ohai/plugins/packages.rb
index f7054a15..56ab252b 100644
--- a/lib/ohai/plugins/packages.rb
+++ b/lib/ohai/plugins/packages.rb
@@ -104,7 +104,7 @@ Ohai.plugin(:Packages) do
end
collect_data(:windows) do
- require "win32/registry"
+ require "win32/registry" unless defined?(Win32::Registry)
packages Mash.new
collect_programs_from_registry_key('Software\Microsoft\Windows\CurrentVersion\Uninstall')
# on 64 bit systems, 32 bit programs are stored here
diff --git a/lib/ohai/plugins/passwd.rb b/lib/ohai/plugins/passwd.rb
index 70a30463..5519adc6 100644
--- a/lib/ohai/plugins/passwd.rb
+++ b/lib/ohai/plugins/passwd.rb
@@ -1,6 +1,6 @@
Ohai.plugin(:Passwd) do
- require "etc"
+ require "etc" unless defined?(Etc)
provides "etc", "current_user"
optional true
diff --git a/lib/ohai/plugins/scaleway.rb b/lib/ohai/plugins/scaleway.rb
index e1cb8a87..2b83acf3 100644
--- a/lib/ohai/plugins/scaleway.rb
+++ b/lib/ohai/plugins/scaleway.rb
@@ -15,8 +15,8 @@
# limitations under the License.
Ohai.plugin(:Scaleway) do
- require "ohai/mixin/scaleway_metadata"
- require "ohai/mixin/http_helper"
+ require_relative "../mixin/scaleway_metadata"
+ require_relative "../mixin/http_helper"
include Ohai::Mixin::ScalewayMetadata
include Ohai::Mixin::HttpHelper
diff --git a/lib/ohai/plugins/scsi.rb b/lib/ohai/plugins/scsi.rb
index 13081867..0dfc80f9 100644
--- a/lib/ohai/plugins/scsi.rb
+++ b/lib/ohai/plugins/scsi.rb
@@ -21,7 +21,7 @@ Ohai.plugin(:Lsscsi) do
provides "scsi"
optional true
- require "mixlib/shellout"
+ require "mixlib/shellout" unless defined?(Mixlib::ShellOut)
collect_data(:linux) do
devices = Mash.new
diff --git a/lib/ohai/plugins/softlayer.rb b/lib/ohai/plugins/softlayer.rb
index 0f025c9c..34b2c343 100644
--- a/lib/ohai/plugins/softlayer.rb
+++ b/lib/ohai/plugins/softlayer.rb
@@ -19,7 +19,7 @@
# limitations under the License.
Ohai.plugin(:Softlayer) do
- require "ohai/mixin/softlayer_metadata"
+ require_relative "../mixin/softlayer_metadata"
include ::Ohai::Mixin::SoftlayerMetadata
provides "softlayer"
diff --git a/lib/ohai/plugins/solaris2/dmi.rb b/lib/ohai/plugins/solaris2/dmi.rb
index 51f5fb05..ecbc6f2d 100644
--- a/lib/ohai/plugins/solaris2/dmi.rb
+++ b/lib/ohai/plugins/solaris2/dmi.rb
@@ -20,7 +20,7 @@ Ohai.plugin(:DMI) do
provides "dmi"
collect_data(:solaris2) do
- require "ohai/common/dmi"
+ require_relative "../../common/dmi"
# if we already have a "dmi" with keys (presumably from dmidecode), don't try smbios
# note that a single key just means dmidecode exited with its version
diff --git a/lib/ohai/plugins/solaris2/virtualization.rb b/lib/ohai/plugins/solaris2/virtualization.rb
index d0187e87..3b3473f4 100644
--- a/lib/ohai/plugins/solaris2/virtualization.rb
+++ b/lib/ohai/plugins/solaris2/virtualization.rb
@@ -19,7 +19,7 @@
#
Ohai.plugin(:Virtualization) do
- require "ohai/mixin/dmi_decode"
+ require_relative "../../mixin/dmi_decode"
include Ohai::Mixin::DmiDecode
provides "virtualization"
depends "dmi"
diff --git a/lib/ohai/plugins/uptime.rb b/lib/ohai/plugins/uptime.rb
index a2294fb3..5883f13c 100644
--- a/lib/ohai/plugins/uptime.rb
+++ b/lib/ohai/plugins/uptime.rb
@@ -25,7 +25,7 @@
#
Ohai.plugin(:Uptime) do
- require "ohai/mixin/seconds_to_human"
+ require_relative "../mixin/seconds_to_human"
provides "uptime", "uptime_seconds"
provides "idletime", "idletime_seconds" # linux only
diff --git a/lib/ohai/plugins/windows/fips.rb b/lib/ohai/plugins/windows/fips.rb
index 085c7f2c..27d36f2d 100644
--- a/lib/ohai/plugins/windows/fips.rb
+++ b/lib/ohai/plugins/windows/fips.rb
@@ -28,7 +28,7 @@ Ohai.plugin(:Fips) do
collect_data(:windows) do
fips Mash.new
- require "openssl"
+ require "openssl" unless defined?(OpenSSL)
if defined?(OpenSSL.fips_mode) && OpenSSL.fips_mode && !$FIPS_TEST_MODE
fips["kernel"] = { "enabled" => true }
else
diff --git a/lib/ohai/plugins/windows/virtualization.rb b/lib/ohai/plugins/windows/virtualization.rb
index b60aff8b..3a4e5532 100644
--- a/lib/ohai/plugins/windows/virtualization.rb
+++ b/lib/ohai/plugins/windows/virtualization.rb
@@ -20,7 +20,7 @@
Ohai.plugin(:Virtualization) do
provides "virtualization"
- require "ohai/mixin/dmi_decode"
+ require_relative "../../mixin/dmi_decode"
include Ohai::Mixin::DmiDecode
collect_data(:windows) do
diff --git a/lib/ohai/provides_map.rb b/lib/ohai/provides_map.rb
index 0aba1939..d803d298 100644
--- a/lib/ohai/provides_map.rb
+++ b/lib/ohai/provides_map.rb
@@ -17,10 +17,10 @@
# limitations under the License.
#
-require "ohai/mash"
-require "ohai/exception"
-require "ohai/mixin/os"
-require "ohai/dsl"
+require_relative "mash"
+require_relative "exception"
+require_relative "mixin/os"
+require_relative "dsl"
module Ohai
class ProvidesMap
diff --git a/lib/ohai/runner.rb b/lib/ohai/runner.rb
index f11d936a..cc776618 100644
--- a/lib/ohai/runner.rb
+++ b/lib/ohai/runner.rb
@@ -17,7 +17,7 @@
# limitations under the License
#
-require "ohai/dsl"
+require_relative "dsl"
require "benchmark"
module Ohai
diff --git a/lib/ohai/system.rb b/lib/ohai/system.rb
index a19e19ca..b075c814 100644
--- a/lib/ohai/system.rb
+++ b/lib/ohai/system.rb
@@ -16,21 +16,21 @@
# limitations under the License.
#
-require "ohai/version"
-require "ohai/loader"
-require "ohai/log"
-require "ohai/mash"
-require "ohai/runner"
-require "ohai/dsl"
-require "ohai/mixin/command"
-require "ohai/mixin/os"
-require "ohai/mixin/string"
-require "ohai/mixin/constant_helper"
-require "ohai/provides_map"
-require "ohai/hints"
-require "mixlib/shellout"
-require "ohai/config"
-require "ffi_yajl"
+require_relative "version"
+require_relative "loader"
+require_relative "log"
+require_relative "mash"
+require_relative "runner"
+require_relative "dsl"
+require_relative "mixin/command"
+require_relative "mixin/os"
+require_relative "mixin/string"
+require_relative "mixin/constant_helper"
+require_relative "provides_map"
+require_relative "hints"
+require "mixlib/shellout" unless defined?(Mixlib::ShellOut)
+require_relative "config"
+require "ffi_yajl" unless defined?(FFI_Yajl)
module Ohai
# The class used by Ohai::Application and Chef to actually collect data
diff --git a/lib/ohai/util/win32.rb b/lib/ohai/util/win32.rb
index 5cf638d0..5d5ab156 100644
--- a/lib/ohai/util/win32.rb
+++ b/lib/ohai/util/win32.rb
@@ -21,7 +21,7 @@ module Ohai
module Win32
if RUBY_PLATFORM =~ /mswin|mingw|windows/
- require "ffi"
+ require "ffi" unless defined?(FFI)
extend FFI::Library