]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/orchestrator: Fix Python 3 issues
authorSebastian Wagner <sebastian.wagner@suse.com>
Tue, 18 Sep 2018 13:57:53 +0000 (15:57 +0200)
committerSebastian Wagner <sebastian.wagner@suse.com>
Tue, 9 Oct 2018 09:16:44 +0000 (11:16 +0200)
* `Exception.message` is deprecated.
* Use relative imports.
* `filter` returns an iterator in Py3
* `urlparse` moved.
* `s/log.warn/log.warning`
* Dockerfile: install Py3 versions.

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/pybind/mgr/orchestrator_cli/__init__.py
src/pybind/mgr/orchestrator_cli/module.py
src/pybind/mgr/progress/__init__.py
src/pybind/mgr/rook/__init__.py
src/pybind/mgr/rook/module.py
src/pybind/mgr/rook/rook_cluster.py
src/script/kubejacker/Dockerfile

index 86b0c90fe4bc4d67ff331e64d02671a91b28b29c..1f586a2b54f62edb925912ce36f03506b6c5766b 100644 (file)
@@ -1,2 +1,2 @@
 
-from module import OrchestratorCli
+from .module import OrchestratorCli
index 8c406333425b424ea73dec799fe983f5ac36c932..b727efcfd26d3523bdeedbc53ef3a8d620bfdf5b 100644 (file)
@@ -268,7 +268,7 @@ class OrchestratorCli(MgrModule):
         except NoOrchestrator:
             return -errno.ENODEV, "", "No orchestrator configured"
         except ImportError as e:
-            return -errno.ENOENT, "", e.message
+            return -errno.ENOENT, "", str(e)
         except NotImplementedError:
             return -errno.EINVAL, "", "Command not found"
 
index bd1113bf1b249c376cea515a8fb6817991077895..0f7dab556dcd2e0b17460ace3259669c53b13b0e 100644 (file)
@@ -1,2 +1,2 @@
 
-from module import *
+from .module import *
index 286a1101277eb7ac594463d262f4eb8f219d0a1f..b9f08fc8007eeda3fe50fb781d36823997f9c043 100644 (file)
@@ -1,2 +1,2 @@
 
-from module import RookOrchestrator
+from .module import RookOrchestrator
index dafd1191aa8b28451fd668fae413018ece085606..ec695ad19690194f91d9a9a8ac802cd6d1711130 100644 (file)
@@ -17,7 +17,7 @@ except ImportError:
     client = None
     config = None
 
-from rook_cluster import RookCluster, ApplyException
+from .rook_cluster import RookCluster
 
 
 all_completions = []
@@ -276,8 +276,7 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator):
 
             global all_completions
             self.wait(all_completions)
-            all_completions = filter(lambda x: not x.is_complete,
-                                     all_completions)
+            all_completions = [c for c in all_completions if not c.is_complete]
 
             self._shutdown.wait(5)
 
index b911b513ca5ac8bc10c9caec5bbe4517e2b80f8a..7095a24948c4bf528bc00b2aa83f82477b4a9757 100644 (file)
@@ -7,7 +7,7 @@ call methods.
 This module is runnable outside of ceph-mgr, useful for testing.
 """
 
-import urlparse
+from six.moves.urllib import parse
 import logging
 import json
 
@@ -115,7 +115,7 @@ class RookCluster(object):
                 ROOK_SYSTEM_NS,
                 label_selector=label_selector)
         except ApiException as e:
-            log.warn("Failed to fetch device metadata: {0}".format(e))
+            log.warning("Failed to fetch device metadata: {0}".format(e))
             raise
 
         nodename_to_devices = {}
@@ -356,7 +356,7 @@ class RookCluster(object):
                 "clusters/{0}".format(self.cluster_name),
                 body=patch)
         except ApiException as e:
-            log.exception("API exception: {0}".format(e.message))
+            log.exception("API exception: {0}".format(e))
             raise ApplyException(
                 "Failed to create OSD entries in Cluster CRD: {0}".format(
-                    e.message))
+                    e))
index ed2113a8325461423bc7778d8fe619e9a2f83298..60c7578d8d602db82acb788574ceaa202bc70921 100644 (file)
@@ -12,10 +12,11 @@ ENV TERM linux
 RUN (grep -q rhel /etc/os-release && ( \
         yum install -y python-pip && \
         yum install -y liboath && \
-        yum install -y python-bcrypt librdmacm \
+        yum install -y python-bcrypt librdmacm && \
+        pip install kubernetes==6.0.0 \
     )) || (grep -q suse /etc/os-release && ( \
         zypper --non-interactive --gpg-auto-import-keys install --no-recommends --auto-agree-with-licenses --replacefiles --details \
-            python-pip \
+            python3-kubernetes \
             liboauth-devel \
             python-bcrypt \
             lz4 \
@@ -23,9 +24,6 @@ RUN (grep -q rhel /etc/os-release && ( \
             libopenssl1_1 \
     ))
 
-
-RUN pip install kubernetes==6.0.0
-
 ADD bin.tar.gz /usr/bin/
 ADD lib.tar.gz /usr/lib64/