Bug 1014692
Summary: | some rhc client commands return wrong exitstatus when running from ruby | ||
---|---|---|---|
Product: | OpenShift Online | Reporter: | Oleg Fayans <ofayans> |
Component: | oc | Assignee: | Clayton Coleman <ccoleman> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | libra bugs <libra-bugs> |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | 1.x | CC: | amarecek, pruan, wjiang, wsun |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2013-10-17 13:33:25 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: |
So there are two bugs here. 1) rhc authorization -h should display the help page for help, not display the list of commands. The exit code 1 is actually correct for the list of commands (trying to find help for a command that does not exist), but since rhc authorization actually exists the list of commands should not be shown. 2) The pager function is what is causing the exit code to be 0, which is incorrect. We fork rhc and then exec less in order to get paging to start, but the exit code of RHC is being lost (it was supposed to be 1). Fixing both issues. Why are you trying to run -h? Did you mean to run 'rhc authorization --server ..." instead? Fixed #1 above as https://github.com/openshift/rhc/pull/472 - please spawn a bug for #2 Commit pushed to master at https://github.com/openshift/rhc https://github.com/openshift/rhc/commit/b21a224d17e7c3e0180ac0fccf1d8763acefcd0d Bug 1014692 - rhc authorization -h should display help page Was not detecting exact matches correctly. verified with devenv_3859 irb(main):002:0> `rhc authorization -h --server ec2-54-221-164-39.compute-1.amazonaws.com` => "Usage: rhc authorization \n\nShows the full list of authorization tokens on your account. You can add, edit, or delete authorizations with subcommands.\n\nAn authorization token grants access to the OpenShift REST API with a set of privileges called 'scopes' for a limited time. You can\nadd an optional note to each authorization token to assist you in remembering what is available.\n\n\nGlobal Options\n -l, --rhlogin LOGIN OpenShift login\n -p, --password PASSWORD OpenShift password\n --token TOKEN An authorization token for accessing your account.\n --server NAME An OpenShift server hostname (default: openshift.redhat.com)\n --timeout SECONDS The timeout for operations\n\n See 'rhc help options' for a full list of global options.\n\nList of Actions\n add Add an authorization to your account\n delete Delete one or more authorization tokens\n delete-all Delete all authorization tokens from your account\n list Show the authorization tokens for your account\n\nThe default action for this resource is 'list'\n\n" irb(main):003:0> $? => #<Process::Status: pid 12775 exit 0> irb(main):004:0> |
Description of problem: When I run rhc authorization -h --server [server.fqdn] from the irb shell, the exitstatus is 1 instead of 0 Version-Release number of selected component (if applicable): reproduced with rhc-1.14.6 and rhc-1.15.4 on ruby-1.9 and ruby-2.0 How reproducible: always Steps to Reproduce: 1. launch irb 2. > `rhc authorization -h --server someserver.example.com` 3. > puts $? Actual results: #<Process::Status: pid 21989 exit 1> Expected results: #<Process::Status: pid 22022 exit 0> Additional info: When I run > `rhc authorization -h` then I get #<Process::Status: pid 22022 exit 0> The same problem is when I run this command using Open3.popen2e(cmd), where cmd is the rhc command This bugs is an obstacle for writing the automated tests of the rhc