Skip to content

Commit f98b496

Browse files
committed
Fix _artifact_support to correctly check for CoreArtifactTarget
1 parent 0259a78 commit f98b496

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

infrahub_sdk/node/node.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,12 @@ def __init__(self, schema: MainSchemaTypesAPI, branch: str, data: dict | None =
6363
self._attributes = [item.name for item in self._schema.attributes]
6464
self._relationships = [item.name for item in self._schema.relationships]
6565

66-
self._artifact_support = hasattr(schema, "inherit_from") and "CoreArtifactTarget" in schema.inherit_from
67-
if not isinstance(schema, GenericSchemaAPI):
68-
self._artifact_support = getattr(schema, "inherit_from", None) is not None
69-
else:
66+
# GenericSchemaAPI doesn't have inherit_from, so we need to check the type first
67+
if isinstance(schema, GenericSchemaAPI):
7068
self._artifact_support = False
69+
else:
70+
inherit_from = getattr(schema, "inherit_from", None) or []
71+
self._artifact_support = "CoreArtifactTarget" in inherit_from
7172
self._artifact_definition_support = schema.kind == "CoreArtifactDefinition"
7273

7374
# Check if this node is hierarchical (supports parent/children and ancestors/descendants)

0 commit comments

Comments
 (0)