Bug 1387106 - pcs fails when uses a non-ascii output from external program
Summary: pcs fails when uses a non-ascii output from external program
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: pcs
Version: 6.8
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: rc
: ---
Assignee: Tomas Jelinek
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-20 06:33 UTC by Ivan Devat
Modified: 2017-03-21 11:04 UTC (History)
6 users (show)

Fixed In Version: pcs-0.9.155-1.el6
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-21 11:04:40 UTC
Target Upstream Version:


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


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:0707 0 normal SHIPPED_LIVE pcs bug fix update 2017-03-21 12:40:33 UTC

Description Ivan Devat 2016-10-20 06:33:02 UTC
Description of problem:
pcs fails when it uses a non-ascii output from an external program. This may be due to locales.


Steps to Reproduce:

> ensure sbd is not a recognized service
[vm-rhel67-1 ~] $ service sbd status
sbd: unrecognized service

> ensure "pcs status" works
[vm-rhel67-1 ~] $ pcs status
Cluster name: devcluster6
Last updated: Wed Oct 19 16:19:15 2016          Last change: Wed Oct 19 16:19:09 2016 by root via cibadmin on vm-rhel67-1
Stack: cman
Current DC: vm-rhel67-1 (version 1.1.14-8.el6_8.1-70404b0) - partition with quorum
2 nodes and 1 resource configured

Online: [ vm-rhel67-1 vm-rhel67-2 ]

Full list of resources:

 xvm-fencing    (stonith:fence_xvm):    Started vm-rhel67-1

> change LANG to get non-ascii characters
[vm-rhel67-1 ~] $ export LANG=cs_CZ.UTF-8
[vm-rhel67-1 ~] $ service sbd status
sbd: neznámá služba

> run "pcs status"
[vm-rhel67-1 ~] $ pcs status


Actual results:

Cluster name: devcluster6
Traceback (most recent call last):
  File "/usr/sbin/pcs", line 9, in <module>
    load_entry_point('pcs==0.9.154', 'console_scripts', 'pcs')()
  File "/usr/lib/python2.6/site-packages/pcs/app.py", line 216, in main
    cmd_map[command](argv)
  File "/usr/lib/python2.6/site-packages/pcs/status.py", line 24, in status_cmd
    full_status()
  File "/usr/lib/python2.6/site-packages/pcs/status.py", line 91, in full_status
    if utils.stonithCheck():
  File "/usr/lib/python2.6/site-packages/pcs/utils.py", line 1944, in stonithCheck
    if is_service_running(cmd_runner(), "sbd"):
  File "/usr/lib/python2.6/site-packages/pcs/lib/external.py", line 274, in is_service_running
    ["service", service, "status"]
  File "/usr/lib/python2.6/site-packages/pcs/lib/external.py", line 414, in run
    out_err=out_err
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 9: ordinal not in range(128)


Expected results:

Cluster name: devcluster6
Last updated: Wed Oct 19 16:19:15 2016          Last change: Wed Oct 19 16:19:09 2016 by root via cibadmin on vm-rhel67-1
Stack: cman
Current DC: vm-rhel67-1 (version 1.1.14-8.el6_8.1-70404b0) - partition with quorum
2 nodes and 1 resource configured

Online: [ vm-rhel67-1 vm-rhel67-2 ]

Full list of resources:

 xvm-fencing    (stonith:fence_xvm):    Started vm-rhel67-1

Comment 2 Tomas Jelinek 2016-10-20 07:11:08 UTC
pcs often parses output of external tools and we need to make sure the messages are in a defined language.

Comment 5 Tomas Jelinek 2016-10-20 13:42:27 UTC
Created attachment 1212519 [details]
proposed fix

It is essential to remove all fence devices from the cluster otherwise the reproducer does not work.



Test:
# LC_ALL=cs_CZ.UTF8 pcs status 
Cluster name: cluster68
WARNING: no stonith devices and stonith-enabled is not false
Stack: cman
Current DC: rh68-node1 (version 1.1.15-1.el6-e174ec8) - partition with quorum
Last updated: Thu Oct 20 15:40:15 2016          Last change: Thu Oct 20 15:35:28 2016 by root via cibadmin on rh68-node2

2 nodes and 0 resources configured

Online: [ rh68-node1 rh68-node2 ]

No resources


Daemon Status:
  cman: active/disabled
  corosync: active/disabled
  pacemaker: active/enabled
  pcsd: active/enabled

Comment 6 Ivan Devat 2016-11-07 15:37:11 UTC
Before Fix:

[vm-rhel67-1 ~] $ rpm -q pcs
pcs-0.9.154-1.el6.x86_64

> ensure sbd is not a recognized service

[vm-rhel67-1 ~] $ service sbd status
sbd: unrecognized service

> have a cluster without fence devices

[vm-rhel67-1 ~] $ pcs status|grep "no stonith device"
WARNING: no stonith devices and stonith-enabled is not false

[vm-rhel67-1 ~] $ LC_ALL=cs_CZ.UTF8 pcs status
Cluster name: devcluster6
Traceback (most recent call last):
  File "/usr/sbin/pcs", line 9, in <module>
    load_entry_point('pcs==0.9.154', 'console_scripts', 'pcs')()
  File "/usr/lib/python2.6/site-packages/pcs/app.py", line 216, in main
    cmd_map[command](argv)
  File "/usr/lib/python2.6/site-packages/pcs/status.py", line 24, in status_cmd
    full_status()
  File "/usr/lib/python2.6/site-packages/pcs/status.py", line 91, in full_status
    if utils.stonithCheck():
  File "/usr/lib/python2.6/site-packages/pcs/utils.py", line 1944, in stonithCheck
    if is_service_running(cmd_runner(), "sbd"):
  File "/usr/lib/python2.6/site-packages/pcs/lib/external.py", line 274, in is_service_running
    ["service", service, "status"]
  File "/usr/lib/python2.6/site-packages/pcs/lib/external.py", line 414, in run
    out_err=out_err
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 9: ordinal not in range(128)


After Fix:

[vm-rhel67-1 ~] $ rpm -q pcs
pcs-0.9.155-1.el6.x86_64
[vm-rhel67-1 ~] $ service sbd status
sbd: unrecognized service
[vm-rhel67-1 ~] $ pcs status|grep "no stonith device"
WARNING: no stonith devices and stonith-enabled is not false
[vm-rhel67-1 ~] $ LC_ALL=cs_CZ.UTF8 pcs status
Cluster name: devcluster6
WARNING: no stonith devices and stonith-enabled is not false
Stack: cman
Current DC: vm-rhel67-1 (version 1.1.15-2.el6-e174ec8) - partition with quorum
Last updated: Mon Nov  7 15:37:31 2016          Last change: Mon Nov  7 15:36:54 2016 by root via crmd on vm-rhel67-1

2 nodes and 0 resources configured

Online: [ vm-rhel67-1 vm-rhel67-2 ]

No resources


Daemon Status:
  cman: active/disabled
  corosync: active/disabled
  pacemaker: active/disabled
  pcsd: active/disabled

Comment 10 errata-xmlrpc 2017-03-21 11:04:40 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/RHBA-2017-0707.html


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