Exemplo n.º 1
0
 def test_success(self, mock_initialized, mock_rmtree):
     mock_initialized.return_value = True
     lib.client_destroy()
     mock_rmtree.assert_called_once_with(_client_cert_dir)
Exemplo n.º 2
0
 def test_not_initialized(self, mock_initialized, mock_rmtree):
     mock_initialized.return_value = False
     lib.client_destroy()
     mock_rmtree.assert_not_called()
Exemplo n.º 3
0
 def test_success(self, mock_initialized, mock_rmtree):
     mock_initialized.return_value = True
     lib.client_destroy()
     mock_rmtree.assert_called_once_with(
         settings.corosync_qdevice_net_client_certs_dir
     )
Exemplo n.º 4
0
def client_net_destroy(lib_env: LibraryEnvironment):
    # pylint: disable=unused-argument
    """
    delete qdevice client config files on local host
    """
    qdevice_net.client_destroy()
Exemplo n.º 5
0
 def test_not_initialized(self, mock_initialized, mock_rmtree):
     mock_initialized.return_value = False
     lib.client_destroy()
     mock_rmtree.assert_not_called()
Exemplo n.º 6
0
def client_net_destroy(lib_env):
    """
    delete qdevice client config files on local host
    """
    _ensure_not_cman(lib_env)
    qdevice_net.client_destroy()
Exemplo n.º 7
0
 def test_success(self, mock_initialized, mock_rmtree):
     mock_initialized.return_value = True
     lib.client_destroy()
     mock_rmtree.assert_called_once_with(_client_cert_dir)
Exemplo n.º 8
0
def client_net_destroy(lib_env):
    # pylint: disable=unused-argument
    """
    delete qdevice client config files on local host
    """
    qdevice_net.client_destroy()
Exemplo n.º 9
0
def cluster_destroy(argv):
    if argv:
        raise CmdLineInputError()
    if "--all" in utils.pcs_options:
        # destroy remote and guest nodes
        cib = None
        lib_env = utils.get_lib_env()
        try:
            cib = lib_env.get_cib()
        except LibraryError as e:
            warn("Unable to load CIB to get guest and remote nodes from it, "
                 "those nodes will not be deconfigured.")
        if cib is not None:
            try:
                all_remote_nodes = get_existing_nodes_names(cib=cib)
                if len(all_remote_nodes) > 0:
                    _destroy_pcmk_remote_env(lib_env,
                                             all_remote_nodes,
                                             skip_offline_nodes=True,
                                             allow_fails=True)
            except LibraryError as e:
                utils.process_library_reports(e.args)

        # destroy full-stack nodes
        destroy_cluster(utils.get_corosync_conf_facade().get_nodes_names())
    else:
        print("Shutting down pacemaker/corosync services...")
        for service in ["pacemaker", "corosync-qdevice", "corosync"]:
            # Returns an error if a service is not running. It is safe to
            # ignore it since we want it not to be running anyways.
            utils.stop_service(service)
        print("Killing any remaining services...")
        kill_local_cluster_services()
        try:
            utils.disableServices()
        except:
            # previously errors were suppressed in here, let's keep it that way
            # for now
            pass
        try:
            disable_service(utils.cmd_runner(), lib_sbd.get_sbd_service_name())
        except:
            # it's not a big deal if sbd disable fails
            pass

        print("Removing all cluster configuration files...")
        dummy_output, dummy_retval = utils.run([
            "rm",
            "-f",
            settings.corosync_conf_file,
            settings.corosync_authkey_file,
            settings.pacemaker_authkey_file,
        ])
        state_files = [
            "cib.xml*", "cib-*", "core.*", "hostcache", "cts.*", "pe*.bz2",
            "cib.*"
        ]
        for name in state_files:
            dummy_output, dummy_retval = utils.run([
                "find", "/var/lib/pacemaker", "-name", name, "-exec", "rm",
                "-f", "{}", ";"
            ])
        try:
            qdevice_net.client_destroy()
        except:
            # errors from deleting other files are suppressed as well
            # we do not want to fail if qdevice was not set up
            pass
Exemplo n.º 10
0
def client_net_destroy(lib_env):
    """
    delete qdevice client config files on local host
    """
    _ensure_not_cman(lib_env)
    qdevice_net.client_destroy()
Exemplo n.º 11
0
def client_net_destroy(lib_env):
    """
    delete qdevice client config files on local host
    """
    qdevice_net.client_destroy()