def load_plugin_class(plugin_path)
      # Read the contents of the plugin to understand if it's a V6 or V7 plugin.
      contents = ""
      begin
        logger.trace("Loading plugin at #{plugin_path}")
        contents << IO.read(plugin_path)
      rescue IOError, Errno::ENOENT
        logger.warn("Unable to open or read plugin at #{plugin_path}")
        return nil
      end

      # We assume that a plugin is a V7 plugin if it contains Ohai.plugin in its contents.
      if contents.include?("Ohai.plugin")
        load_v7_plugin_class(contents, plugin_path)
      else
        raise Exceptions::IllegalPluginDefinition, "[DEPRECATION] Plugin at #{plugin_path}"\
        " is a version 6 plugin. Version 6 plugins are no longer supported by Ohai. This"\
        " plugin will need to be updated to the v7 Ohai plugin format. See"\
        " https://docs.chef.io/ohai_custom.html for v7 syntax."
      end
    end
def load_plugin_class(plugin_path)
      # Read the contents of the plugin to understand if it's a V6 or V7 plugin.
      contents = ""
      begin
        logger.trace("Loading plugin at #{plugin_path}")
        contents << IO.read(plugin_path)
      rescue IOError, Errno::ENOENT
        logger.warn("Unable to open or read plugin at #{plugin_path}")
        return nil
      end

      # We assume that a plugin is a V7 plugin if it contains Ohai.plugin in its contents.
      if contents.include?("Ohai.plugin")
        load_v7_plugin_class(contents, plugin_path)
      else
        raise Exceptions::IllegalPluginDefinition, "[DEPRECATION] Plugin at #{plugin_path}"\
        " is a version 6 plugin. Version 6 plugins are no longer supported by Ohai. This"\
        " plugin will need to be updated to the v7 Ohai plugin format. See"\
        " https://docs.chef.io/ohai_custom.html for v7 syntax."
      end
    end
load an ohai plugin object class from file
 @param plugin_path String the path to the ohai plugin

 @return [Object] class object for the ohai plugin defined in the file