Skip to content

Commit 6b333ec

Browse files
authored
Fix duplication of relationships for templates (#5832)
1 parent afc93fc commit 6b333ec

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

backend/infrahub/core/schema/schema_branch.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1824,6 +1824,10 @@ def manage_object_template_relationships(self) -> None:
18241824

18251825
def add_relationships_to_template(self, node: NodeSchema) -> None:
18261826
template_schema = self.get(name=self._get_object_template_kind(node_kind=node.kind), duplicate=False)
1827+
# Remove previous relationships to account for new ones
1828+
template_schema.relationships = [
1829+
r for r in template_schema.relationships if r.kind == RelationshipKind.TEMPLATE
1830+
]
18271831

18281832
for relationship in node.relationships:
18291833
if relationship.peer in [

0 commit comments

Comments
 (0)