Bug 1290023
Summary: | Return true exit code from oc exec | |||
---|---|---|---|---|
Product: | OpenShift Container Platform | Reporter: | Mohamed Hamza Ben Mansour <mbenmans> | |
Component: | Node | Assignee: | Stefan Schimanski <sttts> | |
Status: | CLOSED ERRATA | QA Contact: | Yadan Pei <yapei> | |
Severity: | medium | Docs Contact: | ||
Priority: | unspecified | |||
Version: | 3.1.0 | CC: | agoldste, aos-bugs, bleanhar, ccoleman, decarr, jokerman, jvallejo, mmccomas, pruan, tdawson, wmeng, xiaocwan | |
Target Milestone: | --- | |||
Target Release: | --- | |||
Hardware: | All | |||
OS: | Linux | |||
Whiteboard: | ||||
Fixed In Version: | Doc Type: | Bug Fix | ||
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 1496992 (view as bug list) | Environment: | ||
Last Closed: | 2017-01-18 12:38:39 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: | ||||
Bug Blocks: | 1353161, 1496992 |
Description
Mohamed Hamza Ben Mansour
2015-12-09 14:15:43 UTC
This is a bug, does not have to be an RFE. Impacts scriptability. Not a 3.2 blocker IMO Create an upstream issue: https://github.com/kubernetes/kubernetes/issues/26424 https://github.com/kubernetes/kubernetes/issues/26541 has been merged in upstream during the 1.4 release cylce. This has been merged into ose and is in OSE v3.4.0.17 or newer. Tested on latest OCP v3.4.0.19 and reproduced by original steps (error occurred on step 2) # oc run dc --image=aosqe/hello-openshift (wait until the pod is ready and running) 1) Successful and code is passed correctly: # oc exec dc-1-vo5vt ls bin ... # echo $? 0 2) Error code 127 can not be passed out from container: # oc exec dc-1-vo5vt somecmd exec: "somecmd": executable file not found in $PATH error: error stream protocol error: invalid exit code value "-1" # echo $? 1 # somecmd bash: somecmd: command not found... # echo $? 127 3) Container get the expected error code # oc rsh dc-1-vo5vt / $ somecmd /bin/sh: somecmd: not found / $ echo $? 127 With kubectl 1.4.5: # kubectl exec sleep-661823049-44uzt somecmd rpc error: code = 2 desc = "oci runtime error: exec failed: exec: \"somecmd\": executable file not found in $PATH"% # echo $? 126 # kubectl exec sleep-661823049-44uzt -- /bin/sh -c somecmd /bin/sh: somecmd: not found # echo $? 127 The 126 should be a 127 as well IMO. Looks like "oc exec" behaves differently. Might be a rebase error. The 126 is what Docker report for failed exec commands. I was able to reproduce the "-1" of "oc exec somecmd" using upstream kube and upstream kubectl and Docker 1.10.3 on the nodes. It looks like the exit code return by the "exec start" command of the Docker API is "-1" for 1.10.3 and 126 for 1.12.1. 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-2017:0066 |