From abf9ead5ae2f67be71cdc6c5fee5c6caebbb7109 Mon Sep 17 00:00:00 2001 From: wvandeun Date: Mon, 10 Feb 2025 16:03:10 +0100 Subject: [PATCH 1/3] fixes artifact_fetch method to fetch artifact using artifact name --- infrahub_sdk/node.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrahub_sdk/node.py b/infrahub_sdk/node.py index 174cc06a..77ba7e76 100644 --- a/infrahub_sdk/node.py +++ b/infrahub_sdk/node.py @@ -1125,7 +1125,7 @@ async def artifact_generate(self, name: str) -> None: async def artifact_fetch(self, name: str) -> str | dict[str, Any]: self._validate_artifact_support(ARTIFACT_GENERATE_FEATURE_NOT_SUPPORTED_MESSAGE) - artifact = await self._client.get(kind="CoreArtifact", definition__name__value=name, object__ids=[self.id]) + artifact = await self._client.get(kind="CoreArtifact", name__value=name, object__ids=[self.id]) content = await self._client.object_store.get(identifier=artifact.storage_id.value) # type: ignore[attr-defined] return content From 25ec60bed64446fe91406ee6ae340118c05337d4 Mon Sep 17 00:00:00 2001 From: wvandeun Date: Mon, 10 Feb 2025 16:03:38 +0100 Subject: [PATCH 2/3] fixes artifact_generate method to use the name of the artifact --- infrahub_sdk/node.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrahub_sdk/node.py b/infrahub_sdk/node.py index 77ba7e76..5be89a01 100644 --- a/infrahub_sdk/node.py +++ b/infrahub_sdk/node.py @@ -1118,7 +1118,7 @@ async def generate(self, nodes: list[str] | None = None) -> None: async def artifact_generate(self, name: str) -> None: self._validate_artifact_support(ARTIFACT_GENERATE_FEATURE_NOT_SUPPORTED_MESSAGE) - artifact = await self._client.get(kind="CoreArtifact", definition__name__value=name, object__ids=[self.id]) + artifact = await self._client.get(kind="CoreArtifact", name__value=name, object__ids=[self.id]) await artifact.definition.fetch() # type: ignore[attr-defined] await artifact.definition.peer.generate([artifact.id]) # type: ignore[attr-defined] From 86024fcdba808d40663af99332c9bca54f0deef5 Mon Sep 17 00:00:00 2001 From: wvandeun Date: Tue, 11 Feb 2025 09:52:10 +0100 Subject: [PATCH 3/3] add changelog entry --- changelog/+artifact_methods.changed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/+artifact_methods.changed.md diff --git a/changelog/+artifact_methods.changed.md b/changelog/+artifact_methods.changed.md new file mode 100644 index 00000000..6aa2b60b --- /dev/null +++ b/changelog/+artifact_methods.changed.md @@ -0,0 +1 @@ +Changes InfrahubNode `artifact_fetch` and `artifact_generate` methods to use the name of the artifact instead of the name of the artifact definition