Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1354498 - [cli] pcs should except KeyboardInterrupt at least around raw_input builtin invocation
Summary: [cli] pcs should except KeyboardInterrupt at least around raw_input builtin i...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pcs
Version: 7.1
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Tomas Jelinek
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-11 12:34 UTC by Jan Pokorný [poki]
Modified: 2017-11-15 19:41 UTC (History)
7 users (show)

Fixed In Version: pcs-0.9.152-7.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 20:59:17 UTC


Attachments (Terms of Use)
proposed fix (deleted)
2016-08-08 13:10 UTC, Tomas Jelinek
no flags Details | Diff


Links
System 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 12:11:34 UTC

Description Jan Pokorný [poki] 2016-07-11 12:34:50 UTC
# 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 13:10:58 UTC
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 07:38:58 UTC
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 12:30:33 UTC
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 20:59:17 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/RHSA-2016-2596.html

Comment 9 Jan Pokorný [poki] 2017-11-15 19:41:45 UTC
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.