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-17 21:58:47 -0800
commit5926d771d3f695c19e2392516bb793e276638fb9 (patch)
tree795346afadc4d613d54ef9976c9ac9a45699a1e2
parentd4a9eef9b3e7eb2037bbb4ea6269d31b4cf6ef20 (diff)
downloadohai-more_aix.tar.gz
Avoid setting the addresses mash twicemore_aix
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" }