Add check if there is no default gateway

Do not try to return the default gateway data
if there is no default gateway.

Change-Id: I68b62b12cce2730ece968cede98b8f1597281fc5
Closes-Bug: 1655595
(cherry picked from commit 5ea2e3cc75)
This commit is contained in:
Dmitry Ilyin 2017-01-11 16:43:29 +03:00 committed by Vladimir Sharshov
parent c14c0b208b
commit 26a7eb39a5
1 changed files with 5 additions and 3 deletions

8
agent
View File

@ -332,9 +332,11 @@ class NodeAgent
iface = $2
end
result = _get_all_interfaces_info
result[:default_gateway] = gw
result[:default_interface] = iface
result[:mac] = @facter["macaddress_#{iface.gsub('-', '_')}"].upcase
if gw and iface
result[:default_gateway] = gw
result[:default_interface] = iface
result[:mac] = @facter["macaddress_#{iface.gsub('-', '_')}"].upcase
end
result
end