Beispiel #1
0
    def test_sync_at_startup(self):
        print("""
        --------------------------------------------------------------
        test_sync_at_startup
        write some files in lan filestorage and start the forwarder with
        "sync_at_startup" which will then upload the files to the wan server
        --------------------------------------------------------------""")

        config = 'config/fwd/live_test_http_https_fwd_config.json'
        lan_root = load_config(config)['lan_filestorage']
        wan_root = self.servers.wan_config['wan_filestorage']

        write_testfiles(lan_root, '', 4)

        self.servers.start_forwarder(config=config, rules=None)
        self.servers.forwarder.expect('idle')

        missing_filename = verify_testfiles(wan_root, '', 4)
        self.assertFalse(missing_filename)
Beispiel #2
0
def run_recognize(imagepath):
    global args
    command_args = args
    if command_args.conf:
        conf_dict = load_config(command_args.conf)
    else:
        conf_dict = default_config
        
    # Override any confs with command line versions
    for key in conf_dict:

        if not hasattr(command_args, key):
            continue
        val = getattr(command_args, key)
        if val:
            conf_dict[key] = val
            
    rec = PageRecognizer(imagepath, conf=Config(**conf_dict))
    if args.format == 'text':
        text = True
    else:
        text = False
    return rec.recognize_page(text=text)
Beispiel #3
0
                    help='configuration file, default config_forwarder.json')

args = parser.parse_args()

if args.verbose:
    log.setLevel(logging.DEBUG)
elif args.info:
    log.setLevel(logging.INFO)
else:
    log.setLevel(logging.WARNING)

cfg = None

if args.config:
    try:
        cfg = config_util.load_config(args.config)
    except FileNotFoundError as e:
        die('config file not found', e, ErrorCode.FILE_NOT_FOUND)
    except json.decoder.JSONDecodeError as e:
        die(f'json error in {args.config}', e, ErrorCode.FILE_INVALID)

try:
    lan = cfg.get('lan_host')

    filuxe = filuxe_api.Filuxe(cfg, lan=lan)

    error_code = ErrorCode.UNSET

    try:
        if args.download:
            if not args.file or not args.path:
Beispiel #4
0
    CONFIG = {
        "default": root,
        "dirs": {
            "product/release/image": product_release_image,
            "product/candidate": product_candidate,
            "product/release": product_release,
            "product": product
        }
    }
    jsn = json.dumps(CONFIG, indent=4, sort_keys=True)
    print(jsn)
    exit(0)

if args.config:
    try:
        cfg = config_util.load_config(args.config)
        inf(f'loaded configuration {args.config}')
    except FileNotFoundError as e:
        die('config file not found', e)
    except json.decoder.JSONDecodeError as e:
        die(f'json error in {args.config}', e, ErrorCode.FILE_INVALID)

rules = None

if args.rules:
    try:
        rules = config_util.load_config(args.rules)
        inf(f'loaded rules file {args.rules}')
    except json.decoder.JSONDecodeError as e:
        die(f'json error in {args.rules}', e, ErrorCode.FILE_INVALID)
    except:
Beispiel #5
0
 def load_config_file(filename):
     config_util.load_config(filename)