Bug 1353161

Summary: Better to remove the message "error executing remote command" when exit from container
Product: OKD Reporter: Xingxing Xia <xxia>
Component: ocAssignee: Fabiano Franz <ffranz>
Status: CLOSED CURRENTRELEASE QA Contact: Xingxing Xia <xxia>
Severity: low Docs Contact:
Priority: medium    
Version: 3.xCC: aos-bugs, jvallejo, 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: 2016-12-09 21:50:40 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:
Bug Depends On: 1290023, 1496992    
Bug Blocks:    

Description Xingxing Xia 2016-07-06 10:24:26 UTC
Description of problem:
When oc rsh pod, user may easily type wrong command, or, right command which fails. If user exist then, there is message "error: error executing remote command: error executing command in container: Error executing in Docker Container". Better to remove it because it seems not needed

Version-Release number of selected component (if applicable):
oc v1.3.0-alpha.2-1021-g11997a9

How reproducible:
Always

Steps to Reproduce:
1. oc new-app -f origin/examples/sample-app/application-template-stibuild.json
2.
$ oc rsh database-1-pviz8
sh-4.2$ datr
sh: datr: command not found
sh-4.2$ exit
exit
error: error executing remote command: error executing command in container: Error executing in Docker Container: 127
3.
$ oc rsh database-1-pviz8
sh-4.2$ /bin/false
sh-4.2$ exit
exit
error: error executing remote command: error executing command in container: Error executing in Docker Container: 1

Actual results:
2 and 3:
There outputs the error message

Expected results:
Better to let it exit silently, no need to output the error message.

Additional info:

Comment 1 Juan Vallejo 2016-07-07 13:14:49 UTC
Open PR: https://github.com/openshift/origin/pull/9724

Comment 2 Juan Vallejo 2016-07-07 13:56:26 UTC
PR: https://github.com/openshift/origin/pull/9334

Comment 3 Juan Vallejo 2016-07-07 13:57:24 UTC
(In reply to Juan Vallejo from comment #2)
> PR: https://github.com/openshift/origin/pull/9334

Please ignore PR link, this is for another bug

Comment 4 Juan Vallejo 2016-11-11 14:34:04 UTC
This has been fixed upstream and will be in Origin in the next rebase: https://github.com/kubernetes/kubernetes/pull/26541

We are not removing the error "error executing remote command..." as it could impact scriptability.

Comment 5 Juan Vallejo 2016-11-11 14:35:05 UTC
(In reply to Juan Vallejo from comment #4)
> This has been fixed upstream and will be in Origin in the next rebase:
> https://github.com/kubernetes/kubernetes/pull/26541
> 
> We are not removing the error "error executing remote command..." as it
> could impact scriptability.

The PR link does fix returning the right exit code for the command that failed in the container.

Comment 6 Xingxing Xia 2016-11-14 03:37:14 UTC
Tested on latest AMI devenv-centos7_5359 (openshift v1.4.0-alpha.1+9c4f9ee-179), the binary has included the rebase of PR 26541.

Test steps:
[centos@ip-172-18-3-144 xxia]$ oc rsh database-1-2zynr
sh-4.2$ datr
sh: datr: command not found
sh-4.2$ exit
exit
[centos@ip-172-18-3-144 xxia]$ echo $?
127

[centos@ip-172-18-3-144 xxia]$ oc rsh database-1-2zynr
sh-4.2$ ls inexist-file
ls: cannot access inexist-file: No such file or directory
sh-4.2$ exit
exit
[centos@ip-172-18-3-144 xxia]$ echo $?
2

Now it returns the right exit code for the command that failed in the container, like bug 1290023 of oc exec.

> We are not removing the error "error executing remote command..." as it
> could impact scriptability.
But this is not the fact. From above results, seems the error "error executing remote command..." is removed?

Comment 7 Juan Vallejo 2016-11-14 15:00:34 UTC
> But this is not the fact. From above results, seems the error "error executing remote command..." is removed?

Apologies, I had used an older openshift image for my results. Tried it again with `openshift v1.3.0-rc1+9c4f9ee-1415` and it is not giving me the message "error executing remote command..." anymore.