Example #1
0
def add_child_server(system_ip, server_id):
    """
    Adds a child server
    """

    db_add_child_server(server_id)
    success, local_server = db_get_server('local')
    if not success:
        return False, local_server

    success, server_connect_ip = get_server_ip_from_server_id(local_server['id'])
    if not success:
        return False, server_connect_ip

    success, msg = ans_add_server(system_ip=system_ip,
                                  server_id=local_server['id'],
                                  server_name=local_server['name'],
                                  server_ip=server_connect_ip,
                                  server_port=local_server['port'],
                                  server_descr=local_server['descr'])
    if not success:
        return False, msg

    success, msg = ans_add_server_hierarchy(system_ip=system_ip,
                                            parent_id=local_server['id'],
                                            child_id=server_id)
    if not success:
        return False, msg

    return True, ''
Example #2
0
def add_child_server(system_ip, server_id):

    db_add_child_server(server_id)
    success, local_server = db_get_server('local')
    if not success:
        return False, local_server

    success, msg = ans_add_server(system_ip=system_ip,
                                  server_id=local_server['id'],
                                  server_name=local_server['name'],
                                  server_ip=local_server['ip'],
                                  server_port=local_server['port'],
                                  server_descr=local_server['descr'])
    if not success:
        return False, msg

    success, msg = ans_add_server_hierarchy(system_ip=system_ip,
                                            parent_id=local_server['id'],
                                            child_id=server_id)
    if not success:
        return False, msg

    return True, ''