RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
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
Target Upstream Version:
Embargoed:


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


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2596 0 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.