summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-08-09 19:42:09 -0700
committerTim Smith <tsmith84@gmail.com>2020-08-09 19:42:09 -0700
commitea252f4bb5138db70e1f2a3d42a0e323a2b1b270 (patch)
treeca47b4b555a140bc321eef40a5c9406d6e82612c
parente16263f08a26e736ed05afa6049c1a49f864da2f (diff)
downloadohai-ea252f4bb5138db70e1f2a3d42a0e323a2b1b270.tar.gz
Avoid creating shellout objects in the platform plugins
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/ohai/plugins/dragonflybsd/platform.rb6
-rw-r--r--lib/ohai/plugins/freebsd/platform.rb6
-rw-r--r--lib/ohai/plugins/netbsd/platform.rb6
-rw-r--r--lib/ohai/plugins/openbsd/platform.rb6
-rw-r--r--lib/ohai/plugins/solaris2/platform.rb3
5 files changed, 9 insertions, 18 deletions
diff --git a/lib/ohai/plugins/dragonflybsd/platform.rb b/lib/ohai/plugins/dragonflybsd/platform.rb
index 169488e2..ca80f7f7 100644
--- a/lib/ohai/plugins/dragonflybsd/platform.rb
+++ b/lib/ohai/plugins/dragonflybsd/platform.rb
@@ -20,10 +20,8 @@ Ohai.plugin(:Platform) do
provides "platform", "platform_version", "platform_family"
collect_data(:dragonflybsd) do
- so = shell_out("uname -s")
- platform so.stdout.split($/)[0].downcase
- so = shell_out("uname -r")
- platform_version so.stdout.split($/)[0]
+ platform shell_out("uname -s").stdout.split($/)[0].downcase
+ platform_version shell_out("uname -r").stdout.split($/)[0]
platform_family "dragonflybsd"
end
end
diff --git a/lib/ohai/plugins/freebsd/platform.rb b/lib/ohai/plugins/freebsd/platform.rb
index bef7b73e..957f0a30 100644
--- a/lib/ohai/plugins/freebsd/platform.rb
+++ b/lib/ohai/plugins/freebsd/platform.rb
@@ -20,10 +20,8 @@ Ohai.plugin(:Platform) do
provides "platform", "platform_version", "platform_family"
collect_data(:freebsd) do
- so = shell_out("uname -s")
- platform so.stdout.split($/)[0].downcase
- so = shell_out("uname -r")
- platform_version so.stdout.split($/)[0]
+ platform shell_out("uname -s").stdout.split($/)[0].downcase
+ platform_version shell_out("uname -r").stdout.split($/)[0]
platform_family "freebsd"
end
end
diff --git a/lib/ohai/plugins/netbsd/platform.rb b/lib/ohai/plugins/netbsd/platform.rb
index 9293787b..81f4f660 100644
--- a/lib/ohai/plugins/netbsd/platform.rb
+++ b/lib/ohai/plugins/netbsd/platform.rb
@@ -20,10 +20,8 @@ Ohai.plugin(:Platform) do
provides "platform", "platform_version", "platform_family"
collect_data(:netbsd) do
- so = shell_out("uname -s")
- platform so.stdout.split($/)[0].downcase
- so = shell_out("uname -r")
- platform_version so.stdout.split($/)[0]
+ platform shell_out("uname -s").stdout.split($/)[0].downcase
+ platform_version shell_out("uname -r").stdout.split($/)[0]
platform_family "netbsd"
end
end
diff --git a/lib/ohai/plugins/openbsd/platform.rb b/lib/ohai/plugins/openbsd/platform.rb
index a99cf7a5..3d43e57e 100644
--- a/lib/ohai/plugins/openbsd/platform.rb
+++ b/lib/ohai/plugins/openbsd/platform.rb
@@ -20,10 +20,8 @@ Ohai.plugin(:Platform) do
provides "platform", "platform_version", "platform_family"
collect_data(:openbsd) do
- so = shell_out("uname -s")
- platform so.stdout.split($/)[0].downcase
- so = shell_out("uname -r")
- platform_version so.stdout.split($/)[0]
+ platform shell_out("uname -s").stdout.split($/)[0].downcase
+ platform_version shell_out("uname -r").stdout.split($/)[0]
platform_family "openbsd"
end
end
diff --git a/lib/ohai/plugins/solaris2/platform.rb b/lib/ohai/plugins/solaris2/platform.rb
index 90cd0338..23ede135 100644
--- a/lib/ohai/plugins/solaris2/platform.rb
+++ b/lib/ohai/plugins/solaris2/platform.rb
@@ -26,8 +26,7 @@ Ohai.plugin(:Platform) do
uname_exec = "uname"
end
- so = shell_out("#{uname_exec} -X")
- so.stdout.lines do |line|
+ shell_out("#{uname_exec} -X").stdout.lines do |line|
case line
when /^Release =\s+(.+)$/
platform_version $1