summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2023-02-20 19:04:16 +0530
committerGitHub <noreply@github.com>2023-02-20 19:04:16 +0530
commitc9196d809d4429c7cea90731446039090da33730 (patch)
treeedd4da7759ddfffba7be64cccfbff88ffb4b21a9
parent540555c0543f20b65f7416a7bc245d582534613a (diff)
downloadohai-c9196d809d4429c7cea90731446039090da33730.tar.gz
Update rubocop-performance requirement from 1.15.2 to 1.16.0 (#1784)
* Update rubocop-performance requirement from 1.15.2 to 1.16.0 Updates the requirements on [rubocop-performance](https://github.com/rubocop/rubocop-performance) to permit the latest version. - [Release notes](https://github.com/rubocop/rubocop-performance/releases) - [Changelog](https://github.com/rubocop/rubocop-performance/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-performance/compare/v1.15.2...v1.16.0) --- updated-dependencies: - dependency-name: rubocop-performance dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> * Fix chefstyle linting errors Signed-off-by: Neha Pansare <neha.pansare@progress.com> * Fix unit test failures due to changing match with include? to fix chefstye error. This happens because method file_val_if_exists returns string only when file is found, else it returns nil Signed-off-by: Neha Pansare <neha.pansare@progress.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Neha Pansare <neha.pansare@progress.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Neha Pansare <neha.pansare@progress.com>
-rw-r--r--Gemfile2
-rw-r--r--lib/ohai/mixin/dmi_decode.rb2
-rw-r--r--lib/ohai/plugins/alibaba.rb2
-rw-r--r--lib/ohai/plugins/azure.rb2
-rw-r--r--lib/ohai/plugins/cpu.rb2
-rw-r--r--lib/ohai/plugins/darwin/virtualization.rb2
-rw-r--r--lib/ohai/plugins/ec2.rb4
-rw-r--r--lib/ohai/plugins/gce.rb2
-rw-r--r--lib/ohai/plugins/linux/network.rb10
-rw-r--r--lib/ohai/plugins/linux/platform.rb2
-rw-r--r--lib/ohai/plugins/linux/virtualization.rb8
-rw-r--r--lib/ohai/plugins/scaleway.rb2
-rw-r--r--lib/ohai/plugins/vmware.rb2
13 files changed, 21 insertions, 21 deletions
diff --git a/Gemfile b/Gemfile
index b83d5b69..9ee1cf4b 100644
--- a/Gemfile
+++ b/Gemfile
@@ -16,7 +16,7 @@ group :development do
gem "rspec-core", "~> 3.0"
gem "rspec-expectations", "~> 3.0"
gem "rspec-mocks", "~> 3.0"
- gem "rubocop-performance", "1.15.2"
+ gem "rubocop-performance", "1.16.0"
gem "rubocop-rspec"
end
diff --git a/lib/ohai/mixin/dmi_decode.rb b/lib/ohai/mixin/dmi_decode.rb
index 354e337d..7c7af05c 100644
--- a/lib/ohai/mixin/dmi_decode.rb
+++ b/lib/ohai/mixin/dmi_decode.rb
@@ -27,7 +27,7 @@ module ::Ohai::Mixin::DmiDecode
when /VMware/
return "vmware"
when /Microsoft/
- return "hyperv" if /Virtual Machine/.match?(product)
+ return "hyperv" if product.include?("Virtual Machine")
when /Amazon EC2/
return "amazonec2"
when /QEMU/
diff --git a/lib/ohai/plugins/alibaba.rb b/lib/ohai/plugins/alibaba.rb
index ac3c8088..dcc04038 100644
--- a/lib/ohai/plugins/alibaba.rb
+++ b/lib/ohai/plugins/alibaba.rb
@@ -33,7 +33,7 @@ Ohai.plugin(:Alibaba) do
# this works even if the system lacks dmidecode use by the Dmi plugin
# @return [Boolean] do we have Alibaba DMI data?
def has_ali_dmi?
- if /Alibaba/.match?(file_val_if_exists("/sys/class/dmi/id/sys_vendor"))
+ if file_val_if_exists("/sys/class/dmi/id/sys_vendor").to_s.include?("Alibaba")
logger.trace("Plugin Alibaba: has_ali_dmi? == true")
true
else
diff --git a/lib/ohai/plugins/azure.rb b/lib/ohai/plugins/azure.rb
index 008a9a21..e3c003c7 100644
--- a/lib/ohai/plugins/azure.rb
+++ b/lib/ohai/plugins/azure.rb
@@ -58,7 +58,7 @@ Ohai.plugin(:Azure) do
has_245 = false
if file_exist?("/var/lib/dhcp/dhclient.eth0.leases")
file_open("/var/lib/dhcp/dhclient.eth0.leases").each do |line|
- if /unknown-245/.match?(line)
+ if line.include?("unknown-245")
logger.trace("Plugin Azure: Found unknown-245 DHCP option used by Azure.")
has_245 = true
break
diff --git a/lib/ohai/plugins/cpu.rb b/lib/ohai/plugins/cpu.rb
index 897f716b..510c2018 100644
--- a/lib/ohai/plugins/cpu.rb
+++ b/lib/ohai/plugins/cpu.rb
@@ -524,7 +524,7 @@ Ohai.plugin(:CPU) do
cpu[index] = Mash.new
cpu[index][:status] = status
cpu[index][:location] = location
- if /Available/.match?(status)
+ if status.include?("Available")
cpu[:available] += 1
lsattr = shell_out("lsattr -El #{name}").stdout.lines
lsattr.each do |attribute|
diff --git a/lib/ohai/plugins/darwin/virtualization.rb b/lib/ohai/plugins/darwin/virtualization.rb
index 4ccdc19d..c6a83d5d 100644
--- a/lib/ohai/plugins/darwin/virtualization.rb
+++ b/lib/ohai/plugins/darwin/virtualization.rb
@@ -77,7 +77,7 @@ Ohai.plugin(:Virtualization) do
virtualization[:systems][:vmware] = "guest"
end
- if ioreg_exists? && /pci1ab8,4000/.match?(shell_out("ioreg -l").stdout)
+ if ioreg_exists? && shell_out("ioreg -l").stdout.include?("pci1ab8,4000")
virtualization[:system] = "parallels"
virtualization[:role] = "guest"
virtualization[:systems][:parallels] = "guest"
diff --git a/lib/ohai/plugins/ec2.rb b/lib/ohai/plugins/ec2.rb
index e1855434..21e5ac7a 100644
--- a/lib/ohai/plugins/ec2.rb
+++ b/lib/ohai/plugins/ec2.rb
@@ -39,7 +39,7 @@ Ohai.plugin(:EC2) do
# @return [Boolean] do we have Amazon DMI data?
def has_ec2_amazon_dmi?
# detect a version of '4.2.amazon'
- if /Amazon/.match?(file_val_if_exists("/sys/class/dmi/id/bios_vendor"))
+ if file_val_if_exists("/sys/class/dmi/id/bios_vendor").to_s.include?("Amazon")
logger.trace("Plugin EC2: has_ec2_amazon_dmi? == true")
true
else
@@ -54,7 +54,7 @@ Ohai.plugin(:EC2) do
# @return [Boolean] do we have Amazon DMI data?
def has_ec2_xen_dmi?
# detect a version of '4.2.amazon'
- if /amazon/.match?(file_val_if_exists("/sys/class/dmi/id/bios_version"))
+ if file_val_if_exists("/sys/class/dmi/id/bios_version").to_s.include?("amazon")
logger.trace("Plugin EC2: has_ec2_xen_dmi? == true")
true
else
diff --git a/lib/ohai/plugins/gce.rb b/lib/ohai/plugins/gce.rb
index fdfce390..877e6a4a 100644
--- a/lib/ohai/plugins/gce.rb
+++ b/lib/ohai/plugins/gce.rb
@@ -28,7 +28,7 @@ Ohai.plugin(:GCE) do
# this works even if the system lacks dmidecode use by the Dmi plugin
# @return [Boolean] do we have Google Compute Engine DMI data?
def has_gce_dmi?
- if /Google Compute Engine/.match?(file_val_if_exists("/sys/class/dmi/id/product_name"))
+ if file_val_if_exists("/sys/class/dmi/id/product_name").to_s.include?("Google Compute Engine")
logger.trace("Plugin GCE: has_gce_dmi? == true")
true
else
diff --git a/lib/ohai/plugins/linux/network.rb b/lib/ohai/plugins/linux/network.rb
index eb83843c..1f99120d 100644
--- a/lib/ohai/plugins/linux/network.rb
+++ b/lib/ohai/plugins/linux/network.rb
@@ -79,7 +79,7 @@ Ohai.plugin(:Network) do
so.stdout.lines do |line|
line.strip!
logger.trace("Plugin Network: Parsing #{line}")
- if /\\/.match?(line)
+ if line.include?("\\")
# If we have multipath routing, then the first part will be a normal
# looking route:
# default proto ra metric 1024 <other options>
@@ -218,11 +218,11 @@ Ohai.plugin(:Network) do
next if line.start_with?("Ring parameters for")
next if line.strip.nil?
- if /Pre-set maximums/.match?(line)
+ if line.include?("Pre-set maximums")
type = "max"
next
end
- if /Current hardware settings/.match?(line)
+ if line.include?("Current hardware settings")
type = "current"
next
end
@@ -251,11 +251,11 @@ Ohai.plugin(:Network) do
next if line.start_with?("Channel parameters for")
next if line.strip.nil?
- if /Pre-set maximums/.match?(line)
+ if line.include?("Pre-set maximums")
type = "max"
next
end
- if /Current hardware settings/.match?(line)
+ if line.include?("Current hardware settings")
type = "current"
next
end
diff --git a/lib/ohai/plugins/linux/platform.rb b/lib/ohai/plugins/linux/platform.rb
index 492c61ee..d661062a 100644
--- a/lib/ohai/plugins/linux/platform.rb
+++ b/lib/ohai/plugins/linux/platform.rb
@@ -258,7 +258,7 @@ Ohai.plugin(:Platform) do
platform_version shell_out("/bin/uname -r").stdout.strip
elsif file_exist?("/usr/lib/os-release")
contents = file_read("/usr/lib/os-release")
- if /clear-linux-os/.match?(contents) # Clear Linux https://clearlinux.org/
+ if contents.include?("clear-linux-os") # Clear Linux https://clearlinux.org/
platform "clearlinux"
platform_version contents[/VERSION_ID=(\d+)/, 1]
end
diff --git a/lib/ohai/plugins/linux/virtualization.rb b/lib/ohai/plugins/linux/virtualization.rb
index 0a9edac4..098a96f1 100644
--- a/lib/ohai/plugins/linux/virtualization.rb
+++ b/lib/ohai/plugins/linux/virtualization.rb
@@ -118,7 +118,7 @@ Ohai.plugin(:Virtualization) do
# guests will have the hypervisor cpu feature that hosts don't have
if file_exist?("/sys/devices/virtual/misc/kvm")
virtualization[:system] = "kvm"
- if /hypervisor/.match?(file_read("/proc/cpuinfo"))
+ if file_read("/proc/cpuinfo").include?("hypervisor")
logger.trace("Plugin Virtualization: /sys/devices/virtual/misc/kvm present and /proc/cpuinfo lists the hypervisor feature. Detecting as kvm guest")
virtualization[:role] = "guest"
virtualization[:systems][:kvm] = "guest"
@@ -220,17 +220,17 @@ Ohai.plugin(:Virtualization) do
virtualization[:system] = $1
virtualization[:role] = "guest"
virtualization[:systems][$1.to_sym] = "guest"
- elsif /container=lxc/.match?(file_read("/proc/1/environ"))
+ elsif file_read("/proc/1/environ").include?("container=lxc")
logger.trace("Plugin Virtualization: /proc/1/environ indicates lxc container. Detecting as lxc guest")
virtualization[:system] = "lxc"
virtualization[:role] = "guest"
virtualization[:systems][:lxc] = "guest"
- elsif /container=systemd-nspawn/.match?(file_read("/proc/1/environ"))
+ elsif file_read("/proc/1/environ").include?("container=systemd-nspawn")
logger.trace("Plugin Virtualization: /proc/1/environ indicates nspawn container. Detecting as nspawn guest")
virtualization[:system] = "nspawn"
virtualization[:role] = "guest"
virtualization[:systems][:nspawn] = "guest"
- elsif /container=podman/.match?(file_read("/proc/1/environ"))
+ elsif file_read("/proc/1/environ").include?("container=podman")
logger.trace("Plugin Virtualization: /proc/1/environ indicates podman container. Detecting as podman guest")
virtualization[:system] = "podman"
virtualization[:role] = "guest"
diff --git a/lib/ohai/plugins/scaleway.rb b/lib/ohai/plugins/scaleway.rb
index 4847bb27..63293265 100644
--- a/lib/ohai/plugins/scaleway.rb
+++ b/lib/ohai/plugins/scaleway.rb
@@ -27,7 +27,7 @@ Ohai.plugin(:Scaleway) do
# looks for `scaleway` keyword in kernel command line
# @return [Boolean] do we have the keyword or not?
def has_scaleway_cmdline?
- if file_exist?("/proc/cmdline") && /scaleway/.match?(file_read("/proc/cmdline"))
+ if file_exist?("/proc/cmdline") && file_read("/proc/cmdline").include?("scaleway")
logger.trace("Plugin Scaleway: has_scaleway_cmdline? == true")
return true
end
diff --git a/lib/ohai/plugins/vmware.rb b/lib/ohai/plugins/vmware.rb
index 438efb41..a6527b49 100644
--- a/lib/ohai/plugins/vmware.rb
+++ b/lib/ohai/plugins/vmware.rb
@@ -68,7 +68,7 @@ Ohai.plugin(:VMware) do
# * confirmed that this is broken on Windows Server 2022
vmware[param] = vmware[param].force_encoding(Encoding::IBM437).encode("UTF-8")
end
- if /UpdateInfo failed/.match?(vmware[param])
+ if vmware[param].include?("UpdateInfo failed")
vmware[param] = nil
end
end