From: Patrick Donnelly Date: Wed, 17 Jul 2019 18:14:31 +0000 (-0700) Subject: script/ptl-tool: update for python3 X-Git-Tag: v15.1.0~2180^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F29095%2Fhead;p=ceph.git script/ptl-tool: update for python3 Signed-off-by: Patrick Donnelly --- diff --git a/src/script/ptl-tool.py b/src/script/ptl-tool.py index 6d37467477b..569d2746c8b 100755 --- a/src/script/ptl-tool.py +++ b/src/script/ptl-tool.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/python3 # README: # @@ -215,8 +215,8 @@ def build_branch(args): log.info("Detaching HEAD onto base: {}".format(base)) try: base_path = args.base_path + base - base = filter(lambda r: r.path == base_path, G.refs)[0] - except IndexError: + base = next(ref for ref in G.refs if ref.path == base_path) + except StopIteration: log.error("Branch " + base + " does not exist!") sys.exit(1)