From: Marcus Watts Date: Wed, 13 Jan 2021 05:17:38 +0000 (-0500) Subject: qa/tasks/vault.py: unzip: try harder to find a working unzip. X-Git-Tag: v17.0.0~10^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ed664a4d0be9ab0a4219eaf38458dba0961b51da;p=ceph.git 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 --- diff --git a/qa/tasks/vault.py b/qa/tasks/vault.py index f81069f4b32..c204cf8f462 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