Skip to content

Commit

Permalink
Call node.compute_id as little as possible.
Browse files Browse the repository at this point in the history
Submitted by:	sgherdao
  • Loading branch information
jclarke-csco committed Oct 30, 2023
1 parent 1156056 commit 2d39012
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions virl/cli/views/nodes/node_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ def node_list_table(nodes, computes):
tr.append(node.id)
tr.append(node.label)
tr.append(node.node_definition)
if len(computes.keys()) > 0 and hasattr(node, "compute_id") and node.compute_id in computes:
tr.append(computes[node.compute_id]["hostname"])
try:
node_compute_id = node.compute_id
except AttributeError:
node_compute_id = None

if node_compute_id and node_compute_id in computes:
tr.append(computes[node_compute_id]["hostname"])
elif len(computes.keys()) > 0:
tr.append("Unknown")

Expand Down

0 comments on commit 2d39012

Please sign in to comment.