Red Hat Bugzilla – Bug 1354498
[cli] pcs should except KeyboardInterrupt at least around raw_input builtin invocation
Last modified: 2017-11-15 14:41:45 EST
# pcs cluster auth node1 > Username: ^CTraceback (most recent call last): > File "/usr/sbin/pcs", line 9, in <module> > load_entry_point('pcs==0.9.152', 'console_scripts', 'pcs')() > File "/usr/lib/python2.7/site-packages/pcs/app.py", line 209, in main > cmd_map[command](argv) > File "/usr/lib/python2.7/site-packages/pcs/cluster.py", line 87, in cluster_cmd > cluster_auth(argv) > File "/usr/lib/python2.7/site-packages/pcs/cluster.py", line 162, in cluster_auth > auth_nodes(argv) > File "/usr/lib/python2.7/site-packages/pcs/cluster.py", line 214, in auth_nodes > username = utils.get_terminal_input('Username: ') > File "/usr/lib/python2.7/site-packages/pcs/utils.py", line 1767, in get_terminal_input > return raw_input("") > KeyboardInterrupt
Created attachment 1188753 [details] proposed fix Test: [root@rh72-node1:~]# pcs cluster auth rh72-node1 rh72-node2 rh72-node3 --force Username: ^CInterrupted [root@rh72-node1:~]# echo $? 1 [root@rh72-node1:~]# pcs cluster auth rh72-node1 rh72-node2 rh72-node3 --force Username: hacluster Password: Interrupted [root@rh72-node1:~]# echo $? 1
The patch also fixes handling EOF, test: > setup, create an empty file [root@rh72-node1:~]# touch empty [root@rh72-node1:~]# wc empty 0 0 0 empty > before fix, pcs crashes [root@rh72-node1:~]# pcs cluster auth rh72-node1 rh72-node2 --force < empty Username: Traceback (most recent call last): File "/usr/sbin/pcs", line 9, in <module> load_entry_point('pcs==0.9.152', 'console_scripts', 'pcs')() File "/usr/lib/python2.7/site-packages/pcs/app.py", line 216, in main cmd_map[command](argv) File "/usr/lib/python2.7/site-packages/pcs/cluster.py", line 88, in cluster_cmd cluster_auth(argv) File "/usr/lib/python2.7/site-packages/pcs/cluster.py", line 163, in cluster_auth auth_nodes(argv) File "/usr/lib/python2.7/site-packages/pcs/cluster.py", line 215, in auth_nodes username = utils.get_terminal_input('Username: ') File "/usr/lib/python2.7/site-packages/pcs/utils.py", line 1805, in get_terminal_input return raw_input("") EOFError: EOF when reading a line > after fix, pcs considers username and password to be empty strings which results in authentication failure what is expected [root@rh72-node1:~]# pcs cluster auth rh72-node1 rh72-node2 --force < empty Username: Password: Error: rh72-node1: Username and/or password is incorrect Error: rh72-node2: Username and/or password is incorrect
Setup: [vm-rhel72-1 ~] $ touch empty [vm-rhel72-1 ~] $ wc empty 0 0 0 empty Before Fix: [vm-rhel72-1 ~] $ rpm -q pcs pcs-0.9.152-6.el7.x86_64 [vm-rhel72-1 ~] $ pcs cluster auth vm-rhel72-1 vm-rhel72-3 --force < empty Username: Traceback (most recent call last): File "/usr/sbin/pcs", line 9, in <module> load_entry_point('pcs==0.9.152', 'console_scripts', 'pcs')() File "/usr/lib/python2.7/site-packages/pcs/app.py", line 216, in main cmd_map[command](argv) File "/usr/lib/python2.7/site-packages/pcs/cluster.py", line 88, in cluster_cmd cluster_auth(argv) File "/usr/lib/python2.7/site-packages/pcs/cluster.py", line 163, in cluster_auth auth_nodes(argv) File "/usr/lib/python2.7/site-packages/pcs/cluster.py", line 215, in auth_nodes username = utils.get_terminal_input('Username: ') File "/usr/lib/python2.7/site-packages/pcs/utils.py", line 1805, in get_terminal_input return raw_input("") EOFError: EOF when reading a line After Fix: [vm-rhel72-1 ~] $ rpm -q pcs pcs-0.9.152-7.el7.x86_64 [vm-rhel72-1 ~] $ pcs cluster auth vm-rhel72-1 vm-rhel72-3 --force < empty Username: Password: Error: vm-rhel72-3: Username and/or password is incorrect Error: vm-rhel72-1: Username and/or password is incorrect
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/RHSA-2016-2596.html
See also https://github.com/ClusterLabs/pcs/issues/152