Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1354498 - [cli] pcs should except KeyboardInterrupt at least around raw_input builtin invocation
[cli] pcs should except KeyboardInterrupt at least around raw_input builtin i...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pcs (Show other bugs)
7.1
Unspecified Unspecified
low Severity low
: rc
: ---
Assigned To: Tomas Jelinek
cluster-qe@redhat.com
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-07-11 08:34 EDT by Jan Pokorný
Modified: 2017-11-15 14:41 EST (History)
7 users (show)

See Also:
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 16:59:17 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
proposed fix (1.23 KB, patch)
2016-08-08 09:10 EDT, Tomas Jelinek
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2596 normal SHIPPED_LIVE Moderate: pcs security, bug fix, and enhancement update 2016-11-03 08:11:34 EDT

  None (edit)
Description Jan Pokorný 2016-07-11 08:34:50 EDT
# 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
Comment 1 Tomas Jelinek 2016-08-08 09:10 EDT
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
Comment 2 Tomas Jelinek 2016-08-09 03:38:58 EDT
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
Comment 3 Ivan Devat 2016-08-19 08:30:33 EDT
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
Comment 8 errata-xmlrpc 2016-11-03 16:59:17 EDT
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
Comment 9 Jan Pokorný 2017-11-15 14:41:45 EST
See also https://github.com/ClusterLabs/pcs/issues/152

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