summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-11-18 10:29:31 -0800
committerTim Smith <tsmith84@gmail.com>2020-11-18 11:02:49 -0800
commitca702029c6e17ac02d1b5397f249027ccabf8cdc (patch)
tree4dcae72eca91fba6665c662d5c645e2308b2b87d
parentd0c43892da6035d635fb649a77901f7e48a5e535 (diff)
downloadohai-ca702029c6e17ac02d1b5397f249027ccabf8cdc.tar.gz
Collapse down some shellout uses to avoid setting variables
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/ohai/plugins/aix/network.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/ohai/plugins/aix/network.rb b/lib/ohai/plugins/aix/network.rb
index b4f50b58..90b516a0 100644
--- a/lib/ohai/plugins/aix/network.rb
+++ b/lib/ohai/plugins/aix/network.rb
@@ -117,8 +117,7 @@ Ohai.plugin(:Network) do
# Query routes information
%w{inet inet6}.each do |family|
- so_n = shell_out("netstat -nrf #{family}")
- so_n.stdout.each_line do |line|
+ shell_out("netstat -nrf #{family}").stdout.each_line do |line|
if line =~ /(\S+)\s+(\S+)\s+(\S+)\s+(\d+)\s+(\d+)\s+(\S+)/
interface = $6
ifaces[interface][:routes] ||= []
@@ -129,9 +128,8 @@ Ohai.plugin(:Network) do
end
# List the arp entries in system.
- so = shell_out("arp -an")
count = 0
- so.stdout.each_line do |line|
+ shell_out("arp -an").stdout.each_line do |line|
network[:arp] ||= Mash.new
if line =~ /\s*(\S+) \((\S+)\) at ([a-fA-F0-9\:]+) \[(\w+)\] stored in bucket/
network[:arp][count] ||= Mash.new