Bug 1106414

Summary: psql wrapper always return zero even if psql command is already failed.
Product: OpenShift Container Platform Reporter: Johnny Liu <jialiu>
Component: ImageStreamsAssignee: Brenton Leanhardt <bleanhar>
Status: CLOSED ERRATA QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 2.1.0CC: adellape, bleanhar, jhadvig, jokerman, libra-onpremise-devel, mmccomas
Target Milestone: ---Keywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rubygem-openshift-origin-node-1.23.9.15-1.el6op Doc Type: Bug Fix
Doc Text:
The rhcsh command that is used for interactive gear logins had a bug in the psql function. This function wraps the actual command-line tool to automatically provide database access credentials, but it always returned exit code 0, even when the command had actually failed. This issue could confuse scripts using the function. This bug fix updates the rhcsh command to preserve the exit code correctly, and the psql function exits as expected as a result. Users must reconnect to their gear using SSH to pick up the new function after applying this fix.
Story Points: ---
Clone Of: 1106413 Environment:
Last Closed: 2014-08-26 13:52:20 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: 1106413    
Bug Blocks:    

Description Johnny Liu 2014-06-09 09:46:40 UTC
+++ This bug was initially created as a clone of Bug #1106413 +++

Description of problem:
Check psql wrapper function in /usr/bin/rhcsh, psql command's return value is always return 0.

Version-Release number of selected component (if applicable):
devenv_4850

How reproducible:
Always

Steps to Reproduce:
1.Create app, and embed postgresql.
2.Log into this app, run psql command with non-existing file.
> psql -f xx; echo $?
psql: FATAL:  password authentication failed for user "admin1hygbvy"
0
3.

Actual results:
It always return 0.

Expected results:
Psql wrapper should return non-zero value when psql command is failed.

Additional info:

Comment 1 Johnny Liu 2014-06-09 09:48:03 UTC
This issue also reproduced in 2.1.z/2014-05-29.3

Comment 2 Jakub Hadvig 2014-06-12 10:26:22 UTC
This issue has been fixed and verified on the Online: 
https://bugzilla.redhat.com/show_bug.cgi?id=1106413

Comment 3 Brenton Leanhardt 2014-08-01 13:17:43 UTC
Upstream commit:

[enterprise-2.1 4b32b39] Bug 1106413: psql wrapper always return zero even if psql command is already failed
 Author: jhadvig <jhadvig>
 1 file changed, 4 insertions(+), 1 deletion(-)

Comment 6 Johnny Liu 2014-08-04 06:09:16 UTC
Verified this bug with puddle-2-1-2014-08-01, and PASS.

> psql -f xx.conf; echo $?
xx.conf: No such file or directory
1

Comment 8 errata-xmlrpc 2014-08-26 13:52:20 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.

http://rhn.redhat.com/errata/RHBA-2014-1095.html