Bug 1835011 - OC project shows misleading error when project exists in config but has been deleted from system
Summary: OC project shows misleading error when project exists in config but has been ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.3.z
Hardware: Unspecified
OS: Linux
high
high
Target Milestone: ---
: 4.5.0
Assignee: Sally
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-12 22:13 UTC by Sally
Modified: 2020-07-13 17:38 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of: 1826676
Environment:
Last Closed: 2020-07-13 17:38:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift oc pull 417 0 None closed Bug 1835011: 'oc project' improve error when project has been deleted 2020-06-22 14:06:23 UTC
Github openshift oc pull 431 0 None closed Bug 1835011: improve error for 'oc project' and 'oc status' when project doesn't exist 2020-06-22 14:06:22 UTC
Red Hat Product Errata RHBA-2020:2409 0 None None None 2020-07-13 17:38:26 UTC

Description Sally 2020-05-12 22:13:03 UTC
+++ This bug was initially created as a clone of Bug #1826676 +++

When a user runs `oc project` but the kubeconfig current context is a project that has been deleted (only way this will happen is if user has no other projects) the user gets a misleading error.  The error message should be improved. 


How reproducible:
Always

Steps to Reproduce:
1) Login to an existing cluster
$ oc new-project test
$ oc delete project test
$ oc project

user gets misleading error: 'error: you do not have rights to view project "test".' 
 
If user has no projects, should instead see 
'error: You are not a member of any projects. You can request a project to be created with the 'new-project' command.'

Comment 1 Maciej Szulik 2020-05-13 14:25:14 UTC
The problem appears when you're using a regular non-system:admin user:

oc project
error: you do not have rights to view project "tesla"

with system:admin the message is ok:

oc status
error: the project "tesla" specified in your config does not exist

Comment 2 Sally 2020-05-20 16:28:36 UTC
This bug is actively being worked on.

Comment 5 zhou ying 2020-05-27 03:03:23 UTC
$ ./oc version -o yaml 
clientVersion:
  buildDate: "2020-05-26T21:24:07Z"
  compiler: gc
  gitCommit: 384535d084fda4ab8b3e37c995bf20ed46dbce51
  gitTreeState: dirty
  gitVersion: 384535d0
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: windows/amd64


$ ./oc project
error: you do not have rights to view project "zhouy" specified in your config or the project doesn't exist

Comment 6 errata-xmlrpc 2020-07-13 17:38:07 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:2409


Note You need to log in before you can comment on or make changes to this bug.