From 99412d48309e071eb190a2f4735df577a22cdb87 Mon Sep 17 00:00:00 2001 From: cheng Date: Sat, 18 Mar 2017 03:43:32 +0000 Subject: [PATCH] fix get ring name replace ring_name = basename(ring_path)[:len('ring.gz')] with ring_name = basename(ring_path)[:-len('.ring.gz')] Change-Id: I741e46d116c8fc7c2e91a51da4284302eec3aa41 Closes-bug: #1668736 --- bin/swift-get-nodes | 2 +- swift/cli/info.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/swift-get-nodes b/bin/swift-get-nodes index 9d09517487..e1744274f3 100644 --- a/bin/swift-get-nodes +++ b/bin/swift-get-nodes @@ -59,7 +59,7 @@ if __name__ == '__main__': ring = ring_name = None if ring_path: - ring_name = basename(ring_path)[:len('ring.gz')] + ring_name = basename(ring_path)[:-len('.ring.gz')] ring = Ring(ring_path) try: diff --git a/swift/cli/info.py b/swift/cli/info.py index c61ee2fe6c..5c8fb805be 100644 --- a/swift/cli/info.py +++ b/swift/cli/info.py @@ -49,7 +49,7 @@ def parse_get_node_args(options, args): if options.policy_name: if POLICIES.get_by_name(options.policy_name) is None: raise InfoSystemExit('No policy named %r' % options.policy_name) - elif args and args[0].endswith('ring.gz'): + elif args and args[0].endswith('.ring.gz'): if os.path.exists(args[0]): ring_path = args.pop(0) else: