Skip downed interfaces in master_ip_and_mac method

In case we have any interface down (like generic bond0 interface),
we fail with 'undefined method each for nil:NilClass' error in the
middle of _master_ip_and_mac method. And it can happen before we
find needed info thus failing to update Nailgun.

So we just need to skip interfaces that do not have 'addresses'
key.

Change-Id: Ieb1de216931fa9334f07bd21f1a4096bf429afb0
Closes-bug: #1429807
This commit is contained in:
Aleksandr Didenko 2015-03-13 18:46:04 +02:00
parent df1f6be182
commit 581d8b03b0
1 changed files with 1 additions and 0 deletions

View File

@ -457,6 +457,7 @@ class NodeAgent
def _master_ip_and_mac
@os[:network][:interfaces].each do |_, intinfo|
next unless intinfo.has_key?(:addresses)
intinfo[:addresses].each do |k, v|
# Here we need to check family because IPAddr.new with bad
# data works very slow on some environments