there is useless 'u' in the wrong info when execute a wrong glance command

Bug #1533090 reported by hgangwx
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Glance Client
Fix Released
Undecided
Jaspreet Singh Rawel

Bug Description

[Summary]
there is useless 'u' in the wrong info when execute a wrong glance command

[Topo]
devstack all-in-one node

[Description and expect result]
no useless 'u' in the wrong info when execute a wrong glance command

[Reproduceable or not]
reproduceable

[Recreate Steps]
1) there is useless 'u' in the wrong info when execute a wrong glance command:
root@45-59:/opt/stack/devstack# glance wrongcmd
usage: glance [--version] [-d] [-v] [--get-schema] [--no-ssl-compression] [-f]
              [--os-image-url OS_IMAGE_URL]
              [--os-image-api-version OS_IMAGE_API_VERSION]
              [--profile HMAC_KEY] [--insecure] [--os-cacert <ca-certificate>]
              [--os-cert <certificate>] [--os-key <key>] [--timeout <seconds>]
              [--os-auth-url OS_AUTH_URL] [--os-domain-id OS_DOMAIN_ID]
              [--os-domain-name OS_DOMAIN_NAME]
              [--os-project-id OS_PROJECT_ID]
              [--os-project-name OS_PROJECT_NAME]
              [--os-project-domain-id OS_PROJECT_DOMAIN_ID]
              [--os-project-domain-name OS_PROJECT_DOMAIN_NAME]
              [--os-trust-id OS_TRUST_ID] [--os-user-id OS_USER_ID]
              [--os-username OS_USERNAME]
              [--os-user-domain-id OS_USER_DOMAIN_ID]
              [--os-user-domain-name OS_USER_DOMAIN_NAME]
              [--os-password OS_PASSWORD] [--key-file OS_KEY]
              [--ca-file OS_CACERT] [--cert-file OS_CERT]
              [--os-tenant-id OS_TENANT_ID] [--os-tenant-name OS_TENANT_NAME]
              [--os-region-name OS_REGION_NAME]
              [--os-auth-token OS_AUTH_TOKEN]
              [--os-service-type OS_SERVICE_TYPE]
              [--os-endpoint-type OS_ENDPOINT_TYPE]
              <subcommand> ...
glance: error: argument <subcommand>: invalid choice: u'wrongcmd' >>>>ISSUE

2)below is a correct example for reference:
root@45-59:/opt/stack/devstack# keystone wrongcmd
usage: keystone [--version] [--debug] [--os-username <auth-user-name>]
                [--os-password <auth-password>]
                [--os-tenant-name <auth-tenant-name>]
                [--os-tenant-id <tenant-id>] [--os-auth-url <auth-url>]
                [--os-region-name <region-name>]
                [--os-identity-api-version <identity-api-version>]
                [--os-token <service-token>]
                [--os-endpoint <service-endpoint>] [--os-cache]
                [--force-new-token] [--stale-duration <seconds>] [--insecure]
                [--os-cacert <ca-certificate>] [--os-cert <certificate>]
                [--os-key <key>] [--timeout <seconds>]
                <subcommand> ...
keystone: error: argument <subcommand>: invalid choice: 'wrongcmd'

[Configration]
reproduceable bug, no need

[logs]
reproduceable bug, no need

[Root cause anlyze or debug inf]
reproduceable bug

[Attachment]
None

Lin Yang (lin-a-yang)
Changed in glance:
assignee: nobody → Lin Yang (lin-a-yang)
the-bling (the-bling)
affects: glance → python-glanceclient
Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

Apparently we're exposing the python representation of a unicode string directly to the CLI. It should be handled a bit better.

Changed in python-glanceclient:
status: New → Triaged
Changed in python-glanceclient:
assignee: Lin Yang (lin-a-yang) → Jaspreet Singh Rawel (jaspreetsinghrawel)
Revision history for this message
Jaspreet Singh Rawel (jaspreetsinghrawel) wrote :

root@controller:/home/ubuntu# glance abcde
usage: glance [--version] [-d] [-v] [--get-schema] [--no-ssl-compression] [-f]
              [--os-image-url OS_IMAGE_URL]
              [--os-image-api-version OS_IMAGE_API_VERSION]
              [--profile HMAC_KEY] [--insecure] [--os-cacert <ca-certificate>]
              [--os-cert <certificate>] [--os-key <key>] [--timeout <seconds>]
              [--os-auth-url OS_AUTH_URL] [--os-domain-id OS_DOMAIN_ID]
              [--os-domain-name OS_DOMAIN_NAME]
              [--os-project-id OS_PROJECT_ID]
              [--os-project-name OS_PROJECT_NAME]
              [--os-project-domain-id OS_PROJECT_DOMAIN_ID]
              [--os-project-domain-name OS_PROJECT_DOMAIN_NAME]
              [--os-trust-id OS_TRUST_ID] [--os-user-id OS_USER_ID]
              [--os-username OS_USERNAME]
              [--os-user-domain-id OS_USER_DOMAIN_ID]
              [--os-user-domain-name OS_USER_DOMAIN_NAME]
              [--os-password OS_PASSWORD] [--key-file OS_KEY]
              [--ca-file OS_CACERT] [--cert-file OS_CERT]
              [--os-tenant-id OS_TENANT_ID] [--os-tenant-name OS_TENANT_NAME]
              [--os-region-name OS_REGION_NAME]
              [--os-auth-token OS_AUTH_TOKEN]
              [--os-service-type OS_SERVICE_TYPE]
              [--os-endpoint-type OS_ENDPOINT_TYPE]
              <subcommand> ...
glance: error: argument <subcommand>: invalid choice: u'abcde' (choose from 'explain', 'image-create', 'image-deactivate', 'image-delete', 'image-download', 'image-list', 'image-reactivate', 'image-show', 'image-tag-delete', 'image-tag-update', 'image-update', 'image-upload', 'location-add', 'location-delete', 'location-update', 'md-namespace-create', 'md-namespace-delete', 'md-namespace-import', 'md-namespace-list', 'md-namespace-objects-delete', 'md-namespace-properties-delete', 'md-namespace-resource-type-list', 'md-namespace-show', 'md-namespace-tags-delete', 'md-namespace-update', 'md-object-create', 'md-object-delete', 'md-object-list', 'md-object-property-show', 'md-object-show', 'md-object-update', 'md-property-create', 'md-property-delete', 'md-property-list', 'md-property-show', 'md-property-update', 'md-resource-type-associate', 'md-resource-type-deassociate', 'md-resource-type-list', 'md-tag-create', 'md-tag-create-multiple', 'md-tag-delete', 'md-tag-list', 'md-tag-show', 'md-tag-update', 'member-create', 'member-delete', 'member-list', 'member-update', 'task-create', 'task-list', 'task-show', 'bash-completion', 'help', 'bash_completion')
root@controller:/home/ubuntu#
root@controller:/home/ubuntu#

Changed in python-glanceclient:
status: Triaged → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-glanceclient (master)

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

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

Reviewed: https://review.openstack.org/408318
Committed: https://git.openstack.org/cgit/openstack/python-glanceclient/commit/?id=81039a1e36dd8d85b14f0753bf6d4de14eaeeb94
Submitter: Jenkins
Branch: master

commit 81039a1e36dd8d85b14f0753bf6d4de14eaeeb94
Author: Ian Cordasco <email address hidden>
Date: Wed Dec 7 15:39:22 2016 -0600

    Handle formatting of subcommand name in error output

    On Python 2, decoding all arguments leads to the possibility that users
    that use the wrong command or mistype the name will see error output
    with a unicode string's representation instead of one without it. To
    avoid this we try and find the first non-option string in the argument
    list and replace it with an string that is not text only on Python 2. If
    we encoded the string at all times, then users installing glanceclient
    on Python 3 would see b'invalid-subcommand' instead. That's as bad as
    seeing u'invalid-subcommand' on Python 2.

    Closes-bug: 1533090
    Change-Id: I018769e159a607ebb233902cbeb13b95ca417190

Changed in python-glanceclient:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-glanceclient (master)

Change abandoned by Ian Cordasco (<email address hidden>) on branch: master
Review: https://review.openstack.org/402058
Reason: The bug this is fixing was marked as fixed and should be in the next release of python-glanceclient.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-glanceclient 2.6.0

This issue was fixed in the openstack/python-glanceclient 2.6.0 release.

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

Other bug subscribers

Remote bug watches

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