Bug 1314817

Summary: oc rsync commands return inconsistent error message when pod is not found
Product: OKD Reporter: Ricardo Martinelli de Oliveira <rmartine>
Component: ocAssignee: Fabiano Franz <ffranz>
Status: CLOSED CURRENTRELEASE QA Contact: Wang Haoran <haowang>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.xCC: aos-bugs, mbukatov, mmccomas, xxia
Target Milestone: ---Flags: rmartine: needinfo?
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-12 17:13:24 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 Ricardo Martinelli de Oliveira 2016-03-04 15:37:41 UTC
Description of problem:
I tried to copy a file from my pod to my local laptop and it returned this error:

$ oc rsync broker-amq-2-h3rz4:/etc/amq-secret-volume/broker.ts .
WARNING: cannot use rsync: rsync not available in containerWARNING: cannot use tar: tar not available in containererror: tar not available in container

However, the commands exist in my pod:

sh-4.2$ whereis tar                                                             
tar: /usr/bin/tar                                                               
sh-4.2$ whereis rsync                                                           
rsync: /usr/bin/rsync 

After setting --loglevel to 4 I found out that the real issue is that the pod cannot be found:

$ oc rsync broker-amq-2-h3rz4:/etc/amq-secret-volume/broker.ts . --loglevel=4
I0304 11:54:28.802886   30104 loader.go:241] Config loaded from file /home/rmartine/.kube/config
I0304 11:54:28.804266   30104 loader.go:241] Config loaded from file /home/rmartine/.kube/config
I0304 11:54:28.804400   30104 util.go:54] Setting root command to: oc
I0304 11:54:28.804412   30104 util.go:59] The sibling command is: oc rsh
I0304 11:54:28.804425   30104 copyrsync.go:44] Rsh command: oc rsh --loglevel=4
I0304 11:54:28.805737   30104 loader.go:241] Config loaded from file /home/rmartine/.kube/config
I0304 11:54:28.807214   30104 loader.go:241] Config loaded from file /home/rmartine/.kube/config
I0304 11:54:30.113404   30104 copyrsync.go:65] Copying files with rsync
I0304 11:54:30.113425   30104 execlocal.go:19] Local executor running command: rsync -a --blocking-io --omit-dir-times --numeric-ids -v -e oc rsh --loglevel=4 broker-amq-2-h3rz4:/etc/amq-secret-volume/broker.ts .
I0304 11:54:31.681136   30104 execlocal.go:26] Error from local command execution: exit status 255
I0304 11:54:31.681198   30104 execremote.go:28] Remote executor running command: rsync --version
I0304 11:54:31.957391   30104 execremote.go:49] Error from remote execution: pods "broker-amq-2-h3rz4" not found
I0304 11:54:31.957509   30104 util.go:24]
I0304 11:54:31.957580   30104 util.go:25] error: pods "broker-amq-2-h3rz4" not found
I0304 11:54:31.957617   30104 copymulti.go:28] Error output:
WARNING: cannot use rsync: rsync not available in containerI0304 11:54:31.957671   30104 copytar.go:116] Copying files with tar
I0304 11:54:31.957802   30104 copytar.go:143] Creating local tar file /tmp/rsync688996689 from remote path /etc/amq-secret-volume/broker.ts
I0304 11:54:31.957837   30104 copytar.go:205] Tarring /etc/amq-secret-volume/broker.ts remotely
I0304 11:54:31.957869   30104 copytar.go:212] Remote tar command: tar -C /etc/amq-secret-volume -c broker.ts
I0304 11:54:31.957897   30104 execremote.go:28] Remote executor running command: tar -C /etc/amq-secret-volume -c broker.ts
I0304 11:54:32.235728   30104 execremote.go:49] Error from remote execution: pods "broker-amq-2-h3rz4" not found
I0304 11:54:32.235776   30104 execremote.go:28] Remote executor running command: tar --version
I0304 11:54:32.511036   30104 execremote.go:49] Error from remote execution: pods "broker-amq-2-h3rz4" not found
I0304 11:54:32.511087   30104 util.go:24]
I0304 11:54:32.511100   30104 util.go:25] error: pods "broker-amq-2-h3rz4" not found
I0304 11:54:32.511157   30104 copymulti.go:28] Error output:
WARNING: cannot use tar: tar not available in containerF0304 11:54:32.511200   30104 helpers.go:96] error: tar not available in container

Version-Release number of selected component (if applicable):
3.1.x

How reproducible:
Everytime when oc rsync cannot find the pod.

Steps to Reproduce:
1. Run oc rsync command using an arbitrary pod name

Actual results:
oc rsync returns: "WARNING: cannot use rsync: rsync not available in containerWARNING: cannot use tar: tar not available in container"

Expected results:
oc rsync returns an error message that the pod with specified name cannot be found

Additional info:
Use --loglevel flag to capture additional information.

Comment 1 Fabiano Franz 2016-03-08 15:04:14 UTC
Fixed in https://github.com/openshift/origin/pull/7804

Comment 2 Wang Haoran 2016-03-09 05:45:17 UTC
verified with:
openshift v1.1.3-536-gda71953
kubernetes v1.2.0-alpha.7-703-gbc4550d
etcd 2.2.5

[root@ip-172-18-7-39 ~]# oc get pod
NAME                      READY     STATUS    RESTARTS   AGE
docker-registry-1-xu5xs   1/1       Running   0          51m
router-1-vks1o            1/1       Running   1          51m

[root@ip-172-18-7-39 ~]# oc rsync /tmp/test/ podnotexist:/tmp/test/
Error from server: pods "podnotexist" not found

Comment 3 Ricardo Martinelli de Oliveira 2016-03-09 12:30:48 UTC
As an additional request to this bug, the error message could give some suggestions like: "Check if the pod exists or if you run 'oc project' to the project where the pod is running"