This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 510774 - pkisilent returns 0 on errors
pkisilent returns 0 on errors
Status: CLOSED CURRENTRELEASE
Product: Dogtag Certificate System
Classification: Community
Component: Scripts (Show other bugs)
1.1
All Linux
low Severity medium
: ---
: ---
Assigned To: Ade Lee
Chandrasekar Kannan
:
Depends On:
Blocks: 431020 freeipa20 445047
  Show dependency treegraph
 
Reported: 2009-07-10 13:49 EDT by Rob Crittenden
Modified: 2015-01-04 18:39 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-04 15:59:09 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Rob Crittenden 2009-07-10 13:49:43 EDT
Description of problem:

pkisilent always returns 0 whether the command succeeds or not. This makes it difficult to use within a script.

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

dogtag 1.1 SVN revision 675

Steps to Reproduce:
1. /usr/bin/pkisilent -foo
2. echo $?
Comment 1 Ade Lee 2009-12-03 10:28:44 EST
Simple patch to fix.

Index: scripts/pkisilent
===================================================================
--- scripts/pkisilent   (revision 876)
+++ scripts/pkisilent   (working copy)
@@ -157,7 +157,15 @@
 ###############################################################################
 
 my $output = `java -cp $ENV{CLASSPATH} @ARGV`;
+my $status = $?;
 
 print "#######################################################################\n";
 print "$output\n";
 print "#######################################################################\n";
+
+if ($status != 0) {
+  exit(255);
+} else {
+  exit(0);
+}
+
Comment 2 Jack Magne 2009-12-03 15:58:31 EST
Attachments id=375817 id=375819 jmagne+

With caveat of checking for an empty string in the function:
checkRequireArgs.
Comment 3 Ade Lee 2009-12-03 16:30:34 EST
Checked in as part of fixes to 504030:

Checked into tip:
[builder@dhcp231-70 silent]$  svn ci -m "fixes for BZ 510774,531162,504030,
493418"  
Sending        silent/scripts/pkisilent
Sending        silent/src/argparser/ArgParser.java
Sending        silent/src/ca/ConfigureCA.java
Sending        silent/src/common/ComCrypto.java
Sending        silent/src/drm/ConfigureDRM.java
Sending        silent/src/ocsp/ConfigureOCSP.java
Sending        silent/src/subca/ConfigureSubCA.java
Sending        silent/src/tks/ConfigureTKS.java
Sending        silent/src/tps/ConfigureTPS.java
Transmitting file data .........
Committed revision 877.

Checked into 8.1
[builder@oliver silent]$ svn ci -m "fixes for BZ 510774,531162, 504030, 493418"
Sending        silent/scripts/pkisilent
Sending        silent/src/argparser/ArgParser.java
Sending        silent/src/ca/ConfigureCA.java
Sending        silent/src/drm/ConfigureDRM.java
Sending        silent/src/ocsp/ConfigureOCSP.java
Sending        silent/src/subca/ConfigureSubCA.java
Sending        silent/src/tks/ConfigureTKS.java
Sending        silent/src/tps/ConfigureTPS.java
Transmitting file data ........
Committed revision 878.
Comment 4 Ade Lee 2009-12-03 16:34:06 EST
Note to docs/ QE:

This is easy to test. See description.
You should be able to invoke pkisilent and check status with 
echo $?

You should get 0 for success, and non-zero for any errors.
Comment 5 Asha Akkiangady 2010-05-13 11:41:11 EDT
Tested pkisilent for CA, KRA, OCSP, RA, TKS and CA clone, returns 0 when success and non zero for failures.

Marking the bug verified.

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