From ed664a4d0be9ab0a4219eaf38458dba0961b51da Mon Sep 17 00:00:00 2001 From: Marcus Watts Date: Wed, 13 Jan 2021 00:17:38 -0500 Subject: [PATCH] qa/tasks/vault.py: unzip: try harder to find a working unzip. The existing logic uses "python -m zipfile" to unzip files. This will (most likely) fail on CentOS 8-Stream , where python defaults to 'unset' (see man unversioned-python). So: try harder: try unzip, python3, and python in that order, to find something that can unzip files. Fixes: https://tracker.ceph.com/issues/48921 Signed-off-by: Marcus Watts --- qa/tasks/vault.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/qa/tasks/vault.py b/qa/tasks/vault.py index f81069f4b3225..c204cf8f46261 100644 --- a/qa/tasks/vault.py +++ b/qa/tasks/vault.py @@ -14,7 +14,7 @@ from urllib.parse import urljoin from teuthology import misc as teuthology from teuthology import contextutil from teuthology.orchestra import run -from teuthology.exceptions import ConfigError +from teuthology.exceptions import ConfigError, CommandFailedError log = logging.getLogger(__name__) @@ -65,8 +65,20 @@ def download(ctx, config): log.info('Extracting vault...') ctx.cluster.only(client).run(args=['mkdir', '-p', install_dir]) # Using python in case unzip is not installed on hosts - ctx.cluster.only(client).run( - args=['python', '-m', 'zipfile', '-e', install_zip, install_dir]) + # Using python3 in case python is not installed on hosts + failed=True + for f in [ + lambda z,d: ['unzip', z, '-d', d], + lambda z,d: ['python3', '-m', 'zipfile', '-e', z, d], + lambda z,d: ['python', '-m', 'zipfile', '-e', z, d]]: + try: + ctx.cluster.only(client).run(args=f(install_zip, install_dir)) + failed = False + break + except CommandFailedError as e: + failed = e + if failed: + raise failed try: yield -- 2.39.5