Bug 1354498
Summary: | [cli] pcs should except KeyboardInterrupt at least around raw_input builtin invocation | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Jan Pokorný [poki] <jpokorny> | ||||
Component: | pcs | Assignee: | Tomas Jelinek <tojeline> | ||||
Status: | CLOSED ERRATA | QA Contact: | cluster-qe <cluster-qe> | ||||
Severity: | low | Docs Contact: | |||||
Priority: | low | ||||||
Version: | 7.1 | CC: | cfeist, cluster-maint, idevat, mlisik, omular, rsteiger, tojeline | ||||
Target Milestone: | rc | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | pcs-0.9.152-7.el7 | Doc Type: | If docs needed, set a value | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2016-11-03 20:59:17 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: | |||||||
Attachments: |
|
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 |
# 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