Bug 1572149 - `oc cp` with non-existent container or pod should prompt container or pod not found when copying from pod
Summary: `oc cp` with non-existent container or pod should prompt container or pod not...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 3.10.0
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: 4.2.0
Assignee: Maciej Szulik
QA Contact: Xingxing Xia
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-26 09:38 UTC by Xingxing Xia
Modified: 2019-10-16 06:27 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-10-16 06:27:40 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:2922 0 None None None 2019-10-16 06:27:56 UTC

Description Xingxing Xia 2018-04-26 09:38:05 UTC
Description of problem:
`oc cp -c` with wrong container should return container not valid when copying from pod.

Version-Release number of selected component (if applicable):
v3.10.0-0.29.0

How reproducible:
Always

Steps to Reproduce:
1. Given wrong container, copy things from pod to local:
oc cp -c euby-ex ruby-ex-1-8559q:/etc/hosts ./

2. Given wrong container, copy from local to pod:
oc cp -c euby-ex pod.yaml ruby-ex-1-8559q:/tmp


Actual results:
1. It shows:
error: etc/hosts no such file or directory

Given right container, it can succeed.

2. It shows:
Error from server (BadRequest): container euby-ex is not valid for pod ruby-ex-1-8559q

Expected results:
1. Should return container not valid like step 2

Additional info:

Comment 1 Xingxing Xia 2018-06-07 09:27:14 UTC
Similar when pod is not existent:
$ oc cp pod.yaml ruby-ex-1-bdc9m-typo:/tmp
Error from server (NotFound): pods "ruby-ex-1-bdc9m-typo" not found

$ oc cp ruby-ex-1-bdc9m-typo:/etc/hosts ./local/
error: etc/hosts no such file or directory

Comment 2 shahan 2018-06-11 07:51:34 UTC
Similiar when operate clusteradmin's pod with normal user:
[hasha@mypc cucushift]$ oc cp default/docker-registry-phf5b:/etc/hosts .
error: etc/hosts no such file or directory

Comment 4 Maciej Szulik 2019-04-24 13:35:02 UTC
Fix in https://github.com/openshift/origin/pull/22653

Comment 6 Maciej Szulik 2019-08-23 10:21:45 UTC
This was merged long time ago but never got properly moved, moving to qa to verify.

Comment 9 Xingxing Xia 2019-08-28 04:58:36 UTC
Verified in oc version: GitVersion:"v4.2.0", GitCommit:"1904cc55f", GitTreeState:"clean", BuildDate:"2019-08-28T02:28:30Z"
[xxia@fedora29 my]$ oc cp -c abc mysql-1-78msw:/etc/hosts ./
Error from server (BadRequest): container abc is not valid for pod mysql-1-78msw
[xxia@fedora29 my]$ oc cp -c abc pod.yaml mysql-1-78msw:/tmp
Error from server (BadRequest): container abc is not valid for pod mysql-1-78msw
[xxia@fedora29 my]$ oc cp ruby-ex-1-bdc9m-typo:/etc/hosts ./local/
Error from server (NotFound): pods "ruby-ex-1-bdc9m-typo" not found

Comment 11 errata-xmlrpc 2019-10-16 06:27:40 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-2019:2922


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