Bug 738008

Summary: ccs_sync exit code always zero
Product: Red Hat Enterprise Linux 6 Reporter: Radek Steiger <rsteiger>
Component: ricciAssignee: Chris Feist <cfeist>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3CC: cluster-maint, rsteiger
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ricci-0.16.2-48.el6 Doc Type: Bug Fix
Doc Text:
Cause: Ricci isn't running on one or more nodes when using ccs_sync with the '-w' option Consequence: ccs_sync doesn't return '1' on failure Fix: Updated ccs_sync to return '1' on failure Result: ccs_sync -w now returns '1' on failure.
Story Points: ---
Clone Of:
: 818335 (view as bug list) Environment:
Last Closed: 2012-06-20 14:13:43 UTC Type: ---
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: 756082, 818335    

Description Radek Steiger 2011-09-13 15:51:41 UTC
Description of problem:

ccs_sync does not return a non-zero exit code if something goes wrong, even when -w parameter is given. This was discovered during testing for IPv6 support where ccs_sync was unable to connect to any of the nodes. It still returned 0.

Similarly, it should possibly exit non-zero when invalid parameter is given.

[root@z4 cluster]# ccs_sync -i -w
Unable to connect to z46
Unable to connect to z26
[root@z4 cluster]# echo $?
0
[root@z4 cluster]#

[root@z4 cluster]# ccs_sync --invalid-option
ccs_sync: invalid option -- '-'
Usage: ccs_sync [options] [<host0> [... <hostN>]]
   -f <cluster_conf>            Path to the cluster.conf file to propagate.
   -c <NSS certificate DB>      Path to your cacert.pem file.
   -i                           Increment the configuration version before propagating.
   -h                           Print this help dialog.
   -p <port number>             Connect to ricci on the specified port.
   -w                           Exit with failure status if any warnings are issued.
   -v                           Print version information.
[root@z4 cluster]# echo $?
0
[root@z4 cluster]#


Version-Release number of selected component (if applicable):
ricci-0.16.2-35.el6


How reproducible:
Always


Steps to Reproduce:
1. create a cluster (IPv6 cluster for build =< 35 is a good case)
   or use any other technique to make sure ccs_sync won't be able to connect
2. run ccs_sync -i
3. print exit code using 'echo $?'

  
Actual results:

Returns 0 on error.


Expected results:

Returns non-zero on error.

Comment 2 Radek Steiger 2011-09-14 12:35:38 UTC
This bug came out of https://bugzilla.redhat.com/show_bug.cgi?id=697493

Comment 5 Chris Feist 2012-02-03 21:57:00 UTC
How to test:

Set up a 2 node cluster with ricci running on both nodes.
Run ccs_sync -i -w it should succeed with exit value 0

[root@amoco-02 ~]# ccs_sync -i -w
[root@amoco-02 ~]# echo $?
0

Stop ricci on one of the nodes:
[root@amoco-01 ~]# /etc/init.d/ricci stop
Shutting down ricci: [  OK  ]

Try ccs_sync on the node still running:
[root@amoco-02 ~]# ccs_sync -i -w
Failed to connect to amoco-01.lab.msp.redhat.com: Connection refused.
[root@amoco-02 ~]# echo $?
0

After fix, it should look like this:
[root@amoco-02 ccs_sync]# ./ccs_sync -i -w
Failed to connect to amoco-01.lab.msp.redhat.com: Connection refused.
[root@amoco-02 ccs_sync]# echo $?
1

Comment 7 Chris Feist 2012-02-28 00:30:20 UTC
[root@ask-04 tmp]# ls -l /etc/cluster/cluster.conf
ls: cannot access /etc/cluster/cluster.conf: No such file or directory
[root@ask-04 tmp]# ccs_sync -i
Unable to parse /etc/cluster/cluster.conf: No such file or directory
[root@ask-04 tmp]# echo $?
1


[root@ask-04 tmp]# /etc/init.d/ricci stop
Shutting down ricci:                                       [  OK  ]
[root@ask-04 tmp]# ccs_sync -i
Failed to connect to ask-04: Connection refused.
[root@ask-04 tmp]# echo $?
1

Comment 9 Chris Feist 2012-03-15 20:06:39 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: Ricci isn't running or another error is ocurring when using ccs_sync with the '-w' option

Consequence: ccs_sync doesn't return '1' on failure

Fix: Updated ccs_sync to return '1' on failure

Result: ccs_sync -w now returns '1' on failure.

Comment 10 Chris Feist 2012-05-02 22:16:36 UTC
Just a clarification, this bz covers the case where ccs_sync -i -w (or ccs_sync -i) doesn't return '1' when it can't connect to one of the nodes on ipv4, other return code issues are in bz 818335.

Comment 15 Chris Feist 2012-05-03 15:36:56 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,4 +1,4 @@
-Cause: Ricci isn't running or another error is ocurring when using ccs_sync with the '-w' option
+Cause: Ricci isn't running on one or more nodes when using ccs_sync with the '-w' option
 
 Consequence: ccs_sync doesn't return '1' on failure

Comment 17 errata-xmlrpc 2012-06-20 14:13:43 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-2012-0898.html