]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
script/gen_static_command_descriptions: add mock for rados python binding 35791/head
authorKefu Chai <kchai@redhat.com>
Fri, 26 Jun 2020 09:48:42 +0000 (17:48 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 26 Jun 2020 09:48:57 +0000 (17:48 +0800)
to address issue like

Traceback (most recent call last):
  File "/home/jenkins-build/build/workspace/ceph-pr-docs/doc/scripts/../../src/script/gen_static_command_descriptions.py", line 168, in <module>
    print(json.dumps(gen_commands_dicts(), indent=2, sort_keys=True))
  File "/home/jenkins-build/build/workspace/ceph-pr-docs/doc/scripts/../../src/script/gen_static_command_descriptions.py", line 163, in gen_commands_dicts
    comms = from_mon_commands_h() + from_mgr_modules()
  File "/home/jenkins-build/build/workspace/ceph-pr-docs/doc/scripts/../../src/script/gen_static_command_descriptions.py", line 85, in from_mgr_modules
    comms = sum([list_mgr_module(name) for name in names], [])
  File "/home/jenkins-build/build/workspace/ceph-pr-docs/doc/scripts/../../src/script/gen_static_command_descriptions.py", line 85, in <listcomp>
    comms = sum([list_mgr_module(name) for name in names], [])
  File "/home/jenkins-build/build/workspace/ceph-pr-docs/doc/scripts/../../src/script/gen_static_command_descriptions.py", line 65, in list_mgr_module
    mgr_mod = __import__(m_name, globals(), locals(), [], 0)
  File "/home/jenkins-build/build/workspace/ceph-pr-docs/src/pybind/mgr/volumes/__init__.py", line 2, in <module>
    from .module import Module
  File "/home/jenkins-build/build/workspace/ceph-pr-docs/src/pybind/mgr/volumes/module.py", line 8, in <module>
    from .fs.nfs import NFSCluster, FSExport
  File "/home/jenkins-build/build/workspace/ceph-pr-docs/src/pybind/mgr/volumes/fs/nfs.py", line 6, in <module>
    from rados import TimedOut
ImportError: cannot import name 'TimedOut'

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/script/gen_static_command_descriptions.py

index 2bf33019d0bf76503369141f37c698d4f7785421..225f9601fe92568b039fc8dd3aef8a03504603b1 100644 (file)
@@ -38,6 +38,7 @@ def cmd_to_sig(cmd):
 
 
 def list_mgr_module(m_name):
+    sys.modules['rados'] = mock.Mock()
     sys.modules['rbd'] = mock.Mock()
     sys.modules['cephfs'] = mock.Mock()
     sys.modules['dateutil'] = mock.Mock()