Bug 1501756 - [Trello o6UiTkxv] Exit code from oc plugin does not return to bash terminal
Summary: [Trello o6UiTkxv] Exit code from oc plugin does not return to bash terminal
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 3.7.0
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: 3.9.0
Assignee: Maciej Szulik
QA Contact: Xingxing Xia
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-10-13 06:53 UTC by XiaochuanWang
Modified: 2019-03-13 22:27 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Error code was not properly propagated from plugin. Consequence: oc plugin was not returning error when it should. Fix: Properly propagate errors from plugins. Result: Error code matches result.
Clone Of:
Environment:
Last Closed: 2019-03-13 22:27:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:0403 0 None None None 2019-03-13 22:27:29 UTC

Description XiaochuanWang 2017-10-13 06:53:36 UTC
Description of problem:
Create a oc plugin with negative command, exec the oc plugin command and check exit code again on terminal, exit code is not correct.

Version-Release number of selected component (if applicable):
oc v3.7.0-0.147.1

How reproducible:
Always

Steps to Reproduce:
1. # mkdir -p /usr/share/kubectl/plugins/myplugin
2. # vi /usr/share/kubectl/plugins/myplugin/plugin.yaml
name: "myplugin"
shortDesc: "My plugin's short description"
command: "ls non-existed"
3. # oc plugin myplugin
4. check exit code by echo $?

Actual results:
3. ls: cannot access non-existed: No such file or directory
error: exit status 2
4. 1

Expected results:
4. Exit code should be 2

Additional info:

Comment 1 XiaochuanWang 2017-10-13 06:57:02 UTC
Checked on oc v3.7.0-0.150 and it reproduces.

Comment 2 Juan Vallejo 2017-10-17 21:31:57 UTC
Upstream PR: https://github.com/kubernetes/kubernetes/pull/54094

Comment 3 Juan Vallejo 2017-10-25 14:09:40 UTC
Upstream PR [1] has merged. Changes will be brought in to Origin after the next rebase.

1. https://github.com/kubernetes/kubernetes/pull/54094

Comment 4 Xingxing Xia 2018-07-23 08:22:23 UTC
Issue has been fixed for long time. Verified with oc v3.9.30:
[xxia@fedora28 my]$ oc plugin myplugin
ls: cannot access 'non-existed': No such file or directory
error: exit status 2
[xxia@fedora28 my]$ echo $?
2

Moving to VERIFIED directly, thanks

Comment 7 errata-xmlrpc 2019-03-13 22:27:23 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:0403


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