Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: 2.7
TargetRubyVersion: 3.1
Exclude:
- "spec/data/**/*"
- "vendor/**/*"
Expand Down
5 changes: 3 additions & 2 deletions lib/ohai/loader.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
#
# Author:: Claire McQuin (<claire@chef.io>)
# Copyright:: Copyright (c) Chef Software Inc.
Expand Down Expand Up @@ -97,10 +98,10 @@ def load_plugin(plugin_path)
# @return [Object] class object for the ohai plugin defined in the file
def load_plugin_class(plugin_path)
# Read the contents of the plugin to understand if it's a V6 or V7 plugin.
contents = ""
contents = nil
begin
logger.trace("Loading plugin at #{plugin_path}")
contents << File.read(plugin_path)
contents = File.read(plugin_path)
rescue IOError, Errno::ENOENT
logger.warn("Unable to open or read plugin at #{plugin_path}")
return nil
Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/eucalyptus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
provides "eucalyptus"
depends "network/interfaces"

MAC_MATCH = /^[dD]0:0[dD]:/.freeze unless defined?(MAC_MATCH)
MAC_MATCH = /^[dD]0:0[dD]:/ unless defined?(MAC_MATCH)

# returns the mac address from the collection of all address types
def get_mac_address(addresses)
Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/linux/network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ def favored_default_route_linux(routes, iface, default_route, family)
# Match the lead line for an interface from iproute2
# 3: eth0.11@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
# The '@eth0:' portion doesn't exist on primary interfaces and thus is optional in the regex
IPROUTE_INT_REGEX ||= /^(\d+): ([0-9a-zA-Z@:;\.\-_]*?)(@[0-9a-zA-Z\-_]+|):\s/.freeze
IPROUTE_INT_REGEX ||= /^(\d+): ([0-9a-zA-Z@:;\.\-_]*?)(@[0-9a-zA-Z\-_]+|):\s/

if which("ip")
# families to get default routes from
Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/rpm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
provides "rpm"
optional "true"

MACROS_MARKER = /========================/.freeze unless defined?(MACROS_MARKER)
MACROS_MARKER = /========================/ unless defined?(MACROS_MARKER)

unless defined?(DO_NOT_SPLIT)
DO_NOT_SPLIT = %w{
Expand Down
2 changes: 1 addition & 1 deletion lib/ohai/plugins/windows/dmi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#
# This cannot handle some property names, eg SMBIOSBIOSVersion.
# https://rubular.com/r/FBNtXod4wkZGAG
SPLIT_REGEX ||= /[A-Z][a-z0-9]+|[A-Z]{2,}(?=[A-Z][a-z0-9])|[A-Z]{2,}/.freeze
SPLIT_REGEX ||= /[A-Z][a-z0-9]+|[A-Z]{2,}(?=[A-Z][a-z0-9])|[A-Z]{2,}/

WINDOWS_TO_UNIX_KEYS ||= [
%w{vendor manufacturer},
Expand Down
2 changes: 1 addition & 1 deletion spec/functional/plugins/powershell_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
require "spec_helper"

describe Ohai::System, "languages plugin" do
VERSION_MATCHING_REGEX = /^(?:\d+\.)+\d+$/.freeze
VERSION_MATCHING_REGEX = /^(?:\d+\.)+\d+$/
describe "powershell plugin", :windows_only do
RSpec.shared_examples "a version looking thing" do
it "is present" do
Expand Down