Skip to content

Commit

Permalink
fix: update workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
dtdang committed Oct 25, 2024
1 parent d127f7d commit f60cdc1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion silverback/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,15 @@ def update_workspace(
raise click.UsageError(
"No update name or slug found. Please enter a name or slug to update."
)
elif update_name == "" or update_slug == "":
raise click.UsageError("Empty string value found for name or slug.")

platform.update_workspace(
workspace=workspace,
update_name=update_name,
update_slug=update_slug,
)
click.echo(f"{click.style('SUCCESS', fg='green')}: Updated '{update_name}'")
click.echo(f"{click.style('SUCCESS', fg='green')}: Updated '{workspace}'")


@workspaces.command(name="delete", section="Platform Commands (https://silverback.apeworx.io)")
Expand Down
7 changes: 6 additions & 1 deletion silverback/cluster/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,14 @@ def update_workspace(
update_name: str | None,
):
workspace_id = self.workspaces[workspace].id
form_data = dict()
if update_slug:
form_data["slug"] = update_slug
if update_name:
form_data["name"] = update_name
response = self.patch(
f"/workspaces/{workspace_id}",
data=dict(slug=update_slug, name=update_name),
data=form_data,
)
handle_error_with_response(response)
update_workspace = Workspace.model_validate_json(response.text)
Expand Down

0 comments on commit f60cdc1

Please sign in to comment.