summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-11-17 21:58:47 -0800
committerTim Smith <tsmith84@gmail.com>2020-11-18 11:02:49 -0800
commitafe75fd0094204636f6acac8a1ba71e43ffa96ff (patch)
treebc83bb965e4b801f849ecfe9bd702faa885f4f4d
parent0836d8779c35459505711f82f9daa40ac962f4d3 (diff)
downloadohai-afe75fd0094204636f6acac8a1ba71e43ffa96ff.tar.gz
Avoid setting the addresses mash twice
Just do it at the top of things Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/ohai/plugins/aix/network.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/ohai/plugins/aix/network.rb b/lib/ohai/plugins/aix/network.rb
index 1e28e414..214bfa30 100644
--- a/lib/ohai/plugins/aix/network.rb
+++ b/lib/ohai/plugins/aix/network.rb
@@ -61,6 +61,7 @@ Ohai.plugin(:Network) do
int_name, int_data = int_lines.split(":", 2)
ifaces[int_name] = Mash.new
+ ifaces[int_name][:addresses] ||= Mash.new
ifaces[int_name][:state] = (int_data.include?("<UP,") ? "up" : "down")
int_data.each_line do |lin|
@@ -82,7 +83,6 @@ Ohai.plugin(:Network) do
netmask = IPAddr.new("255.255.255.255").mask(tmp_prefix.to_i).to_s
end
- ifaces[int_name][:addresses] ||= Mash.new
ifaces[int_name][:addresses][tmp_addr] = { "family" => "inet", "prefixlen" => tmp_prefix }
ifaces[int_name][:addresses][tmp_addr][:netmask] = netmask
@@ -107,7 +107,6 @@ Ohai.plugin(:Network) do
# Query macaddress
e_so = shell_out("entstat -d #{int_name} | grep \"Hardware Address\"")
- ifaces[int_name][:addresses] ||= Mash.new
e_so.stdout.each_line do |l|
if l =~ /Hardware Address: (\S+)/
ifaces[int_name][:addresses][$1.upcase] = { "family" => "lladdr" }