Esempio n. 1
0
def control_nodes(args):
    from requests.exceptions import ConnectionError
    if args.cmd == 'list':
        return utils.get_nodes(args.node)
    elif args.cmd == 'add':
        return utils.peer_setup(args.node, *args.peerlist)
    elif args.cmd == 'stop':
        try:
            return utils.quit(args.node)
        except ConnectionError as e:
            # If the connection goes down before response that is OK
            return None
Esempio n. 2
0
def control_nodes(args):
    from requests.exceptions import ConnectionError

    if args.cmd == "list":
        return utils.get_nodes(args.node)
    elif args.cmd == "add":
        return utils.peer_setup(args.node, *args.peerlist)
    elif args.cmd == "stop":
        try:
            return utils.quit(args.node)
        except ConnectionError as e:
            # If the connection goes down before response that is OK
            return None
Esempio n. 3
0
def control_nodes(args):
    from requests.exceptions import ConnectionError
    if args.cmd == 'info':
        if not args.peerlist:
            raise Exception("No node id given")
        return utils.get_node(args.node, args.peerlist[0])
    elif args.cmd == 'list':
        return utils.get_nodes(args.node)
    elif args.cmd == 'add':
        return utils.peer_setup(args.node, *args.peerlist)
    elif args.cmd == 'stop':
        try:
            return utils.quit(args.node)
        except ConnectionError:
            # If the connection goes down before response that is OK
            return None