示例#1
0
    parser.add_argument('-i',
                        '--ip_addr',
                        dest='ip_addrs',
                        action='append',
                        default=[],
                        help='IP address to listen from nodes '
                        '(may be needed in case of multiple interfaces)')
    parser.add_argument('-d',
                        '--debug',
                        action='store_true',
                        dest='debug',
                        default=False,
                        help='if given, debug messages are printed')
    DocumentRoot = os.path.join(os.path.dirname(__file__), 'data')
    config = vars(parser.parse_args(sys.argv[1:]))
    if config.pop('debug', False):
        dispy.logger.setLevel(dispy.logger.DEBUG)
    if config['config']:
        import configparser
        cfg = configparser.ConfigParser()
        cfg.read(config['config'])
        cfg = dict(cfg.items('DEFAULT'))
        cfg['ipv4_udp_multicast'] = cfg['ipv4_udp_multicast'] == 'True'
        cfg['ip_addrs'] = cfg['ip_addrs'].strip()
        if cfg['ip_addrs']:
            cfg['ip_addrs'] = eval(cfg['ip_addrs'])
        config = cfg
    config['poll_interval'] = int(config['poll_interval'])
    config['ping_interval'] = int(config['ping_interval'])
    config.pop('config', None)
示例#2
0
                        action='store_true',
                        default=False,
                        help='use multicast for IPv4 UDP instead of broadcast')
    parser.add_argument('--daemon',
                        action='store_true',
                        dest='daemon',
                        default=False,
                        help='if given, input is not read from terminal ')
    config = vars(parser.parse_args(sys.argv[1:]))

    if config['loglevel']:
        logger.setLevel(logger.DEBUG)
    else:
        logger.setLevel(logger.INFO)
    del config['loglevel']
    daemon = config.pop('daemon')
    dispy.config.DispyPort = config.pop('dispy_port')

    DispyNetRelay(**config)

    try:
        if os.getpgrp() != os.tcgetpgrp(sys.stdin.fileno()):
            daemon = True
    except Exception:
        pass

    if daemon:
        while 1:
            try:
                time.sleep(3600)
            except (Exception, KeyboardInterrupt):
示例#3
0
 parser.add_argument('--ping_interval', dest='ping_interval', default='600',
                     help='interval to discover (new) nodes')
 parser.add_argument('--certfile', dest='certfile', default='',
                     help='file containing SSL certificate')
 parser.add_argument('--keyfile', dest='keyfile', default='',
                     help='file containing SSL key')
 parser.add_argument('--ipv4_udp_multicast', dest='ipv4_udp_multicast', action='store_true',
                     default=False, help='use multicast for IPv4 UDP instead of broadcast')
 parser.add_argument('-i', '--ip_addr', dest='ip_addrs', action='append', default=[],
                     help='IP address to listen from nodes '
                     '(may be needed in case of multiple interfaces)')
 parser.add_argument('-d', '--debug', action='store_true', dest='debug', default=False,
                     help='if given, debug messages are printed')
 DocumentRoot = os.path.join(os.path.dirname(__file__), 'data')
 config = vars(parser.parse_args(sys.argv[1:]))
 if config.pop('debug', False):
     dispy.logger.setLevel(dispy.logger.DEBUG)
 if config['config']:
     import configparser
     cfg = configparser.ConfigParser()
     cfg.read(config['config'])
     cfg = dict(cfg.items('DEFAULT'))
     cfg['ipv4_udp_multicast'] = cfg['ipv4_udp_multicast'] == 'True'
     cfg['ip_addrs'] = cfg['ip_addrs'].strip()
     if cfg['ip_addrs']:
         cfg['ip_addrs'] = eval(cfg['ip_addrs'])
     config = cfg
 config['http_port'] = int(config['http_port'])
 config['info_port'] = int(config['info_port'])
 config['node_port'] = int(config['node_port'])
 config['poll_interval'] = int(config['poll_interval'])