doc/rgw: fix docs build

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>
This commit is contained in:
Yehuda Sadeh 2021-11-29 15:31:42 -08:00
parent 91a3276aca
commit 50ab91473e
2 changed files with 9 additions and 0 deletions

View 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 []

View 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: