Bug 1422667 - cli: specifying seconds as 'n' in 'cib-push --wait=n' command produces TypeError
Summary: cli: specifying seconds as 'n' in 'cib-push --wait=n' command produces TypeError
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pcs
Version: 7.3
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: rc
: ---
Assignee: Ivan Devat
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
: 1441447 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-15 19:49 UTC by Radek Steiger
Modified: 2017-08-01 18:26 UTC (History)
6 users (show)

Fixed In Version: pcs-0.9.158-2.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 18:26:07 UTC
Target Upstream Version:


Attachments (Terms of Use)
proposed fix (1.43 KB, patch)
2017-05-04 15:29 UTC, Tomas Jelinek
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1419903 0 urgent CLOSED pcs cluster cib-push does not recognize "scope" option 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHBA-2017:1958 0 normal SHIPPED_LIVE pcs bug fix and enhancement update 2017-08-01 18:09:47 UTC

Internal Links: 1419903

Description Radek Steiger 2017-02-15 19:49:53 UTC
> Description of problem:

When running cib-push with specific wait time, a TypeError is produced in python as a result of an apparent attempt to concatenate a string and a number. 


> Version-Release number of selected component (if applicable):

pcs-0.9.152-10.el7_3.3


> How reproducible:

Always


> Steps to Reproduce:

1. pcs cluster cib > /tmp/cib.xml
2. sed -i -r "s/(.*)(epoch=.)([0-9]+)(.*)/printf "%s" '\1\2';echo \3+2|bc|tr -d '\n';printf "%s" '\4'/ge" /tmp/cib.xml
3a. pcs cluster cib-push /tmp/cib.xml --wait=10
3b. pcs cluster cib-push /tmp/cib.xml --wait=10 --debug


> Actual results:

[root@virt-131 tmp]# pcs cluster cib-push /tmp/cib.xml --wait=10
CIB updated
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 125, in cluster_cmd
    cluster_push(argv)
  File "/usr/lib/python2.7/site-packages/pcs/cluster.py", line 1276, in cluster_push
    output, retval = utils.run(cmd)
  File "/usr/lib/python2.7/site-packages/pcs/utils.py", line 882, in run
    universal_newlines=(not PYTHON2 and not binary_output)
  File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
TypeError: coercing to Unicode: need string or buffer, int found
[root@virt-131 tmp]# echo $?
1

[root@virt-131 tmp]# pcs cluster cib-push /tmp/cib.xml --wait=10 --debug
Running: /usr/sbin/crm_resource '-?'
Finished running: /usr/sbin/crm_resource '-?'
Return value: 1
.
.
.
CIB updated
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 125, in cluster_cmd
    cluster_push(argv)
  File "/usr/lib/python2.7/site-packages/pcs/cluster.py", line 1276, in cluster_push
    output, retval = utils.run(cmd)
  File "/usr/lib/python2.7/site-packages/pcs/utils.py", line 862, in run
    print("Running: " + " ".join(args))
TypeError: sequence item 3: expected string or Unicode, int found
[root@virt-131 tmp]# echo $?
1


> Expected results:

[root@virt-131 tmp]# pcs cluster cib-push /tmp/cib.xml --wait=10
CIB updated
[root@virt-131 tmp]# echo $?
0


> Additional info:

Comment 2 Tomas Jelinek 2017-04-26 10:59:15 UTC
*** Bug 1441447 has been marked as a duplicate of this bug. ***

Comment 3 Tomas Jelinek 2017-04-26 10:59:41 UTC
Support for --wait in the cib-push command has been added in pcs 0.9.152 and the bug was introduced in the very same patch. Therefore this is not a regression. Before pcs 0.9.152 the --wait flag was completely ignored in the cib-push command.

Comment 4 Tomas Jelinek 2017-04-27 07:49:55 UTC
Partial workaround is to not specify seconds in the --wait option, i.e.:
pcs cluster cib-push cib.xml --wait

Comment 5 vlad.socaciu 2017-04-28 02:15:28 UTC
(In reply to Tomas Jelinek from comment #4)
> Partial workaround is to not specify seconds in the --wait option, i.e.:
> pcs cluster cib-push cib.xml --wait

This does not apply to bug 1441447. In that case, we do not use anywhere the --wait argument. It is probably used internally by some of the pcs commands we are invoking. Evidently, we cannot modify those commands. For us, there is no "EasyFix" to this problem.

Would it be possible that we obtain a pcs version prior to 0.9.152-10.el7_3.3?

Comment 6 Ivan Devat 2017-04-28 06:32:21 UTC
(In reply to vlad.socaciu from comment #5)
In the script "activate_cluster_resources_rh7.sh" that is pushed into bug 1441447 there is the line:

> pcs cluster cib-push /tmp/pcs-config-$$ --config --wait=300

Here is `pcs cluster cib-push` used with the flag `--wait` which causes the crash.

Comment 7 vlad.socaciu 2017-04-29 00:13:06 UTC
(In reply to Ivan Devat from comment #6)
> (In reply to vlad.socaciu from comment #5)
> In the script "activate_cluster_resources_rh7.sh" that is pushed into bug
> 1441447 there is the line:
> 
> > pcs cluster cib-push /tmp/pcs-config-$$ --config --wait=300
> 
> Here is `pcs cluster cib-push` used with the flag `--wait` which causes the
> crash.

Gee, sorry gentlemen, I hadn't noticed that. The --wait parameter was inadvertently added there; I did not even know that it applied to the `pcs cluster cib-push` command.

Thank you for pointing this out.

Comment 8 Tomas Jelinek 2017-05-04 15:29:05 UTC
Created attachment 1276378 [details]
proposed fix

Comment 11 Tomas Jelinek 2017-05-26 10:52:00 UTC
After fix:

[root@rh73-node1:~]# pcs cluster cib > cib.xml
[root@rh73-node1:~]# pcs -f cib.xml resource create dummy ocf:pacemaker:Dummy
[root@rh73-node1:~]# pcs cluster cib-push cib.xml --wait=10
CIB updated
[root@rh73-node1:~]# echo $?
0

Comment 15 errata-xmlrpc 2017-08-01 18:26:07 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://access.redhat.com/errata/RHBA-2017:1958


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