]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/vault.py: unzip: try harder to find a working unzip. 39008/head
authorMarcus Watts <mwatts@redhat.com>
Wed, 13 Jan 2021 05:17:38 +0000 (00:17 -0500)
committerMarcus Watts <mwatts@redhat.com>
Thu, 21 Jan 2021 17:35:01 +0000 (12:35 -0500)
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 <mwatts@redhat.com>
qa/tasks/vault.py

index f81069f4b322523ebceb34321ba365d40160a481..c204cf8f462617d8483de6bef6801f01a662a847 100644 (file)
@@ -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