'swift stat' prints exception trace when auth fails

Bug #1372589 reported by Alistair Coles
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
python-swiftclient
Fix Released
Undecided
Unassigned

Bug Description

Regression in swiftclient: previously failed authentication generated helpful output, now it results in exception traces.

Similarly if auth succeeds but container not found using 'swift stat container'

BEFORE:

anc@u128:~/0dev/swiftclient$ swift --os-auth-url=http://foo.com --os-username=foo --os-password=foo stat
No tenant specified

anc@u128:~/0dev/swiftclient$ swift --os-auth-url=http://foo.com --os-username=foo --os-password=foo stat c1
No tenant specified

AFTER:
anc@u128:~/0dev/swiftclient$ git checkout master
Previous HEAD position was d97ec37... Merge "fixed unit tests when env vars are set"
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 143 commits.

anc@u128:~/0dev/swiftclient$ git log -n 1
commit 8f1b394325804c23ac18e7f9da6cb56a3b95eed2
Author: Pete Zaitcev <email address hidden>
Date: Wed Sep 17 20:27:05 2014 -0600
<snip>

anc@u128:~/0dev/swiftclient$ swift --os-auth-url=http://foo.com --os-username=foo --os-password=foo stat
Traceback (most recent call last):
  File "/usr/local/bin/swift", line 8, in <module>
    execfile(__file__)
  File "/anc/0dev/swiftclient/bin/swift", line 24, in <module>
    sys.exit(main())
  File "/anc/0dev/swiftclient/swiftclient/shell.py", line 1287, in main
    globals()['st_%s' % args[0]](parser, argv[1:], output)
  File "/anc/0dev/swiftclient/swiftclient/shell.py", line 492, in st_stat
    stat_result = swift.stat()
  File "/anc/0dev/swiftclient/swiftclient/service.py", line 427, in stat
    raise SwiftError('Account not found', exc=err)
swiftclient.service.SwiftError: 'Account not found'

anc@u128:~/0dev/swiftclient$ swift --os-auth-url=http://foo.com --os-username=foo --os-password=foo stat c1
Traceback (most recent call last):
  File "/usr/local/bin/swift", line 8, in <module>
    execfile(__file__)
  File "/anc/0dev/swiftclient/bin/swift", line 24, in <module>
    sys.exit(main())
  File "/anc/0dev/swiftclient/swiftclient/shell.py", line 1287, in main
    globals()['st_%s' % args[0]](parser, argv[1:], output)
  File "/anc/0dev/swiftclient/swiftclient/shell.py", line 508, in st_stat
    items = stat_result['items']
KeyError: 'items'

Revision history for this message
Alistair Coles (alistair-coles) wrote :

Looks like the regression is due to this patch:

commit 24673f8d19fe2f48964f528369081c37e880ec47
Author: Joel Wright <email address hidden>
Date: Fri Apr 4 21:13:01 2014 +0200

    Add importable SwiftService incorporating shell.py logic

    This patch adds a SwiftService class that incorporates the high
    level logic from swiftclient/shell.py. It also ports shell.py to
    use the new class, and updates the code in swiftclient/multithreading.py
    to allow the SwiftService to be used for multiple operations whilst
    using only one thread pool.

    Currently, code that imports swiftclient has to have its own logic for
    things like creating large objects, parallel uploads, and parallel
    downloads. This patch adds a SwiftService class that makes that
    functionality available in Python code as well as through the shell.

    Change-Id: I08c5796b4c01001d79fd571651c3017c16462ffd
    Implements: blueprint bin-swift-logic-as-importable-library

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to python-swiftclient (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/125407

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-swiftclient (master)

Reviewed: https://review.openstack.org/125407
Committed: https://git.openstack.org/cgit/openstack/python-swiftclient/commit/?id=025da14326d29051119fff50424748e41bf4be42
Submitter: Jenkins
Branch: master

commit 025da14326d29051119fff50424748e41bf4be42
Author: Daniel Wakefield <email address hidden>
Date: Mon Oct 20 18:00:01 2014 +0100

    Replaces Stacktraces with useful error messages.

    Changed the message shown when a user doesn't enter project/tenant
    id/name to be more informative.

    When attempting to stat a container without supplying project/tenant
    name or id, an empty response was being returned instead of an error
    being raised.

    Changed the error raised in swiftclient.client when no tenant or project
    is specified to be more specific.

    Add tests for basic regression checking.

    Closes-Bug: #1372589

    Change-Id: I4eb6964d9f1702db119cc0294edc02841b1ecd5f

Changed in python-swiftclient:
status: New → Fix Committed
Changed in python-swiftclient:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-swiftclient 2.4.0

This issue was fixed in the openstack/python-swiftclient 2.4.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.