Skip to content

Commit

Permalink
fix: delete method
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninjagod1251 committed Jan 3, 2025
1 parent 86dded2 commit 31842a0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions silverback/cluster/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)


Expand Down

0 comments on commit 31842a0

Please sign in to comment.