Skip to content

Commit

Permalink
Allow actual paths to work for swift-get-nodes
Browse files Browse the repository at this point in the history
Change-Id: I29f9ab73c8ca2a3c52247fb92ef951dd5b5246cb
  • Loading branch information
dpgoetz committed Jan 4, 2013
1 parent dc8d0e0 commit ded5046
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bin/swift-get-nodes
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ if (len(args) < 2 or len(args) > 4) and \
print 'Usage: %s [-a] <ring.gz> <account> [<container>] [<object>]' \
% sys.argv[0]
print ' Or: %s [-a] <ring.gz> -p partition' % sys.argv[0]
print ' Note: account, container, object can also be a single arg ' \
'separated by /'
print 'Shows the nodes responsible for the item specified.'
print 'Example:'
print ' $ %s /etc/swift/account.ring.gz MyAccount' % sys.argv[0]
Expand All @@ -45,6 +47,11 @@ if (len(args) < 2 or len(args) > 4) and \
print ' 10.1.5.9:8000 sdt1 # [Handoff]'
sys.exit(1)

if len(args) == 2 and '/' in args[1]:
# Parse single path arg, as noted in above help text.
path = args[1].lstrip('/')
args = [args[0]] + [p for p in path.split('/', 2) if p]

ringloc = None
account = None
container = None
Expand Down

0 comments on commit ded5046

Please sign in to comment.