-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Print clearer messages in oc status
when user has no projects
#12304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Print clearer messages in oc status
when user has no projects
#12304
Conversation
"github.com/openshift/origin/pkg/client" | ||
) | ||
|
||
func CanRequestProjects(config *restclient.Config, defaultNamespace string) (bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabianofranz The reason why I created a new file under a new package pkg/cmd/cli/cmd/login/util
rather than placing this helper under pkg/cmd/cli/cmd/login/helpers.go
was because I would introduce a dependency cycle by importing the login
package in pkg/cmd/cli/describe/projectstatus.go
[test] |
oc status
when user has no projectsoc status
when user has no projects
LGTM, please squash. ;) |
This patch re-uses the "No projects" message from `oc login` in `oc status` if a user attempts to use the command without first creating any projects. This message suggests to the user a way to request a new project rather than returning an error to the user which warns that they cannot "get" projects in project "default". **Before** ``` $ oc login -u newuser -p any Login successful. You don't have any projects. You can try to create a new project, by running oc new-project <projectname> $ oc status Error from server: User "newuser" cannot get projects in project "default" ``` **After** ``` $ oc login -u newuser -p any Login successful. You don't have any projects. You can try to create a new project, by running oc new-project <projectname> $ oc status You don't have any projects. You can try to create a new project, by running oc new-project <projectname> ``` Additionally, since the same message from `oc login` is re-used, if a user does not have access to request new projects, the following message is printed instead: ``` $ oc status You don't have any projects. Contact your system administrator to request a project. ```
cef50e1
to
44bfec9
Compare
Evaluated for origin test up to 44bfec9 |
@fabianofranz Thanks! Done |
[merge] |
Evaluated for origin merge up to 44bfec9 |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/12568/) (Base Commit: 3164ce5) (Image: devenv-rhel7_5584) |
continuous-integration/openshift-jenkins/test ABORTED (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/12564/) (Base Commit: 2dd7247) |
Related bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1405636
This patch re-uses the "No projects" message from
oc login
inoc status
if a user attempts to use the command without first creating anyprojects. This message suggests to the user a way to request a new
project rather than returning an error to the user which warns that they
cannot "get" projects in project "default".
Before
After
Additionally, since the same message from
oc login
is re-used, if auser does not have access to request new projects, the following message
is printed instead:
@openshift/cli-review