swift-get-nodes arg parsing for missing ring is bad

Bug #1539275 reported by clayg
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Fix Released
Low
Sachin

Bug Description

Can *you* spot the error in the first argument to this command:

    $ swift-get-nodes /etc/swift/object.tar.gz account container object
    Traceback (most recent call last):
      File "/usr/local/bin/swift-get-nodes", line 6, in <module>
        exec(compile(open(__file__).read(), __file__, 'exec'))
      File "/vagrant/swift/bin/swift-get-nodes", line 81, in <module>
        print_item_locations(ring, ring_name, *args, **vars(options))
    TypeError: print_item_locations() takes at most 5 arguments (10 given)

Yeah, me either! And the traceback wasn't not really helpful at identifying "ring does not exist"

I *think* it's trying to turn /etc/swift/object.tar.gz into an account named /etc a container named /swift and an object named object.tar.gz because there is no file on the filesystem /etc/swift/object.tar.gz - but that logic can't be right

There's a lot of ways to call this command, policy by ring, policy by option, discover policy *from* ring, discover ring *from* policy - then you have "account container object" or "[/]account/container/object"

I'm not really sure if we can rid of any of those signatures - but maybe if we enumerate all the various call signatures we can decide if there is some way to discover what the use intended.

Either way it can't be helpful that we ever pass in a bogus call signature to print_item_locations and let a traceback out!

Mingyu Li (mingyu-li-cn)
Changed in swift:
assignee: nobody → Mingyu Li (mingyu-li-cn)
Mingyu Li (mingyu-li-cn)
Changed in swift:
assignee: Mingyu Li (mingyu-li-cn) → nobody
Mingyu Li (mingyu-li-cn)
Changed in swift:
assignee: nobody → Mingyu Li (mingyu-li-cn)
Changed in swift:
assignee: Mingyu Li (mingyu-li-cn) → Annapoornima Koppad (annakoppad)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to swift (master)

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

Sachin (sacpatil)
Changed in swift:
status: New → Confirmed
Sachin (sacpatil)
Changed in swift:
status: Confirmed → In Progress
assignee: Annapoornima Koppad (annakoppad) → Sachin (sacpatil)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on swift (master)

Change abandoned by Sachin Patil (<email address hidden>) on branch: master
Review: https://review.openstack.org/334238
Reason: New commit at
https://review.openstack.org/349187

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to swift (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on swift (master)

Change abandoned by Sachin Patil (<email address hidden>) on branch: master
Review: https://review.openstack.org/349187
Reason: https://review.openstack.org/349199

Revision history for this message
Sachin (sacpatil) wrote :
clayg (clay-gerrard)
tags: added: fixed-in-gerrit
Sachin (sacpatil)
Changed in swift:
status: In Progress → Fix Committed
Sachin (sacpatil)
Changed in swift:
status: Fix Committed → In Progress
Revision history for this message
Sachin (sacpatil) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to swift (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on swift (master)

Change abandoned by Sachin Patil (<email address hidden>) on branch: master
Review: https://review.openstack.org/349199

Revision history for this message
Sachin (sacpatil) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to swift (master)

Reviewed: https://review.openstack.org/406012
Committed: https://git.openstack.org/cgit/openstack/swift/commit/?id=f713bb135224b45b16f054a9d90448fd0bebce67
Submitter: Jenkins
Branch: master

commit f713bb135224b45b16f054a9d90448fd0bebce67
Author: Sachin Patil <email address hidden>
Date: Sat Jul 30 10:40:03 2016 +0000

    Fix swift-get-nodes arg parsing for missing ring

    - Verify .ring.gz path exist if ring file is the first argument.
    - Code Refactoring:
      - swift/cli/info.parse_get_node_args()
      - Respective test cases for info.parse_get_node_args()

    Closes-Bug: #1539275

    Change-Id: I0a41936d6b75c60336be76f8702fd616d74f1545
    Signed-off-by: Sachin Patil <email address hidden>

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

This issue was fixed in the openstack/swift 2.13.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.