Merge "Add exception handler for node attributes"

This commit is contained in:
Zuul 2022-01-26 03:47:44 +00:00 committed by Gerrit Code Review
commit 8b0e02058f
1 changed files with 7 additions and 0 deletions

View File

@ -466,6 +466,13 @@ def _get_node_id(node, handler, node_map):
for port in node.get('ports', []):
try:
candidates.add(node_map['mac'][port['address'].lower()])
except AttributeError as e:
raise SystemExit(
"Node data has an unexpected value for the mac or port"
" address, or is missing. If the mac and port address"
" is defined, make sure it is approriately quoted."
" Error {} -- node {}".format(str(e), node)
)
except KeyError:
pass