From b272db91c7f2618628e65dcea550c2a469f1e4a1 Mon Sep 17 00:00:00 2001 From: Damien Garros Date: Thu, 25 Jan 2024 13:27:57 +0100 Subject: [PATCH] Revert "set id in _generate_input_data" This reverts commit 353376b03d6c05dd0957ffd8b279297bb669ab8c. --- python_sdk/infrahub_sdk/node.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python_sdk/infrahub_sdk/node.py b/python_sdk/infrahub_sdk/node.py index 443cf3885c..179a7669e7 100644 --- a/python_sdk/infrahub_sdk/node.py +++ b/python_sdk/infrahub_sdk/node.py @@ -714,8 +714,6 @@ def _generate_input_data(self, exclude_unmodified: bool = False) -> Dict[str, Di # pylint: disable=too-many-branches data = {} variables = {} - if self.id is not None: - data["id"] = self.id for item_name in self._attributes: attr: Attribute = getattr(self, item_name) if attr._schema.read_only: @@ -1187,6 +1185,7 @@ async def generate_query_data_node( async def create(self, at: Timestamp, allow_upsert: bool = False) -> None: input_data = self._generate_input_data() + input_data["data"]["data"]["id"] = self.id mutation_query = {"ok": None, "object": {"id": None}} if allow_upsert: mutation_name = f"{self._schema.kind}Upsert" @@ -1215,6 +1214,7 @@ async def create(self, at: Timestamp, allow_upsert: bool = False) -> None: async def update(self, at: Timestamp, do_full_update: bool = False) -> None: input_data = self._generate_input_data(exclude_unmodified=not do_full_update) + input_data["data"]["data"]["id"] = self.id mutation_query = {"ok": None, "object": {"id": None}} query = Mutation( mutation=f"{self._schema.kind}Update", @@ -1497,6 +1497,7 @@ def generate_query_data_node( def create(self, at: Timestamp, allow_upsert: bool = False) -> None: input_data = self._generate_input_data() + input_data["data"]["data"]["id"] = self.id mutation_query = {"ok": None, "object": {"id": None}} if allow_upsert: mutation_name = f"{self._schema.kind}Upsert" @@ -1526,6 +1527,7 @@ def create(self, at: Timestamp, allow_upsert: bool = False) -> None: def update(self, at: Timestamp, do_full_update: bool = False) -> None: input_data = self._generate_input_data(exclude_unmodified=not do_full_update) + input_data["data"]["data"]["id"] = self.id mutation_query = {"ok": None, "object": {"id": None}} query = Mutation( mutation=f"{self._schema.kind}Update",