Bug 1125957

Summary: ccs --setconf doesn't check for missing hostname
Product: Red Hat Enterprise Linux 6 Reporter: Radek Steiger <rsteiger>
Component: ricciAssignee: Chris Feist <cfeist>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: low Docs Contact:
Priority: low    
Version: 6.6CC: cluster-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ccs-0.16.2-77.el6.x86_64 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 07:33:52 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:

Description Radek Steiger 2014-08-01 12:55:29 UTC
Description of problem:

Using ccs --setconf without specifying a hostname results in a traceback:

# ccs --setconf -f /etc/cluster/cluster.conf 
Traceback (most recent call last):
  File "/usr/sbin/ccs", line 2450, in <module>
    main(sys.argv[1:])
  File "/usr/sbin/ccs", line 271, in main
    if (sendconf): send_cluster_conf()
  File "/usr/sbin/ccs", line 2217, in send_cluster_conf
    set_cluster_conf(xml, False)
  File "/usr/sbin/ccs", line 2252, in set_cluster_conf
    log_msg (send_ricci_command("cluster", "set_cluster.conf", hostname, ("cluster.conf","xml","",xml)))
  File "/usr/sbin/ccs", line 2339, in send_ricci_command
    res = send_to_ricci(msg, host)
  File "/usr/sbin/ccs", line 2362, in send_to_ricci
    (family, socktype, proto, canonname, sockaddr) = socket.getaddrinfo(host, RICCI_PORT)[0]
TypeError: getaddrinfo() argument 1 must be string or None

When only the filename is omitted however, a proper error message is printed, so this bug is most likely a missing case check:

[root@virt-102 cluster]# ccs --setconf -h localhost
Error: must specify a filename and host when using --setconf

(This bug is not related to the fix of bug 917809 as it can be reproduced with older ccs versions too.)



Version-Release number of selected component (if applicable):
ccs-0.16.2-69.el6.x86_64
ccs-0.16.2-75.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. ccs --setconf -f /etc/cluster/cluster.conf 
2.
3.

Actual results:
Traceback (see above)

Expected results:
Error message (see above)

Comment 1 Chris Feist 2014-08-05 21:30:29 UTC
Fixed upstream with these two commits (require -h to use --setconf)

https://github.com/feist/ccs/commit/285a8a1c4c6280e2d5e7574d74caf5c6777932dd
https://github.com/feist/ccs/commit/8bea49e03ad7c834dcf1a91c380621440c9dc24f

Comment 2 Chris Feist 2015-03-03 23:24:08 UTC
Before Fix:

[root@ask-03 ~]# rpm -q ccs
ccs-0.16.2-75.el6.x86_64
[root@ask-03 ~]# ccs -f test_file  --createcluster test
[root@ask-03 ~]# ccs --setconf -f test_file
Traceback (most recent call last):
  File "/usr/sbin/ccs", line 2450, in <module>
    main(sys.argv[1:])
  File "/usr/sbin/ccs", line 271, in main
    if (sendconf): send_cluster_conf()
  File "/usr/sbin/ccs", line 2217, in send_cluster_conf
    set_cluster_conf(xml, False)
  File "/usr/sbin/ccs", line 2252, in set_cluster_conf
    log_msg (send_ricci_command("cluster", "set_cluster.conf", hostname, ("cluster.conf","xml","",xml)))
  File "/usr/sbin/ccs", line 2339, in send_ricci_command
    res = send_to_ricci(msg, host)
  File "/usr/sbin/ccs", line 2362, in send_to_ricci
    (family, socktype, proto, canonname, sockaddr) = socket.getaddrinfo(host, RICCI_PORT)[0]
TypeError: getaddrinfo() argument 1 must be string or None


After Fix:
[root@ask-02 ~]# rpm -q ccs
ccs-0.16.2-77.el6.x86_64
[root@ask-02 ~]# ccs -f test_file  --createcluster test
[root@ask-02 ~]# ccs --setconf -f test_file 
Error: you must specify a filename and host when using --setconf
[root@ask-02 ~]#

Comment 5 errata-xmlrpc 2015-07-22 07:33:52 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://rhn.redhat.com/errata/RHBA-2015-1405.html