示例#1
0
文件: status.py 项目: mbaldessari/pcs
def _get_local_services_status(
    service_manager: ServiceManagerInterface,
) -> List[_ServiceStatus]:
    service_def = [
        # (service name, display even if not enabled nor running)
        ("corosync", True),
        ("pacemaker", True),
        ("pacemaker_remote", False),
        ("pcsd", True),
        (get_sbd_service_name(service_manager), False),
    ]
    service_status_list = []
    for service, display_always in service_def:
        try:
            service_status_list.append(
                _ServiceStatus(
                    service,
                    display_always,
                    service_manager.is_enabled(service),
                    service_manager.is_running(service),
                )
            )
        except LibraryError:
            pass
    return service_status_list
示例#2
0
def _service_disable(
    report_processor: ReportProcessor,
    service_manager: ServiceManagerInterface,
    service: str,
) -> None:
    try:
        service_manager.disable(service)
    except ManageServiceError as e:
        raise LibraryError(service_exception_to_report(e)) from e
    report_processor.report(
        ReportItem.info(
            reports.messages.ServiceActionSucceeded(
                reports.const.SERVICE_ACTION_DISABLE, "quorum device")))
示例#3
0
文件: sbd.py 项目: kmalyjur/pcs
def is_sbd_installed(service_manager: ServiceManagerInterface) -> bool:
    """
    Check if SBD service is installed in local system.
    Reurns True id SBD service is installed. False otherwise.
    """
    return service_manager.is_installed(get_sbd_service_name(service_manager))
示例#4
0
文件: sbd.py 项目: kmalyjur/pcs
def is_sbd_enabled(service_manager: ServiceManagerInterface) -> bool:
    """
    Check if SBD service is enabled in local system.
    Return True if SBD service is enabled, False otherwise.
    """
    return service_manager.is_enabled(get_sbd_service_name(service_manager))