Пример #1
0
if __name__ == '__main__':
    logging.basicConfig(format='%(levelname)s %(module)s.%(funcName)s: %(message)s', level=logging.INFO)
    logger = logging.getLogger()

    args=getArguments()
    if args.debug:
        logger.setLevel(logging.DEBUG)

    try:
        options = [ 'address', 'port', 'name' ]
        parameter = {}
        for i in options:
            if hasattr(args, i) and getattr(args,i) != None:
                logger.debug( "%s: %s" %(i, getattr(args,i)))
                parameter[i] = getattr(args,i)
            else:
                logger.debug( '%s: ""' %(i))
        logger.debug('options: %s' % (parameter))
        password = bareos.bsock.Password(args.password)
        parameter['password']=password
        bsock=FileDaemon(**parameter)
    except RuntimeError as e:
        print(str(e))
        sys.exit(1)
    logger.debug( "authentication successful" )
    if args.command:
        bsock.call(args.command)
    else:
        bsock.interactive()
Пример #2
0
    logging.basicConfig(
        format='%(levelname)s %(module)s.%(funcName)s: %(message)s',
        level=logging.INFO)
    logger = logging.getLogger()

    args = getArguments()
    if args.debug:
        logger.setLevel(logging.DEBUG)

    try:
        options = ['address', 'port', 'name']
        parameter = {}
        for i in options:
            if hasattr(args, i) and getattr(args, i) != None:
                logger.debug("%s: %s" % (i, getattr(args, i)))
                parameter[i] = getattr(args, i)
            else:
                logger.debug('%s: ""' % (i))
        logger.debug('options: %s' % (parameter))
        password = bareos.bsock.Password(args.password)
        parameter['password'] = password
        bsock = FileDaemon(**parameter)
    except RuntimeError as e:
        print(str(e))
        sys.exit(1)
    logger.debug("authentication successful")
    if args.command:
        print(bsock.call(args.command))
    else:
        bsock.interactive()
Пример #3
0
if __name__ == '__main__':
    logging.basicConfig(format='%(levelname)s %(module)s.%(funcName)s: %(message)s', level=logging.INFO)
    logger = logging.getLogger()

    args=getArguments()
    if args.debug:
        logger.setLevel(logging.DEBUG)

    try:
        options = [ 'address', 'port', 'name' ]
        parameter = {}
        for i in options:
            if hasattr(args, i) and getattr(args,i) != None:
                logger.debug( "%s: %s" %(i, getattr(args,i)))
                parameter[i] = getattr(args,i)
            else:
                logger.debug( '%s: ""' %(i))
        logger.debug('options: %s' % (parameter))
        password = bareos.bsock.Password(args.password)
        parameter['password']=password
        bsock=FileDaemon(**parameter)
    except RuntimeError as e:
        print(str(e))
        sys.exit(1)
    logger.debug( "authentication successful" )
    if args.command:
        print(bsock.call(args.command))
    else:
        bsock.interactive()