From 31842a08d7e71a132e006bde9e172d9353c7eeb6 Mon Sep 17 00:00:00 2001 From: "15219900+Ninjagod1251@users.noreply.github.com" <15219900+Ninjagod1251@users.noreply.github.com> Date: Fri, 3 Jan 2025 14:30:24 -0800 Subject: [PATCH] fix: delete method --- silverback/cluster/client.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/silverback/cluster/client.py b/silverback/cluster/client.py index f8e8d8e0..3e375c63 100644 --- a/silverback/cluster/client.py +++ b/silverback/cluster/client.py @@ -100,17 +100,17 @@ def __hash__(self) -> int: def update( self, name: str | None = None, variables: dict[str, str | None] | None = None ) -> "VariableGroup": + if name is not None: # Update metadata - response = self.cluster.put(f"/vars/{self.id}", json=dict(name=name)) + response = self.cluster.put(f"/vars/{self.name}", json=dict(name=name)) handle_error_with_response(response) - if variables is not None: # Create a new revision - response = self.cluster.post(f"/vars/{self.id}", json=dict(variables=variables)) + variable_list = [f"{k}={v}" for k, v in variables.items() if v is not None] + response = self.cluster.put(f"/vars/{self.name}", json=dict(variables=variable_list)) handle_error_with_response(response) return VariableGroup.model_validate(response.json()) - return self def get_revision(self, revision: int | Literal["latest"] = "latest") -> VariableGroupInfo: @@ -123,7 +123,7 @@ def get_revision(self, revision: int | Literal["latest"] = "latest") -> Variable return VariableGroupInfo.model_validate(response.json()) def remove(self): - response = self.cluster.delete(f"/vars/{self.id}") + response = self.cluster.delete(f"/vars/{self.name}") handle_error_with_response(response)