Example #1
0
def _check_nodes(node_list, prefix=""):
    """
    Print pcsd status on node_list, return if there is any pcsd not online

    Commandline options:
      * --request-timeout - HTTP timeout for node authorization check
    """
    online_code = 0
    status_desc_map = {online_code: "Online", 3: "Unable to authenticate"}
    status_list = []

    def report(node, returncode, output):
        del output
        print(
            "{0}{1}: {2}".format(
                prefix, node, status_desc_map.get(returncode, "Offline")
            )
        )
        status_list.append(returncode)

    utils.read_known_hosts_file()  # cache known hosts
    utils.run_parallel(
        utils.create_task_list(report, utils.checkAuthorization, node_list)
    )

    return any(status != online_code for status in status_list)
Example #2
0
def check_nodes(node_list, prefix=""):
    """
    Print pcsd status on node_list, return if there is any pcsd not online
    """
    if not utils.is_rhel6():
        pm_nodes = utils.getPacemakerNodesID(allow_failure=True)
        cs_nodes = utils.getCorosyncNodesID(allow_failure=True)

    STATUS_ONLINE = 0
    status_desc_map = {
        STATUS_ONLINE: 'Online',
        3: 'Unable to authenticate'
    }
    status_list = []
    def report(node, returncode, output):
        print("{0}{1}: {2}".format(
            prefix,
            node if utils.is_rhel6() else utils.prepare_node_name(
                node, pm_nodes, cs_nodes
            ),
            status_desc_map.get(returncode, 'Offline')
        ))
        status_list.append(returncode)

    utils.run_parallel(
        utils.create_task_list(report, utils.checkAuthorization, node_list)
    )

    return any([status != STATUS_ONLINE for status in status_list])
Example #3
0
def check_nodes(node_list, prefix=""):
    """
    Print pcsd status on node_list, return if there is any pcsd not online
    """
    STATUS_ONLINE = 0
    status_desc_map = {STATUS_ONLINE: 'Online', 3: 'Unable to authenticate'}
    status_list = []

    def report(node, returncode, output):
        print("{0}{1}: {2}".format(prefix, node,
                                   status_desc_map.get(returncode, 'Offline')))
        status_list.append(returncode)

    utils.run_parallel(
        utils.create_task_list(report, utils.checkAuthorization, node_list))

    return any([status != STATUS_ONLINE for status in status_list])