Skip to content

Commit 02b4f12

Browse files
authored
Merge pull request #460 from opsmill/bkr-fix-process_relationships
2 parents 560238a + 8c99a80 commit 02b4f12

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

changelog/461.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixes processing of relationshhip during nodes retrieval using the Sync Client, when prefecthing related_nodes

infrahub_sdk/node/node.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,15 +1493,15 @@ def _process_relationships(
14931493
for rel_name in self._relationships:
14941494
rel = getattr(self, rel_name)
14951495
if rel and isinstance(rel, RelatedNodeSync):
1496-
relation = node_data["node"].get(rel_name)
1497-
if relation.get("node", None):
1496+
relation = node_data["node"].get(rel_name, None)
1497+
if relation and relation.get("node", None):
14981498
related_node = InfrahubNodeSync.from_graphql(
14991499
client=self._client, branch=branch, data=relation, timeout=timeout
15001500
)
15011501
related_nodes.append(related_node)
15021502
elif rel and isinstance(rel, RelationshipManagerSync):
1503-
peers = node_data["node"].get(rel_name)
1504-
if peers:
1503+
peers = node_data["node"].get(rel_name, None)
1504+
if peers and peers["edges"]:
15051505
for peer in peers["edges"]:
15061506
related_node = InfrahubNodeSync.from_graphql(
15071507
client=self._client, branch=branch, data=peer, timeout=timeout

0 commit comments

Comments
 (0)