Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/461.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes processing of relationshhip during nodes retrieval using the Sync Client, when prefecthing related_nodes
8 changes: 4 additions & 4 deletions infrahub_sdk/node/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -1493,15 +1493,15 @@
for rel_name in self._relationships:
rel = getattr(self, rel_name)
if rel and isinstance(rel, RelatedNodeSync):
relation = node_data["node"].get(rel_name)
if relation.get("node", None):
relation = node_data["node"].get(rel_name, None)

Check warning on line 1496 in infrahub_sdk/node/node.py

View check run for this annotation

Codecov / codecov/patch

infrahub_sdk/node/node.py#L1496

Added line #L1496 was not covered by tests
if relation and relation.get("node", None):
related_node = InfrahubNodeSync.from_graphql(
client=self._client, branch=branch, data=relation, timeout=timeout
)
related_nodes.append(related_node)
elif rel and isinstance(rel, RelationshipManagerSync):
peers = node_data["node"].get(rel_name)
if peers:
peers = node_data["node"].get(rel_name, None)

Check warning on line 1503 in infrahub_sdk/node/node.py

View check run for this annotation

Codecov / codecov/patch

infrahub_sdk/node/node.py#L1503

Added line #L1503 was not covered by tests
if peers and peers["edges"]:
for peer in peers["edges"]:
related_node = InfrahubNodeSync.from_graphql(
client=self._client, branch=branch, data=peer, timeout=timeout
Expand Down