]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
doc/rgw: fix docs build
authorYehuda Sadeh <yehuda@redhat.com>
Mon, 29 Nov 2021 23:31:42 +0000 (15:31 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 30 Nov 2021 18:57:14 +0000 (10:57 -0800)
Workaround rgw modules conflict, as there are two separate modules named
rgw: src/pybind/rgw, src/pybind/mgr/rgw

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
doc/_ext/ceph_commands.py
doc/conf.py

index 046a5e09c398cc3622cac4ecc93edc041f273b7d..861a013ea5a48d3e1cf8dfe172e0085d4f40591a 100644 (file)
@@ -9,6 +9,7 @@ from jinja2 import Template
 from pcpp.preprocessor import Preprocessor
 from sphinx.util import logging
 from sphinx.util.console import bold
+from importlib import reload
 
 logger = logging.getLogger(__name__)
 
@@ -310,6 +311,7 @@ class CephMgrCommands(Directive):
         with self.mocked_modules():
             logger.info(bold(f"loading mgr module '{name}'..."))
             mgr_mod = __import__(name, globals(), locals(), [], 0)
+            reload(mgr_mod)
             from tests import M
 
             def subclass(x):
@@ -355,6 +357,10 @@ class CephMgrCommands(Directive):
         cmds = [cmd for cmd in cmds if 'hidden' not in cmd.flags]
         cmds = sorted(cmds, key=lambda cmd: cmd.prefix)
         self._render_cmds(cmds)
+
+        orig_rgw_mod = sys.modules['pybind_rgw_mod']
+        sys.modules['rgw'] = orig_rgw_mod
+
         return []
 
 
index 690843a74ff96952456650472a29764342c74566..c4d5bfb49c684900de07613556822e3a72c6ab46 100644 (file)
@@ -13,6 +13,9 @@ top_level = \
         os.path.dirname(
             os.path.abspath(__file__)))
 
+pybind_rgw_mod = __import__('rgw', globals(), locals(), [], 0)
+sys.modules['pybind_rgw_mod'] = pybind_rgw_mod
+
 
 def parse_ceph_release():
     with open(os.path.join(top_level, 'src/ceph_release')) as f: