delete a workspace from cli fails when it was created on behalf of another user
To manage a workshop, I wrote some script to create and delete the proper number of users and workspaces.
I had no issue to create the workspace on behalf of each user like this:
in the end I have X users with an associated workspace.
Now I plan my work after the workshop and so I wrote the equivalent script to remove those users and workspaces.
But the command to delete a workspace fails with the error:
Did I miss something?
side note: why having a different syntax for workspace and not as the others coder <resource> <subcommand>?
11 Replies
<#1306212095380946985>
Category
Bug report
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
In the meantime I tried to implement this with API calls.
but I got 405, DELETE is not allowed on this route
hey @TitiMoby, it looks like you are missing the
user$i/
part in your coder delete
command
also, i'm pretty sure you don't have to delete workspaces before deleting an user
regarding the side note, I'd say that workspaces are kinda the main thing, so it's probably to make commands shorterOhhhhh you mean
I’ll have to test it.
Did I misread the documentation? It was not really clear.
If you want, after my two last events for 2024, I’ll have some time to make some feedback on what I found during my usage of Coder
To delete a workspace for another user you need to provide it's name as
user/workspace
yes!
and I would love the feedback!
You do unfortunately, we don't have a way to handle orphaned workspaces currently
found this out working on the coderd provider
I can confirm that point: you do have to delete workspaces from a user before deleting it.
So I can confirm that:
- @Phorcys spotted I forgot to include user$i/
- The documentation is a not coherent between create and delete and maybe describe the parameter as either <workspace name> or <user name>/<workspace name> in both case (even if I should have though of it by my API version in the near future
Considering my initial question, I think I got all I needed. 💞
coder delete <name>
works when it's a workspace owned by the current user
basically each workspace is unique on a per user basisI don't know if it's the right place to explain my point of view, but let's give it a try.
At first, you have the create command.
Documentation says:
Usage
And then you have:
Description:
I would prefer a clear explanation for the name parameter which can be either workspace or user/workspace.
Let's say, I have the information needed if I read the create documentation.
On the other hand, the delete documentation says:
Usage
And there is no description afterwards explaining the "with or without user"
So there is a discrepancy between the two documentation: one is using a parameter name and have clues on what you can put in name, the other one is using workspace and has no detail.
I know it might sounds minor, but an old fox like me felt in the trap 😉
i'll unify that :-)