diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-11-18 12:35:42 -0800 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-11-18 12:35:42 -0800 |
commit | c8fc5004072d9eaec0801af4707b4d5487402d95 (patch) | |
tree | 27cf95e560ee7a28d98675260326d6dc4c4587f5 /lib | |
parent | 2804463e5e1b81911bc27aa4e132f888a202ff9a (diff) | |
download | ohai-c8fc5004072d9eaec0801af4707b4d5487402d95.tar.gz |
Avoid calling uname 4 times on aix
Just get all the data we need and then split it.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ohai/plugins/aix/kernel.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/ohai/plugins/aix/kernel.rb b/lib/ohai/plugins/aix/kernel.rb index 3d8178c8..a6d1cfee 100644 --- a/lib/ohai/plugins/aix/kernel.rb +++ b/lib/ohai/plugins/aix/kernel.rb @@ -24,10 +24,12 @@ Ohai.plugin(:Kernel) do collect_data(:aix) do kernel Mash.new - kernel[:name] = shell_out("uname -s").stdout.split($/)[0].downcase - kernel[:release] = shell_out("uname -r").stdout.split($/)[0] - kernel[:version] = shell_out("uname -v").stdout.split($/)[0] - kernel[:machine] = shell_out("uname -p").stdout.split($/)[0] + uname_so = shell_out("uname -srvp").stdout.split + + kernel[:name] = uname_so[0].downcase + kernel[:release] = uname_so[1] + kernel[:version] = uname_so[2] + kernel[:machine] = uname_so[3] kernel[:bits] = shell_out("getconf KERNEL_BITMODE").stdout.strip modules = Mash.new |