]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr: use relative import
authorKefu Chai <kchai@redhat.com>
Thu, 8 Feb 2018 10:55:37 +0000 (18:55 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 11 Feb 2018 06:11:38 +0000 (14:11 +0800)
* in python3, we cannot assume default relative import. instead, we should
  be explicit. also, only import the `Module` and `StandbyModule` classes
  from plugins, as they are what we are interested.
* and import urllib.parse in python3.

Fixes: http://tracker.ceph.com/issues/22880
Signed-off-by: Kefu Chai <kchai@redhat.com>
18 files changed:
src/pybind/mgr/balancer/__init__.py
src/pybind/mgr/dashboard/__init__.py
src/pybind/mgr/dashboard/cephfs_clients.py
src/pybind/mgr/dashboard/module.py
src/pybind/mgr/dashboard/rbd_iscsi.py
src/pybind/mgr/dashboard/rbd_ls.py
src/pybind/mgr/dashboard/rbd_mirroring.py
src/pybind/mgr/dashboard/rgw.py
src/pybind/mgr/influx/__init__.py
src/pybind/mgr/localpool/__init__.py
src/pybind/mgr/prometheus/__init__.py
src/pybind/mgr/restful/__init__.py
src/pybind/mgr/restful/api/__init__.py
src/pybind/mgr/restful/hooks.py
src/pybind/mgr/restful/module.py
src/pybind/mgr/selftest/__init__.py
src/pybind/mgr/status/__init__.py
src/pybind/mgr/zabbix/__init__.py

index 79f5b86fd50451f25ab12f6ec9f4896948e32fdc..8f210ac9247ea49624b20582ca8206e56055fbcd 100644 (file)
@@ -1,2 +1 @@
-
-from module import *  # NOQA
+from .module import Module
index 79f5b86fd50451f25ab12f6ec9f4896948e32fdc..5d6e417e4d85215b434c1b4a97fc7c1a30e255e8 100644 (file)
@@ -1,2 +1,2 @@
 
-from module import *  # NOQA
+from .module import Module, StandbyModule
index 40d79713f3b55f5b8be902d88fc41330767333fb..ebbb556abcfb9d9da906f6212e2ff20d39220681 100644 (file)
@@ -2,7 +2,7 @@
 import json
 
 from mgr_module import CommandResult
-from remote_view_cache import RemoteViewCache
+from .remote_view_cache import RemoteViewCache
 
 
 class CephFSClients(RemoteViewCache):
index 67f079500db8c6ac5983043877e68928af209326..213f05f0319e7fc73b7801dbea6650f98c24a74c 100644 (file)
@@ -26,18 +26,21 @@ import socket
 
 import cherrypy
 import jinja2
-import urlparse
+try:
+    import urlparse
+except ImportError:
+    import urllib.parse as urlparse
 
 from mgr_module import MgrModule, MgrStandbyModule, CommandResult
 
-from types import OsdMap, NotFound, Config, FsMap, MonMap, \
+from .types import OsdMap, NotFound, Config, FsMap, MonMap, \
     PgSummary, Health, MonStatus
 
-import rbd_iscsi
-import rbd_mirroring
-from rbd_ls import RbdLs, RbdPoolLs
-from cephfs_clients import CephFSClients
-from rgw import RGWDaemons
+from . import rbd_iscsi
+from . import rbd_mirroring
+from .rbd_ls import RbdLs, RbdPoolLs
+from .cephfs_clients import CephFSClients
+from .rgw import RGWDaemons
 
 log = logging.getLogger("dashboard")
 
index 6f5e75ed1804a80110069a99d077a05ffc9bdcc7..c7882738ae26e7149c9a96a48e3d58d4ede7297e 100644 (file)
@@ -1,7 +1,7 @@
 
 import rados
 import rbd
-from remote_view_cache import RemoteViewCache
+from .remote_view_cache import RemoteViewCache
 
 SERVICE_TYPE = 'tcmu-runner'
 
index 96d362e3467c14e5ab71b88f57c40dc767eda13a..d6d88c30717f1c6a21824018f8460c68d1704705 100644 (file)
@@ -1,8 +1,8 @@
 
 import rbd
 import rados
-from types import OsdMap
-from remote_view_cache import RemoteViewCache
+from .types import OsdMap
+from .remote_view_cache import RemoteViewCache
 
 class RbdPoolLs(RemoteViewCache):
     def _get(self):
index e549ed517278720a70c1550b9bbae9ead51358b3..edc3a9815f200291e181428dedeee47dd9873803 100644 (file)
@@ -3,7 +3,7 @@ import json
 import re
 import rados
 import rbd
-from remote_view_cache import RemoteViewCache
+from .remote_view_cache import RemoteViewCache
 
 class DaemonsAndPools(RemoteViewCache):
     def _get(self):
index 383233440cc9b1fe881b0a68a76c4e3f65f983a1..257e22ef2f1b5e0ac7cf9c1c32e549ecb547c41d 100644 (file)
@@ -1,7 +1,7 @@
 # -*- code: utf-8 -*-
 
 import json
-from remote_view_cache import RemoteViewCache
+from .remote_view_cache import RemoteViewCache
 
 import logging
 
index 0440e0705fb0c1c3b86490e3bf970058868e0085..8f210ac9247ea49624b20582ca8206e56055fbcd 100644 (file)
@@ -1 +1 @@
-from module import *  # NOQA
+from .module import Module
index 79f5b86fd50451f25ab12f6ec9f4896948e32fdc..8f210ac9247ea49624b20582ca8206e56055fbcd 100644 (file)
@@ -1,2 +1 @@
-
-from module import *  # NOQA
+from .module import Module
index 6441bb420334a439241e9847d350a635da8092c3..763a84261e6e94bed099ad40d90205c07fe2b0e5 100644 (file)
@@ -1,2 +1,2 @@
-from module import *  # NOQA
+from .module import Module, StandbyModule
 
index 0440e0705fb0c1c3b86490e3bf970058868e0085..8f210ac9247ea49624b20582ca8206e56055fbcd 100644 (file)
@@ -1 +1 @@
-from module import *  # NOQA
+from .module import Module
index 07d73dd82740963cc7cfb5ac0af23c4efa9041d7..ebf2bd1dfcde927be679ba41485651d71d4e77c7 100644 (file)
@@ -1,14 +1,14 @@
 from pecan import expose
 from pecan.rest import RestController
 
-from config import Config
-from crush import Crush
-from doc import Doc
-from mon import Mon
-from osd import Osd
-from pool import Pool
-from request import Request
-from server import Server
+from .config import Config
+from .crush import Crush
+from .doc import Doc
+from .mon import Mon
+from .osd import Osd
+from .pool import Pool
+from .request import Request
+from .server import Server
 
 
 class Root(RestController):
index 3fd244aa85e26a9be2e345cf93360283f23fea16..8a62c84fc3a5304ca4cf506a5d2cf7d5946a55d0 100644 (file)
@@ -2,7 +2,7 @@ from pecan.hooks import PecanHook
 
 import traceback
 
-import module
+from . import module
 
 class ErrorHook(PecanHook):
     def on_error(self, stat, exc):
index 5125253e4667b246eff95d5a0e40a4933d662d52..0d94674cf5555f8c6ac244fc648dff86e9d2e71c 100644 (file)
@@ -12,7 +12,7 @@ import threading
 import traceback
 import socket
 
-import common
+from . import common
 
 from uuid import uuid4
 from pecan import jsonify, make_app
@@ -20,7 +20,7 @@ from OpenSSL import crypto
 from pecan.rest import RestController
 from werkzeug.serving import make_server, make_ssl_devcert
 
-from hooks import ErrorHook
+from .hooks import ErrorHook
 from mgr_module import MgrModule, CommandResult
 
 # Global instance to share
index 622a611b6099ce87400e779f4970d3346b25367a..554aacbf946c9bfa93cd9bf11b5fba614f0c60ea 100644 (file)
@@ -1,3 +1,3 @@
 
-from module import *
+from .module import Module
 
index 79f5b86fd50451f25ab12f6ec9f4896948e32fdc..8f210ac9247ea49624b20582ca8206e56055fbcd 100644 (file)
@@ -1,2 +1 @@
-
-from module import *  # NOQA
+from .module import Module
index 0440e0705fb0c1c3b86490e3bf970058868e0085..8f210ac9247ea49624b20582ca8206e56055fbcd 100644 (file)
@@ -1 +1 @@
-from module import *  # NOQA
+from .module import Module