From ded504600fb8d5c80a5b535906bfeaf0dbfaaf5b Mon Sep 17 00:00:00 2001 From: David Goetz Date: Fri, 4 Jan 2013 11:09:29 -0800 Subject: [PATCH] Allow actual paths to work for swift-get-nodes Change-Id: I29f9ab73c8ca2a3c52247fb92ef951dd5b5246cb --- bin/swift-get-nodes | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/swift-get-nodes b/bin/swift-get-nodes index fcf45ae77b..8c0b8ac582 100755 --- a/bin/swift-get-nodes +++ b/bin/swift-get-nodes @@ -34,6 +34,8 @@ if (len(args) < 2 or len(args) > 4) and \ print 'Usage: %s [-a] [] []' \ % sys.argv[0] print ' Or: %s [-a] -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] @@ -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