From: Kyr Shatskyy Date: Mon, 18 Nov 2019 15:49:25 +0000 (+0100) Subject: task/install: py3 compat X-Git-Tag: 1.1.0~192^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=76bdde9bf463cb4c1498ddf9b9849e4331c0f126;p=teuthology.git task/install: py3 compat Signed-off-by: Kyr Shatskyy --- diff --git a/teuthology/task/install/__init__.py b/teuthology/task/install/__init__.py index 1e6fd1bc6..dac97d492 100644 --- a/teuthology/task/install/__init__.py +++ b/teuthology/task/install/__init__.py @@ -155,8 +155,8 @@ def get_package_list(ctx, config): rpms = config.get('packages', dict()).get('rpm', default_rpms) # Optionally include or exclude debug packages if not debug: - debs = filter(lambda p: not p.endswith('-dbg'), debs) - rpms = filter(lambda p: not p.endswith('-debuginfo'), rpms) + debs = [p for p in debs if not p.endswith('-dbg')] + rpms = [p for p in rpms if not p.endswith('-debuginfo')] def exclude(pkgs, exclude_list): return list(pkg for pkg in pkgs if pkg not in exclude_list) @@ -275,7 +275,8 @@ def upgrade_remote_to_config(ctx, config): if not remotes_dict: # This is a regular config argument, not a role continue - remote = remotes_dict.keys()[0] + # take any remote in the dict + remote = next(iter(remotes_dict)) if remote in remotes: log.warn('remote %s came up twice (role %s)', remote, role) continue diff --git a/teuthology/test/task/test_install.py b/teuthology/test/task/test_install.py index 13892957a..0334d685e 100644 --- a/teuthology/test/task/test_install.py +++ b/teuthology/test/task/test_install.py @@ -16,14 +16,10 @@ class TestInstall(object): ) pkgs = yaml.safe_load(open(path))[project] if not debug: - pkgs['deb'] = filter( - lambda p: not p.endswith('-dbg'), - pkgs['deb'] - ) - pkgs['rpm'] = filter( - lambda p: not p.endswith('-debuginfo'), - pkgs['rpm'] - ) + pkgs['deb'] = [p for p in pkgs['deb'] + if not p.endswith('-dbg')] + pkgs['rpm'] = [p for p in pkgs['rpm'] + if not p.endswith('-debuginfo')] return pkgs def test_get_package_list_debug(self):