Exemplo n.º 1
0
def cephadm_module():
    with mock.patch("cephadm.module.CephadmOrchestrator.get_ceph_option", get_ceph_option),\
            mock.patch("cephadm.module.CephadmOrchestrator._configure_logging", lambda *args: None),\
            mock.patch("cephadm.module.CephadmOrchestrator.remote"),\
            mock.patch("cephadm.module.CephadmOrchestrator.set_store", set_store), \
            mock.patch("cephadm.module.CephadmOrchestrator.get_store", get_store),\
            mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('[]')), \
            mock.patch("cephadm.module.HostCache.save_host"), \
            mock.patch("cephadm.module.HostCache.rm_host"), \
            mock.patch("cephadm.module.CephadmOrchestrator.send_command"), \
            mock.patch("cephadm.module.CephadmOrchestrator.mon_command", mon_command), \
            mock.patch("cephadm.module.CephadmOrchestrator.get_store_prefix", get_store_prefix):

        CephadmOrchestrator._register_commands('')
        CephadmOrchestrator._register_options('')
        m = CephadmOrchestrator.__new__(CephadmOrchestrator)
        m._root_logger = mock.MagicMock()
        m._store = {
            'ssh_config': '',
            'ssh_identity_key': '',
            'ssh_identity_pub': '',
            'inventory': {},
            'upgrade_state': None,
        }
        m.__init__('cephadm', 0, 0)
        m._cluster_fsid = "fsid"
        yield m
Exemplo n.º 2
0
def cephadm_module():
    with mock.patch("cephadm.module.CephadmOrchestrator.get_ceph_option", get_ceph_option),\
            mock.patch("cephadm.module.CephadmOrchestrator._configure_logging", lambda *args: None),\
            mock.patch("cephadm.module.CephadmOrchestrator.set_store", set_store),\
            mock.patch("cephadm.module.CephadmOrchestrator.get_store", get_store),\
            mock.patch("cephadm.module.CephadmOrchestrator.get_store_prefix", get_store_prefix):
        CephadmOrchestrator._register_commands('')
        m = CephadmOrchestrator.__new__(CephadmOrchestrator)
        m._root_logger = mock.MagicMock()
        m._store = {
            'ssh_config': '',
            'ssh_identity_key': '',
            'ssh_identity_pub': '',
            'inventory': {},
        }
        m.__init__('cephadm', 0, 0)
        yield m