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 2102663 - 'pcs resource restart' fails with a traceback
Summary: 'pcs resource restart' fails with a traceback
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: pcs
Version: 9.1
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: rc
: 9.1
Assignee: Tomas Jelinek
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-06-30 12:19 UTC by Tomas Jelinek
Modified: 2022-11-15 10:04 UTC (History)
9 users (show)

Fixed In Version: pcs-0.11.3-2.el9
Doc Type: No Doc Update
Doc Text:
the affected packages have not been released
Clone Of:
Environment:
Last Closed: 2022-11-15 09:49:31 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-126734 0 None None None 2022-06-30 12:22:43 UTC
Red Hat Product Errata RHSA-2022:7935 0 None None None 2022-11-15 09:49:35 UTC

Description Tomas Jelinek 2022-06-30 12:19:51 UTC
Description of problem:
'pcs resource restart' fails with a traceback


Version-Release number of selected component (if applicable):
pcs-0.11.2-1.el9


How reproducible:
always, easily


Steps to Reproduce:
run 'pcs resource restart' for any existing resource


Actual results:
pcs fails with a traceback


Expected results:
pcs restarts the specified resource


Additional info:
the affected packages have not been released

Comment 2 Tomas Jelinek 2022-07-01 07:35:22 UTC
Upstream patch: https://github.com/ClusterLabs/pcs/commit/08a62b6e84db56cc3871c81826a420e22f726a65

see comment 0 for a test / reproducer

Comment 3 Miroslav Lisik 2022-07-15 14:50:01 UTC
DevTestResults:

[root@r90-node-01 ~]# rpm -q pcs
pcs-0.11.3-2.el9.x86_64

[root@r90-node-01 ~]# pcs resource restart d1
d1 successfully restarted

Comment 8 svalasti 2022-07-26 09:16:34 UTC
### BEFORE

[root@virt-044 ~]# rpm -q pcs
pcs-0.11.2-1.el9.x86_64


1.) 'Dummy' resource

[root@virt-044 ~]# pcs resource status | grep "d1"
  * d1	(ocf:heartbeat:Dummy):	 Started virt-044

[root@virt-044 ~]# pcs resource restart d1
Traceback (most recent call last):
  File "/usr/sbin/pcs", line 33, in <module>
    sys.exit(load_entry_point('pcs===0.11.2.44-9da7', 'console_scripts', 'pcs')())
  File "/usr/lib/python3.9/site-packages/pcs/app.py", line 273, in main
    routing.create_router(cmd_map, [])(
  File "/usr/lib/python3.9/site-packages/pcs/cli/common/routing.py", line 33, in _router
    return cmd_map[sub_cmd](lib, argv_next, modifiers)
  File "/usr/lib/python3.9/site-packages/pcs/cli/common/routing.py", line 33, in _router
    return cmd_map[sub_cmd](lib, argv_next, modifiers)
  File "/usr/lib/python3.9/site-packages/pcs/resource.py", line 2603, in resource_restart
    _check_is_not_stonith(lib, [argv[0]])
UnboundLocalError: local variable 'lib' referenced before assignment

[root@virt-044 ~]# echo $?
1


2.) Clone

[root@virt-044 ~]# pcs status | grep "d1" -A 1
  * Clone Set: d1-clone [d1]:
    * Started: [ virt-044 virt-045 ]

[root@virt-044 ~]# pcs resource restart d1-clone
Traceback (most recent call last):
  File "/usr/sbin/pcs", line 33, in <module>
    sys.exit(load_entry_point('pcs===0.11.2.44-9da7', 'console_scripts', 'pcs')())
  File "/usr/lib/python3.9/site-packages/pcs/app.py", line 273, in main
    routing.create_router(cmd_map, [])(
  File "/usr/lib/python3.9/site-packages/pcs/cli/common/routing.py", line 33, in _router
    return cmd_map[sub_cmd](lib, argv_next, modifiers)
  File "/usr/lib/python3.9/site-packages/pcs/cli/common/routing.py", line 33, in _router
    return cmd_map[sub_cmd](lib, argv_next, modifiers)
  File "/usr/lib/python3.9/site-packages/pcs/resource.py", line 2603, in resource_restart
    _check_is_not_stonith(lib, [argv[0]])
UnboundLocalError: local variable 'lib' referenced before assignment

[root@virt-044 ~]# echo $?
1


3.) Promotable clone

[root@virt-044 ~]# pcs status | grep "s1" -A 2
  * Clone Set: s1-clone [s1] (promotable):
    * Promoted: [ virt-044 ]
    * Unpromoted: [ virt-045 ]

[root@virt-044 ~]# pcs resource restart s1-clone
Traceback (most recent call last):
  File "/usr/sbin/pcs", line 33, in <module>
    sys.exit(load_entry_point('pcs===0.11.2.44-9da7', 'console_scripts', 'pcs')())
  File "/usr/lib/python3.9/site-packages/pcs/app.py", line 273, in main
    routing.create_router(cmd_map, [])(
  File "/usr/lib/python3.9/site-packages/pcs/cli/common/routing.py", line 33, in _router
    return cmd_map[sub_cmd](lib, argv_next, modifiers)
  File "/usr/lib/python3.9/site-packages/pcs/cli/common/routing.py", line 33, in _router
    return cmd_map[sub_cmd](lib, argv_next, modifiers)
  File "/usr/lib/python3.9/site-packages/pcs/resource.py", line 2603, in resource_restart
    _check_is_not_stonith(lib, [argv[0]])
UnboundLocalError: local variable 'lib' referenced before assignment

[root@virt-044 ~]# echo $?
1


4.) Group

[root@virt-044 ~]# pcs status | grep "dg" -A 2
  * Resource Group: dg:
    * d1	(ocf:heartbeat:Dummy):	 Started virt-044
    * d2	(ocf:heartbeat:Dummy):	 Started virt-044

[root@virt-044 ~]# pcs resource restart dg
Traceback (most recent call last):
  File "/usr/sbin/pcs", line 33, in <module>
    sys.exit(load_entry_point('pcs===0.11.2.44-9da7', 'console_scripts', 'pcs')())
  File "/usr/lib/python3.9/site-packages/pcs/app.py", line 273, in main
    routing.create_router(cmd_map, [])(
  File "/usr/lib/python3.9/site-packages/pcs/cli/common/routing.py", line 33, in _router
    return cmd_map[sub_cmd](lib, argv_next, modifiers)
  File "/usr/lib/python3.9/site-packages/pcs/cli/common/routing.py", line 33, in _router
    return cmd_map[sub_cmd](lib, argv_next, modifiers)
  File "/usr/lib/python3.9/site-packages/pcs/resource.py", line 2603, in resource_restart
    _check_is_not_stonith(lib, [argv[0]])
UnboundLocalError: local variable 'lib' referenced before assignment

[root@virt-044 ~]# echo $?
1


## AFTER

[root@virt-044 ~]# rpm -q pcs
pcs-0.11.3-2.el9.x86_64


1.) 'Dummy' resource

[root@virt-044 ~]# pcs resource status | grep "d1"
  * d1	(ocf:heartbeat:Dummy):	 Started virt-044

[root@virt-044 ~]# pcs resource restart d1
d1 successfully restarted

[root@virt-044 ~]# echo $?
0

> OK


2.) Clone

[root@virt-044 ~]# pcs status | grep "d1" -A 1
  * Clone Set: d1-clone [d1]:
    * Started: [ virt-044 virt-045 ]


A.) Restart on all cluster nodes

[root@virt-044 ~]# pcs resource restart d1-clone
d1-clone successfully restarted

[root@virt-044 ~]# echo $?
0

> OK.


B.) Restart on specified node

[root@virt-044 ~]# pcs resource restart d1-clone virt-045
d1-clone successfully restarted

[root@virt-044 ~]# echo $?
0

> OK.


3.) Promotable clone

[root@virt-044 ~]# pcs status | grep "s1" -A 2
  * Clone Set: s1-clone [s1] (promotable):
    * Promoted: [ virt-044 ]
    * Unpromoted: [ virt-045 ]


A.) Restart on all cluster nodes

[root@virt-044 ~]# pcs resource restart s1-clone
s1-clone successfully restarted

[root@virt-044 ~]# echo $?
0

> OK


B.) Restart promoted

[root@virt-044 ~]# pcs resource restart s1-clone virt-044
s1-clone successfully restarted

[root@virt-044 ~]# echo $?
0

> OK.


C.) Restart unpromoted

[root@virt-044 ~]# pcs resource restart s1-clone virt-045
s1-clone successfully restarted

[root@virt-044 ~]# echo $?
0

> OK.


4.) Group

[root@virt-044 ~]# pcs status | grep "dg" -A 2
  * Resource Group: dg:
    * d1	(ocf:heartbeat:Dummy):	 Started virt-044
    * d2	(ocf:heartbeat:Dummy):	 Started virt-044


A.) Restarting the group 

[root@virt-044 ~]# pcs resource restart dg
dg successfully restarted

[root@virt-044 ~]# echo $?
0

> OK


B.) Restarting resource in group

[root@virt-044 ~]# pcs resource restart d2
d2 successfully restarted

[root@virt-044 ~]# echo $?
0

> OK.

Comment 10 errata-xmlrpc 2022-11-15 09:49:31 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 (Moderate: pcs security, bug fix, and enhancement update), 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/RHSA-2022:7935


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