Bug 1231760 - "~" cannot be parsed in oc command
Summary: "~" cannot be parsed in oc command
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: oc
Version: 3.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Michal Fojtik
QA Contact: Yan Du
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-06-15 11:20 UTC by Meng Bo
Modified: 2019-05-10 08:59 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-23 21:17:54 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Meng Bo 2015-06-15 11:20:30 UTC
Description of problem:
Trying to use oc command with existing config, eg, placed under ~/.config/openshift_config, it cannot be parsed by the oc command and said no such file or path.

Version-Release number of selected component (if applicable):
oc v0.6.0.1-78-g1c816ed

How reproducible:
always

Steps to Reproduce:
1. Run oc command with --config option
$ oc get po --config=~/.kube/config
2. Run co login with --config option
$ oc login https://master_ip:8443/ -u bmeng -p redhat --config=~/.config/openshift_config
3.

Actual results:
1.
$ oc get po --config=~/.kube/config 
error: stat ~/.kube/config: no such file or directory

2. It will generate a new dir named "~" under the current working dir.
$ ls -alp
total 16
drwxr-xr-x. 3 bmeng bmeng   20 Jun 15 16:50 ~/
drwx------. 3 bmeng bmeng   80 Jun 15 16:50 ./
drwxr-xr-x. 3 root  root    18 Jun 15 16:48 ../
-rw-r--r--. 1 bmeng bmeng   18 Jan 11 18:06 .bash_logout
-rw-r--r--. 1 bmeng bmeng  193 Jan 11 18:06 .bash_profile
-rw-r--r--. 1 bmeng bmeng  231 Jan 11 18:06 .bashrc
-rw-r--r--. 1 root  root  1066 Jun 15 16:49 ca.crt


Expected results:
1. It should be able to read the existing config file.
2. It should be able to generate the config file under the user's home.

Additional info:

Comment 1 Michal Fojtik 2015-07-02 13:37:26 UTC
I think this will require upstream change to expand '~' to Getenv("HOME")

Comment 2 Michal Fojtik 2015-09-29 09:08:30 UTC
Fabiano, I can take this :)

Comment 3 Michal Fojtik 2015-09-29 09:25:31 UTC
(In reply to Meng Bo from comment #0)
> Description of problem:
> Trying to use oc command with existing config, eg, placed under
> ~/.config/openshift_config, it cannot be parsed by the oc command and said
> no such file or path.
> 
> Version-Release number of selected component (if applicable):
> oc v0.6.0.1-78-g1c816ed
> 
> How reproducible:
> always
> 
> Steps to Reproduce:
> 1. Run oc command with --config option
> $ oc get po --config=~/.kube/config
> 2. Run co login with --config option
> $ oc login https://master_ip:8443/ -u bmeng -p redhat
> --config=~/.config/openshift_config
> 3.
> 
> Actual results:
> 1.
> $ oc get po --config=~/.kube/config 
> error: stat ~/.kube/config: no such file or directory

You have to use it without '=' sign:

$ oc get po --config ~/.kube/config

The ~ is expanded by the shell in this case. If you use '=' sign, it is passed with '~' unexpanded. 


> 2. It will generate a new dir named "~" under the current working dir.
> $ ls -alp
> total 16
> drwxr-xr-x. 3 bmeng bmeng   20 Jun 15 16:50 ~/
> drwx------. 3 bmeng bmeng   80 Jun 15 16:50 ./
> drwxr-xr-x. 3 root  root    18 Jun 15 16:48 ../
> -rw-r--r--. 1 bmeng bmeng   18 Jan 11 18:06 .bash_logout
> -rw-r--r--. 1 bmeng bmeng  193 Jan 11 18:06 .bash_profile
> -rw-r--r--. 1 bmeng bmeng  231 Jan 11 18:06 .bashrc
> -rw-r--r--. 1 root  root  1066 Jun 15 16:49 ca.crt
> 
> 
> Expected results:
> 1. It should be able to read the existing config file.
> 2. It should be able to generate the config file under the user's home.
> 
> Additional info:

Comment 4 Meng Bo 2015-10-09 02:47:50 UTC
Checked with oc version v1.0.6-442-gc5a2711-dirty

The '~' can be parsed without the '='.

[user1@master ~]$ oc get po --config ~/.kube/config
NAME                      READY     STATUS    RESTARTS   AGE
service-spreading-8dpi6   1/1       Running   1          16h
service-spreading-hyvoa   1/1       Running   1          16h


Move bug to verified.


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