Skip to content

Commit 10704bd

Browse files
committed
fix: handle case where no crn_url / crn_hash found in allocations
1 parent cac3e45 commit 10704bd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/aleph_client/commands/instance/display.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,10 +345,16 @@ def _prepare_allocation_column(self):
345345
color_allocation = "magenta3"
346346
crn_hash = safe_getattr(self.message.content.requirements, "node.node_hash") or ""
347347
else:
348-
crn_url = self.allocation.allocations.node.url
348+
# Handle the case where allocations.node might be None
349+
node = getattr(self.allocation.allocations, "node", None)
350+
if node is not None:
351+
crn_url = node.url
352+
crn_hash = node.node_id
353+
else:
354+
crn_url = "N/A"
355+
crn_hash = "N/A"
349356
allocation_str = ALLOCATION_AUTO
350357
color_allocation = "deep_sky_blue1"
351-
crn_hash = self.allocation.allocations.node.node_id
352358

353359
# Assemble the complete allocation column
354360
self.allocation_column = cast(

0 commit comments

Comments
 (0)