Make retrieval of port mac column safe
This should not happen in the real world but its safer to check
if a port MAC column is not empty before trying to access it.
Trivial-Fix
Change-Id: Ie3c5151a8f7c6a240a5f3240d4e7fb58ea43e9c1
(cherry picked from commit 51005388b8
)
This commit is contained in:
parent
e52272c699
commit
9dd8ab4b6a
|
@ -416,6 +416,10 @@ class MetadataAgent(object):
|
|||
def _get_port_ips(self, port):
|
||||
# Retrieve IPs from the port mac column which is in form
|
||||
# ["<port_mac> <ip1> <ip2> ... <ipN>"]
|
||||
if not port.mac:
|
||||
LOG.warning("Port %s MAC column is empty, cannot retrieve IP "
|
||||
"addresses", port.uuid)
|
||||
return []
|
||||
mac_field_attrs = port.mac[0].split()
|
||||
ips = mac_field_attrs[1:]
|
||||
if not ips:
|
||||
|
|
Loading…
Reference in New Issue