Conversation
deploifai/cloud_profile/create.py
Outdated
| if not "username" in context.global_config["WORKSPACE"]: | ||
| click.secho("Error in getting workspace") | ||
| raise click.Abort() |
There was a problem hiding this comment.
The error statement should be more precise
The fact that we could not get workspace means that the user has not done login through cli right?
So maybe something like please login would be a better error statement
There was a problem hiding this comment.
uh aren't you dealing with this issue now? but yeah I agree, I was just trying to finish up everything. But on top of that, yeah I think it makes sense to ask the user to login, but maybe also make sure they choose the right workspace to create a cloud profile in
There was a problem hiding this comment.
There should be an is_authenticated decorator to check for auth state already. But it's kinda useful to add this additional check for whether there's a workspace username in the global config as well; not entirely necessary because this conditional would only fail if the user manually edits the global config file.
There was a problem hiding this comment.
I just wrote that so i could reference it later
deploifai/workspace/list.py
Outdated
| @click.command() | ||
| @pass_deploifai_context_obj | ||
| @is_authenticated | ||
| def list(context: DeploifaiContextObj): | ||
| """ | ||
| Lists out all available workspaces | ||
| """ |
There was a problem hiding this comment.
list as a function name might cause errors in python
please suggest an alternate name
There was a problem hiding this comment.
Indeed. But I think we still want it to be workspace list command. So whatever function name we give it, we can just override with a command name argument put in the click.command decorator call.
68778da to
d1401e2
Compare
… into workspace-management
Cloud Profile Create - Tested, working as intended Project Create - Tested, working as intended Workspace set and list - Tested, working as intended Create cloud profile and get projects function - Changed workspace to be string instead of list
deploifai/cloud_profile/create.py
Outdated
| if not "username" in context.global_config["WORKSPACE"]: | ||
| click.secho("Error in getting workspace") | ||
| raise click.Abort() |
There was a problem hiding this comment.
Refactor into a decorator function.
deploifai/workspace/set.py
Outdated
| for w in workspaces_from_api: | ||
| if w["username"] == workspace: | ||
| command_workspace = w | ||
| break |
There was a problem hiding this comment.
quite unnecessary because the if(any... statement would have returned true if the workspace name provided by the user is in the list
deploifai/cloud_profile/create.py
Outdated
| if not "username" in context.global_config["WORKSPACE"]: | ||
| click.secho("Error in getting workspace") | ||
| raise click.Abort() |
There was a problem hiding this comment.
There should be an is_authenticated decorator to check for auth state already. But it's kinda useful to add this additional check for whether there's a workspace username in the global config as well; not entirely necessary because this conditional would only fail if the user manually edits the global config file.
deploifai/workspace/list.py
Outdated
| @click.command() | ||
| @pass_deploifai_context_obj | ||
| @is_authenticated | ||
| def list(context: DeploifaiContextObj): | ||
| """ | ||
| Lists out all available workspaces | ||
| """ |
There was a problem hiding this comment.
Indeed. But I think we still want it to be workspace list command. So whatever function name we give it, we can just override with a command name argument put in the click.command decorator call.
next step is refactoring the other commands that used the old workspace prompting