diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-06-11 14:41:09 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-06-11 14:41:09 -0700 |
commit | 874d84b5d841af98da47fc7c28dcdf9610446bfb (patch) | |
tree | a01b7563e3e469d9566fecf01105397ceeeefa15 /lib/ohai/plugins/solaris2 | |
parent | c01c03fba0834bcebb7f90c9c27dd720ab8b4a58 (diff) | |
download | ohai-874d84b5d841af98da47fc7c28dcdf9610446bfb.tar.gz |
Optimize our regexes and data searching a bitoptimizations
RuboCop Performance has gotten significantly better in the last few years. The cop that updates =~ to .match? is now smart enough to make sure you're not using the data later. With this fix 61 places we did more expensive regexes or uses select followed by .first have been fixed.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/ohai/plugins/solaris2')
-rw-r--r-- | lib/ohai/plugins/solaris2/virtualization.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ohai/plugins/solaris2/virtualization.rb b/lib/ohai/plugins/solaris2/virtualization.rb index 3b3473f4..3b85ea9d 100644 --- a/lib/ohai/plugins/solaris2/virtualization.rb +++ b/lib/ohai/plugins/solaris2/virtualization.rb @@ -38,7 +38,7 @@ Ohai.plugin(:Virtualization) do psrinfo_path = Ohai.abs_path( "/usr/sbin/psrinfo" ) if File.exist?(psrinfo_path) so = shell_out("#{psrinfo_path} -pv") - if so.stdout =~ /QEMU Virtual CPU|Common KVM processor|Common 32-bit KVM processor/ + if /QEMU Virtual CPU|Common KVM processor|Common 32-bit KVM processor/.match?(so.stdout) virtualization[:system] = "kvm" virtualization[:role] = "guest" virtualization[:systems][:kvm] = "guest" |