Exemple #1
0
            options["end_date"] = None

        if "table" not in options.keys() and not dryrun:
            raise ValueError("Results Table must be specified")

        if args.verbose > 0:
            options["verbose"] = args.verbose
            dbg = True
        else:
            dbg = True
            if "verbose" not in options.keys(
            ) and "debug_file" not in options.keys():
                dbg = False
                options["verbose"] = 0
            elif "debug_file" in options.keys():
                options["debug_file"] = bu.append_date_file(
                    options["debug_file"])

        if not dryrun:
            db_interface = rates_dbi.base_rates_db_interface(options, dryrun)
            options["start_date"] = db_interface.calc_start_date(
                options['start_date'])
        else:
            db_interface = None

        if "append" in options and options[
                "append"] > 0 and "current_view" in options:
            if db_interface:
                options["start_date"] = db_interface.calc_most_recent_date(
                    options["start_date"])
            dbc.print_helper(
                ("Updated start date " + str(options["start_date"])), dbg=dbg)
        if "temp_dir" not in args_dict.keys():
            raise ValueError("JSON must include temp_dir")

        if "src" not in args_dict.keys():
            raise ValueError("JSON must include src (source directory)")

        if "backup_dir" not in args_dict.keys():
            raise ValueError("JSON must include backup_dir")

        if args.verbose > 0:
            args_dict["verbose"] = args.verbose
        else:
            if "verbose" not in args_dict.keys() and "debug_file" not in args_dict.keys():
                args_dict["verbose"] = 0
            elif "debug_file" in args_dict.keys():
                args_dict["debug_file"] = bu.append_date_file(args_dict["debug_file"])
    else:
        if "backup_dir" not in args_dict.keys() or "src" not in args_dict.keys():
            raise ValueError("Dictionary Combination")

    dbg, print_dbg = bu.calc_debug_levels(args_dict)
    if "debug_file" in args_dict.keys():
        dbc.print_helper(("Using debug file " + args_dict["debug_file"]), dbg=dbg)

    hostname = bu.calc_hostname(dbg=dbg)
    if hostname is not None:
        dest = os.sep.join([args_dict["backup_dir"], hostname])
    else:
        dest = args_dict["backup_dir"]

    temp, dt_str = bu.calc_directory(args_dict["temp_dir"], dbg=dbg)