Invalid Error message in case of sub-command non-existence.

Bug #1640031 reported by Ali Jabbar
22
This bug affects 5 people
Affects Status Importance Assigned to Milestone
cliff
Fix Released
Undecided
Jaspreet Singh Rawel

Bug Description

There is an issue while printing the logs when sub command is not exists
------------------------------------------------------------------------
root@cinv-V:/home/cinv/devstack# openstack server abc
openstack: 'server' is not an openstack command. See 'openstack --help'.
Did you mean one of these?
  server add security group
  server add volume
------------------------------------------------------------------------
While debugging issue , https://bugs.launchpad.net/python-heatclient/+bug/1571966
We found that there is an issue in the cliff code : cliff/app.py.
def run_subcommand(self, argv):

>>> here always it is printing "argv[0]" in the error message which is misleading information.

Changed in python-cliff:
status: New → Confirmed
Revision history for this message
Jaspreet Singh Rawel (jaspreetsinghrawel) wrote :

Problem reproduced in cliff version 1.15.0. It is always showing first subcommand of openstack command as invalid command in the log message.

##########
In the below example, I intentionally misspelled "group" as "grou". It is showing "security" subcommand as invalid instead of showing "grou".
##########

root@controller:/usr/lib/python2.7/dist-packages# openstack security grou list
No handlers could be found for logger "openstackclient.shell"
openstack: 'security' is not an openstack command. See 'openstack --help'.
Did you mean one of these?
  security group create
  security group delete
  security group list
  security group rule create
  security group rule delete
  security group rule list
  security group rule show
  security group set
  security group show
  secret container create
  secret container delete
  secret container get
  secret container list
  secret delete
  secret get
  secret list
  secret order create
  secret order delete
  secret order get
  secret order list
  secret store
  secret update
root@controller:/usr/lib/python2.7/dist-packages#

###########
In the below example, I intentionally misspelled "list" as "lst". It is showing "security" subcommand as invalid instead of showing "lst".
###########

root@controller:/usr/lib/python2.7/dist-packages# openstack security group lst
No handlers could be found for logger "openstackclient.shell"
openstack: 'security' is not an openstack command. See 'openstack --help'.
Did you mean one of these?
  security group create
  security group delete
  security group list
  security group rule create
  security group rule delete
  security group rule list
  security group rule show
  security group set
  security group show
  secret container create
  secret container delete
  secret container get
  secret container list
  secret delete
  secret get
  secret list
  secret order create
  secret order delete
  secret order get
  secret order list
  secret store
  secret update
root@controller:/usr/lib/python2.7/dist-packages#

Changed in python-cliff:
assignee: nobody → Jaspreet Singh Rawel (jaspreetsinghrawel)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cliff (master)

Fix proposed to branch: master
Review: https://review.openstack.org/394884

Changed in python-cliff:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cliff (master)

Reviewed: https://review.openstack.org/394884
Committed: https://git.openstack.org/cgit/openstack/cliff/commit/?id=6205b24fc892e8d25148a2e8964b31d485c3da24
Submitter: Jenkins
Branch: master

commit 6205b24fc892e8d25148a2e8964b31d485c3da24
Author: Jaspreet Singh Rawel <email address hidden>
Date: Tue Nov 8 15:36:06 2016 +0530

    Show entire command in error message

    Currently only the first argument is shown in the error message.
    In case of a multiword command, only first part is shown.
    e.g When "openstack security grou list" command is run,
    "security" subcommand is shown as invalid. This conveys a
    wrong message to the user.

    Closes-Bug: 1640031

    Change-Id: I748ce46835638916279edead894e3f32c12abd51

Changed in python-cliff:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cliff 2.3.0

This issue was fixed in the openstack/cliff 2.3.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.