Bug 1386119

Summary: oadm diagnostics --config= don't recognize the symbol "~"
Product: OpenShift Container Platform Reporter: Peng Li <penli>
Component: ocAssignee: Luke Meyer <lmeyer>
Status: CLOSED WONTFIX QA Contact: Xingxing Xia <xxia>
Severity: low Docs Contact:
Priority: low    
Version: 3.3.0CC: aos-bugs, jokerman, mmccomas
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-01-15 18:16:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Peng Li 2016-10-18 08:35:17 UTC
Description of problem:
oadm diagnostics --config= don't recognize the symbol "~"

Version-Release number of selected component (if applicable):
openshift v3.3.1.2
kubernetes v1.3.0+52492b4
etcd 2.3.0+git


How reproducible:
always

Steps to Reproduce:
1. login a OpenShift, so config exist under ~/.kube/config
2. run 'oadm diagnostics --config=~/.kube/config'

ERROR: [DCli1001 from diagnostic ConfigLoading@openshift/origin/pkg/diagnostics/client/config_loading.go:79]
       The client configuration file was not found where the --config flag indicated:
         ~/.kube/config
       A config file was found at the following location:
         /home/penli/.kube/config
       If you wish to use this file for client configuration, you can specify it
       with the --config flag, or just not specify the flag.
       
ERROR: [CED3015 from controller openshift/origin/pkg/cmd/admin/diagnostics/diagnostics.go]
       Client configuration failed to load; skipping client and cluster diagnostics due to error: stat ~/.kube/config: no such file or directory

3. use the same config, but with the absolute path
 no error shown.

4. use other symbol like '.' or '..', no such error
[penli@dhcp-137-185 .kube]$ pwd
/home/penli/.kube
[penli@dhcp-137-185 .kube]$ oadm diagnostics --config=./config


Actual results:
      The client configuration file was not found where the --config flag indicated:
         ~/.kube/config


Expected results:
no error show

Additional info:
n/a

Comment 2 Peng Li 2016-10-18 09:27:43 UTC
@lmeyer, after file this bug, xxia point me above bug which looks alike but with 'oc', not 'oadm', should we add some document in case user also run into this issue?

Comment 3 Luke Meyer 2016-10-18 13:51:22 UTC
It's bash that is responsible for expanding ~ and it only does it for the first character of a parameter, which is why you're running into this.

Given it's bash's "problem" and the use of --config is pretty rare for most users (the problem exists for any parameter, but I doubt any other will ever point to something in ~), I'm not inclined to try to document this. The only change I can think of that would help much would be to modify the auto-created option docs:

  $ oadm diagnostics -h
  [...]
      --config='': Path to the config file to use for CLI requests.

If we left out "=" there it might encourage new users to do the same in their invocations. That would be a CLI concern.

Comment 4 Luke Meyer 2018-01-15 18:16:55 UTC
I just don't see this being worth the effort.