summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCooper Lees <me@cooperlees.com>2020-07-01 17:14:40 -0700
committerCooper Lees <me@cooperlees.com>2020-07-01 17:15:15 -0700
commit5f06da1d49d99f0d727ea07c7c24c2c376f83d26 (patch)
tree373a31b8a132ced5fcfa01bf55ffa0cd4eb017e6
parent227fb354152aeade1e13b90573b6c8c55f65b8ca (diff)
downloadohai-5f06da1d49d99f0d727ea07c7c24c2c376f83d26.tar.gz
Be more Rubonic and please the linter
Signed-off-by: Cooper Lees <me@cooperlees.com>
-rw-r--r--lib/ohai/plugins/network.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/ohai/plugins/network.rb b/lib/ohai/plugins/network.rb
index 1b838047..04e799b0 100644
--- a/lib/ohai/plugins/network.rb
+++ b/lib/ohai/plugins/network.rb
@@ -27,11 +27,9 @@ Ohai.plugin(:NetworkAddresses) do
# Try to u32 an IPv4 and fallback to u128 if it fails before throwing
def int_an_ip(ipaddress)
- begin
- return ipaddress.to_u32
- rescue NoMethodError
- return ipaddress.to_u128
- end
+ ipaddress.to_u32
+ rescue NoMethodError
+ ipaddress.to_u128
end
# from interface data create array of hashes with ipaddress, scope, and iface
@@ -63,7 +61,7 @@ Ohai.plugin(:NetworkAddresses) do
ipaddresses.sort_by do |v|
[ ( scope_prio.index(v[:scope]) || 999999 ),
128 - v[:ipaddress].prefix.to_i,
- int_an_ip(v[:ipaddress])
+ int_an_ip(v[:ipaddress]),
]
end
end