示例#1
0
def _main_init():
    parser = _ArgumentParser()
    parser.add_argument(
        '--virtual-client',
        type=str,
        help='initialize virtual client "address port [timeout]"')
    parser.add_argument('--virtual-server',
                        type=str,
                        help='start virtual server "address port [timeout]"')
    parser.add_argument('--root',
                        help='root directory to search for the library')
    parser.add_argument('--path', help='the exact path of the library')
    args = parser.parse_args()

    if args.virtual_server and _SYS_IS_WIN:
        raw_args = args.virtual_server.split(' ')
        vs_args = ((raw_args[0], int(raw_args[1])), )
        vs_args += (int(raw_args[2]), ) if len(raw_args) > 2 else ()
        _Thread(target=enable_virtualization, args=vs_args).start()

    if args.virtual_client:
        raw_args = args.virtual_client.split(' ')
        vc_args = ((raw_args[0], int(raw_args[1])), )
        vc_args += (int(raw_args[2]), ) if len(raw_args) > 2 else ()
        admin_init(*vc_args)

    if args.path:
        vinit(dllpath=args.path) if args.virtual_client else init(
            dllpath=args.path)
    elif args.root:
        vinit(root=args.root) if args.virtual_client else init(root=args.root)
示例#2
0
def _main_init():
    parser = _ArgumentParser()
    parser.add_argument('--virtual-client', type=str,
                        help='initialize virtual client "address port [timeout]"')
    parser.add_argument( '--virtual-server', type=str,
                         help='start virtual server "address port [timeout]"' )
    parser.add_argument( '--root', 
                         help = 'root directory to search for the library' )
    parser.add_argument( '--path', help='the exact path of the library' )
    args = parser.parse_args()

    if args.virtual_server and _SYS_IS_WIN:
        raw_args = args.virtual_server.split(' ')
        vs_args = ((raw_args[0],int(raw_args[1])),)
        vs_args += (int(raw_args[2]),) if len(raw_args) > 2 else ()  
        _Thread( target=enable_virtualization, args=vs_args).start()
        
    if args.virtual_client:
        raw_args = args.virtual_client.split(' ')
        vc_args = ((raw_args[0],int(raw_args[1])),)
        vc_args += (int(raw_args[2]),) if len(raw_args) > 2 else ()
        admin_init( *vc_args )
                  
    if args.path:
        vinit(dllpath=args.path) if args.virtual_client else init(dllpath=args.path)
    elif args.root:
        vinit(root=args.root) if args.virtual_client else init(root=args.root)
示例#3
0
def _main_init():
    global args
    parser = _ArgumentParser()
    parser.add_argument('--virtual-client', type=str,
                        help='initialize virtual client "address port [timeout]"')
    parser.add_argument('--virtual-server', type=str,
                        help='start virtual server "address port [timeout]"')
    parser.add_argument('--root', help='root directory to search for the library')
    parser.add_argument('--path', help='the exact path of the library')
    parser.add_argument('--auth', help='password to use for authentication')
    parser.add_argument('-v', '--verbose', action="store_true", 
                        help='extra info to stdout about client connection(s)')
    args = parser.parse_args()  

    #remove quotes 
    if args.auth:
        args.auth = args.auth.strip("'").strip('"')
        
    if args.virtual_server and _SYS_IS_WIN:
        raw_args = args.virtual_server.split(' ')
        try:
            vs_args = ((raw_args[0],int(raw_args[1])),)
        except IndexError:
            print("usage: tosdb --virtual-server 'address port [timeout]'",file=_stderr)
            exit(1)
        vs_args += (args.auth,)
        vs_args += (int(raw_args[2]),) if len(raw_args) > 2 else (DEF_TIMEOUT,) 
        vs_args += (args.verbose,)
        #spin off so we don't block on exit
        _Thread(target=enable_virtualization,args=vs_args).start()
      
    if args.virtual_client:
        raw_args = args.virtual_client.split(' ')
        try:
            vc_args = ((raw_args[0],int(raw_args[1])),)
        except IndexError:
            print("usage: tosdb --virtual-client 'address port [timeout]'",file=_stderr)
            exit(1)
        vc_args += (args.auth,)
        vc_args += (int(raw_args[2]),) if len(raw_args) > 2 else (DEF_TIMEOUT,)      
        admin_init(*vc_args)
            
    if args.virtual_client:
        if args.path:
            vinit(dllpath=args.path)
        elif args.root:
            vinit(root=args.root)
    else:
        if args.path:
            init(dllpath=args.path)   
        elif args.root:  
            init(root=args.root)
示例#4
0
def _main_init():
    global args
    parser = _ArgumentParser()
    parser.add_argument('--virtual-client', type=str,
                        help='initialize virtual client "address port [timeout]"')
    parser.add_argument('--virtual-server', type=str,
                        help='start virtual server "address port [timeout]"')
    parser.add_argument('--root', help='root directory to search for the library')
    parser.add_argument('--path', help='the exact path of the library')
    parser.add_argument('--auth', help='password to use for authentication')
    args = parser.parse_args()  
      
    if args.virtual_server and _SYS_IS_WIN:
        raw_args = args.virtual_server.split(' ')
        try:
            vs_args = ((raw_args[0],int(raw_args[1])),)
        except IndexError:
            print("usage: tosdb --virtual-server 'address port [timeout]'",file=_stderr)
            exit(1)
        vs_args += (int(raw_args[2]),) if len(raw_args) > 2 else ()
        if args.auth:
            vs_args = vs_args[:2] + (args.auth,) + vs_args[2:]
        #spin off so we don't block on exit
        _Thread(target=enable_virtualization,args=vs_args).start()
      
    if args.virtual_client:
        raw_args = args.virtual_client.split(' ')
        try:
            vc_args = ((raw_args[0],int(raw_args[1])),)
        except IndexError:
            print("usage: tosdb --virtual-client 'address port [timeout]'",file=_stderr)
            exit(1)
        vc_args += (int(raw_args[2]),) if len(raw_args) > 2 else ()
        if args.auth:
            vc_args = vc_args[:2] + (args.auth,) + vc_args[2:]
        admin_init(*vc_args)
            
    if args.virtual_client:
        if args.path:
            vinit(dllpath=args.path)
        elif args.root:
            vinit(root=args.root)
        if args.path or args.root and not vconnected():
            raise TOSDB_Error("could not connect to service/engine")
    else:
        if args.path:
            init(dllpath=args.path)   
        elif args.root:  
            init(root=args.root)
        if args.path or args.root and not connected():
            raise TOSDB_Error("could not connect to service/engine")
示例#5
0
def _main_init():
    global args
    parser = _ArgumentParser()
    parser.add_argument(
        '--virtual-client',
        type=str,
        help='initialize virtual client "address port [timeout]"')
    parser.add_argument('--virtual-server',
                        type=str,
                        help='start virtual server "address port [timeout]"')
    parser.add_argument('--root',
                        help='root directory to search for the library')
    parser.add_argument('--path', help='the exact path of the library')
    args = parser.parse_args()

    if args.virtual_server and _SYS_IS_WIN:
        raw_args = args.virtual_server.split(' ')
        try:
            vs_args = ((raw_args[0], int(raw_args[1])), )
        except IndexError:
            print("usage: tosdb --virtual-server 'address port [timeout]'",
                  file=_stderr)
            exit(1)
        vs_args += (int(raw_args[2]), ) if len(raw_args) > 2 else ()
        _Thread(target=enable_virtualization, args=vs_args).start()

    if args.virtual_client:
        raw_args = args.virtual_client.split(' ')
        try:
            vc_args = ((raw_args[0], int(raw_args[1])), )
        except IndexError:
            print("usage: tosdb --virtual-client 'address port [timeout]'",
                  file=_stderr)
            exit(1)
        vc_args += (int(raw_args[2]), ) if len(raw_args) > 2 else ()
        admin_init(*vc_args)

    if args.virtual_client:
        if args.path:
            vinit(dllpath=args.path)
        elif args.root:
            vinit(root=args.root)
        if args.path or args.root and not vconnected():
            raise TOSDB_Error("could not connect to service/engine")
    else:
        if args.path:
            init(dllpath=args.path)
        elif args.root:
            init(root=args.root)
        if args.path or args.root and not connected():
            raise TOSDB_Error("could not connect to service/engine")
示例#6
0
def _main_init():
    global args
    parser = _ArgumentParser()
    parser.add_argument(
        '--virtual-client',
        type=str,
        help='initialize virtual client "address port [timeout]"')
    parser.add_argument('--virtual-server',
                        type=str,
                        help='start virtual server "address port [timeout]"')
    parser.add_argument('--root',
                        help='root directory to search for the library')
    parser.add_argument('--path', help='the exact path of the library')
    parser.add_argument('--auth', help='password to use for authentication')
    parser.add_argument('-v',
                        '--verbose',
                        action="store_true",
                        help='extra info to stdout about client connection(s)')
    args = parser.parse_args()

    #remove quotes
    if args.auth:
        args.auth = args.auth.strip("'").strip('"')

    if args.virtual_server and _SYS_IS_WIN:
        raw_args = args.virtual_server.split(' ')
        try:
            vs_args = ((raw_args[0], int(raw_args[1])), )
        except IndexError:
            print("usage: tosdb --virtual-server 'address port [timeout]'",
                  file=_stderr)
            exit(1)
        vs_args += (args.auth, )
        vs_args += (int(
            raw_args[2]), ) if len(raw_args) > 2 else (DEF_TIMEOUT, )
        vs_args += (args.verbose, )
        #spin off so we don't block on exit
        _Thread(target=enable_virtualization, args=vs_args).start()

    if args.virtual_client:
        raw_args = args.virtual_client.split(' ')
        try:
            vc_args = ((raw_args[0], int(raw_args[1])), )
        except IndexError:
            print("usage: tosdb --virtual-client 'address port [timeout]'",
                  file=_stderr)
            exit(1)
        vc_args += (args.auth, )
        vc_args += (int(
            raw_args[2]), ) if len(raw_args) > 2 else (DEF_TIMEOUT, )
        admin_init(*vc_args)

    if args.virtual_client:
        if args.path:
            vinit(dllpath=args.path)
        elif args.root:
            vinit(root=args.root)
    else:
        if args.path:
            init(dllpath=args.path)
        elif args.root:
            init(root=args.root)