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 2168617 - Confusing error message in 'pcs constraint ticket add' when an unknown option is specified
Summary: Confusing error message in 'pcs constraint ticket add' when an unknown option...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: pcs
Version: 9.0
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: 9.3
Assignee: Tomas Jelinek
QA Contact: cluster-qe
URL:
Whiteboard:
Depends On:
Blocks: 2022748
TreeView+ depends on / blocked
 
Reported: 2023-02-09 14:36 UTC by Tomas Jelinek
Modified: 2023-11-07 09:01 UTC (History)
8 users (show)

Fixed In Version: pcs-0.11.5-1.el9
Doc Type: No Doc Update
Doc Text:
This a minor self-documenting bugfix.
Clone Of: 2022748
Environment:
Last Closed: 2023-11-07 08:23:10 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker CLUSTERQE-6634 0 None None None 2023-04-19 22:22:47 UTC
Red Hat Issue Tracker RHELPLAN-148174 0 None None None 2023-02-09 14:37:09 UTC
Red Hat Product Errata RHSA-2023:6316 0 None None None 2023-11-07 08:24:03 UTC

Description Tomas Jelinek 2023-02-09 14:36:47 UTC
+++ This bug was initially created as a clone of Bug #2022748 +++

Description of problem:
When an unknown option name is specified, pcs reports that (which is ok) and lists allowed option names. The list of allowed options contains items which are not meant to be specified as options: rsc (for resource), rsc-role (for resource role) and ticket. These three options are supposed to be specified as positional arguments of the command as is shown in usage:
ticket add <ticket> [<role>] <resource id> [<options>] [id=<constraint-id>]


Version-Release number of selected component (if applicable):
pcs-0.10.11-1.el8


How reproducible:
always, easily


Steps to Reproduce:
1. pcs constraint ticket add ticket1 resource1 unknown=option


Actual results:
Error: invalid option 'x', allowed options are: 'id', 'loss-policy', 'rsc', 'rsc-role', 'ticket'


Expected results:
Error: invalid option 'x', allowed options are: 'id', 'loss-policy'

Comment 1 Tomas Jelinek 2023-02-10 09:08:32 UTC
Upstream patch based on a pull request from a community:
https://github.com/ClusterLabs/pcs/commit/c2cae53d4bac9b6c4c091ba56b7fc74968af3438


Test:
# pcs constraint ticket add ticket d1 unknown=option
Error: invalid option 'unknown', allowed options are: 'id', 'loss-policy'
Error: Errors have occurred, therefore pcs is unable to continue

Comment 3 Michal Pospisil 2023-05-26 09:28:14 UTC
DevTestResults:

[root@r09-03-a ~]# rpm -q pcs
pcs-0.11.5-1.el9.x86_64

[root@r09-03-a ~]# pcs constraint ticket add ticket r1 unknown=option  
Error: invalid option 'unknown', allowed options are: 'id', 'loss-policy'
Error: Errors have occurred, therefore pcs is unable to continue

Comment 7 svalasti 2023-06-13 13:39:36 UTC
## BEFORE

[root@virt-022 ~]# rpm -q pcs
pcs-0.11.4-7.el9_2.x86_64

[root@virt-022 ~]# pcs constraint ticket add -h

Usage: pcs constraint [constraints]...
    ticket add <ticket> [<role>] <resource id> [<options>]
               [id=<constraint-id>]
        Create a ticket constraint for <resource id>.
        Available option is loss-policy=fence/stop/freeze/demote.
        A role can be Promoted, Unpromoted, Started or Stopped.

[root@virt-022 ~]# pcs resource create d1 ocf:heartbeat:Dummy

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

[root@virt-022 ~]# pcs constraint ticket add ticket1 d1 invalid-option=false
Error: invalid option 'invalid-option', allowed options are: 'id', 'loss-policy', 'rsc', 'rsc-role', 'ticket'

> When an unknown option is specified, then the list of allowed options contains positional arguments such as resource, resource-role and ticket.


## AFTER

[root@virt-525 ~]# rpm -q pcs
pcs-0.11.5-2.el9.x86_64

[root@virt-525 ~]# pcs constraint ticket add -h

Usage: pcs constraint [constraints]...
    ticket add <ticket> [<role>] <resource id> [<options>]
               [id=<constraint-id>]
        Create a ticket constraint for <resource id>.
        Available option is loss-policy=fence/stop/freeze/demote.
        A role can be Promoted, Unpromoted, Started or Stopped.

[root@virt-525 ~]# pcs resource create d1 ocf:heartbeat:Dummy

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


A.) Checking the error message in case of entering an invalid option

[root@virt-525 ~]# pcs constraint ticket add ticket1 d1 invalid-option=false
Error: invalid option 'invalid-option', allowed options are: 'id', 'loss-policy'
Error: Errors have occurred, therefore pcs is unable to continue

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

> OK.


B.) Checking the error message in case of entering valid option with invalid value

[root@virt-525 ~]# pcs constraint ticket add ticket1 d1 loss-policy=9
Error: '9' is not a valid loss-policy value, use 'demote', 'fence', 'freeze', 'stop'
Error: Errors have occurred, therefore pcs is unable to continue

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

> OK.


C.) Checking the error message in case of entering valid option with invalid option

[root@virt-525 ~]# pcs constraint ticket add ticket1 d1 loss-policy=stop invalid-option=false
Error: invalid option 'invalid-option', allowed options are: 'id', 'loss-policy'
Error: Errors have occurred, therefore pcs is unable to continue

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

> OK.


D.) Checking results in case of entering valid option

[root@virt-525 ~]# pcs constraint ticket add ticket1 d1 loss-policy=stop

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

[root@virt-525 ~]# pcs constraint ticket
Ticket Constraints:
  resource 'd1' depends on ticket 'ticket1'
    loss-policy=stop

> OK.

> Marking as VERIFIED for pcs-0.11.5-2.el9.x86_64

Comment 11 errata-xmlrpc 2023-11-07 08:23:10 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 (Low: 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-2023:6316


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