This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1281333 - Error "No configuration file found" shows up when use kubeconfig option with non exist value
Error "No configuration file found" shows up when use kubeconfig option with ...
Status: CLOSED CURRENTRELEASE
Product: OpenShift Origin
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
3.x
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: Juan Vallejo
Wei Sun
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-12 05:30 EST by Xingxing Xia
Modified: 2016-12-09 16:50 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-12-09 16:50:17 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Xingxing Xia 2015-11-12 05:30:22 EST
Description of problem:
When use kubeconfig option (such as --context, --cluster) with non exist value, the command gives confusing error message: 
error: No configuration file found, please login or point to an existing file:


Version-Release number of selected component (if applicable):
oc v1.0.8-16-gd81eca7
kubernetes v1.1.0-origin-1107-g4c8e6f4

How reproducible:
Always

Steps to Reproduce:
1. Start openshift
2. oc login, create a project and new app
$ oc login --server=https://<server>:8443 -u gim -p abc
$ oc new-project gim-proj
$ oc new-app -f origin/examples/sample-app/application-template-stibuild.json
3. Check config file
$ oc config view
4. Use invalid values
1> $ oc get bc --user='gim/<server>:8443' --cluster='no-this-cluster' -n gim-proj
2> $ oc get bc --context='no-this-context'
5. 
1> check env
$ env | grep KUBE # Got empty
2> check config
$ ls ~/.kube/config
/home/tester/.kube/config


Actual results:
3.
apiVersion: v1
clusters:
- cluster:
    insecure-skip-tls-verify: true
    server: https://<server>:8443
  name: <server>:8443
contexts:
- context:
    cluster: <server>:8443
    namespace: gim-proj
    user: gim/<server>:8443
  name: gim-proj/<server>:8443/gim
current-context: gim-proj/<server>:8443/gim
kind: Config
preferences: {}
users:
- name: gim/<server>:8443
  user:
    token: 7vUToaM2QdO8DMCvCubPCabkiFoDjXFtrJdOYtde9As
4
1> and 2>:
error: No configuration file found, please login or point to an existing file:

  1. Via the command-line flag --config
  2. Via the KUBECONFIG environment variable
  3. In your home directory as ~/.kube/config

Expected results:
4. Should give prompt such as no context/cluster found (once upon a time, it prompted so!), rather than no configuration file found. Indeed the configuration file exists

Additional info:
Comment 1 Juan Vallejo 2016-07-19 18:01:16 EDT
Related PR: https://github.com/openshift/origin/pull/9944
Comment 2 Xingxing Xia 2016-10-19 06:26:01 EDT
Thanks. Verified in oc v1.4.0-alpha.0+e3a2814. Fixed. Now prompt message looks clearly:
$ oc get bc --user='no-this' --cluster='no-this-cluster' 
error: auth info "no-this" does not exist
$ oc get bc --cluster='no-this-cluster' 
error: cluster "no-this-cluster" does not exist

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