Bug 1693054

Summary: Absolute path should be used in the help page of oc create secret generic
Product: OpenShift Container Platform Reporter: Wenjing Zheng <wzheng>
Component: ocAssignee: Jan Chaloupka <jchaloup>
oc sub component: oc QA Contact: zhou ying <yinzhou>
Status: CLOSED CURRENTRELEASE Docs Contact:
Severity: low    
Priority: medium CC: aos-bugs, jchaloup, mfojtik, mmccomas, vlaad, wking, xxia
Version: unspecified   
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: 2022-08-25 22:04:32 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:
Embargoed:

Description Wenjing Zheng 2019-03-27 03:29:33 UTC
Description of problem:
Relative path is used in the help page of oc create secret generic, but actually it cannot work, only absolute path works.
Examples:
  #####################
  # Create a new secret named my-secret with specified keys instead of names on disk
  oc create secret generic my-secret --from-file=ssh-privatekey=~/.ssh/id_rsa
--from-file=ssh-publickey=~/.ssh/id_rsa.pub
  
  #########################################
  # Create a new secret named my-secret using a combination of a file and a literal
  oc create secret generic my-secret --from-file=ssh-privatekey=~/.ssh/id_rsa --from-literal=passphrase=topsecret


Version-Release number of selected component (if applicable):
Client Version: v4.0.22
Server Version: v1.12.4+7cf6a84

How reproducible:
always

Steps to Reproduce:
1.$ oc create secret generic my-secret --from-file=ssh-privatekey=~/.ssh/id_rsa --from-file=ssh-publickey=~/.ssh/id_rsa.pub
error: error reading ~/.ssh/id_rsa: no such file or directory
2.$ ls ~/.ssh/ | grep id_rsa
id_rsa
id_rsa.pub
3.$ oc create secret generic my-secret --from-file=ssh-privatekey=/home/wzheng/.ssh/id_rsa --from-file=ssh-publickey=/home/wzheng/.ssh/id_rsa.pub
secret/my-secret created


Actual results:
Relative path doesn't work if follow the help page

Expected results:
Should use absolute path in the help page

Additional info:

Comment 2 W. Trevor King 2019-04-12 06:49:46 UTC
https://github.com/openshift/origin/pull/22450#event-2271456983 landed.

Comment 3 Wenjing Zheng 2019-04-17 07:09:00 UTC
Verified with below version:
Client Version: version.Info{Major:"4", Minor:"1+", GitVersion:"v4.1.0", GitCommit:"028f4745a", GitTreeState:"", BuildDate:"2019-04-16T22:43:51Z", GoVersion:"", Compiler:"", Platform:""}

Examples:
  # Create a new secret named my-secret with keys for each file in folder bar
  oc create secret generic my-secret --from-file=path/to/bar
  
  # Create a new secret named my-secret with specified keys instead of names on disk
  oc create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa
--from-file=ssh-publickey=path/to/id_rsa.pub
  
  # Create a new secret named my-secret with key1=supersecret and key2=topsecret
  oc create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret
  
  # Create a new secret named my-secret using a combination of a file and a literal
  oc create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-literal=passphrase=topsecret
  
  # Create a new secret named my-secret from an env file
  oc create secret generic my-secret --from-env-file=path/to/bar.env