def main()

in appengine/reconciletags/reconciletags_main.py [0:0]


def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--dry-run', dest='dry_run',
                        help='Runs tests to make sure input files are valid, \
                        and runs a dry run of the reconciler',
                        action='store_true', default=False)
    parser.add_argument('files',
                        help='The files to run the reconciler on',
                        nargs='+')
    parser.add_argument('--data-integrity', dest='data_integrity',
                        help='Runs a test to make sure the data in the input \
                        files is the same as in prod',
                        action='store_true', default=False)
    args = parser.parse_args()
    logging.basicConfig(level=logging.DEBUG)

    if args.data_integrity:
        run_test(args.files, data_integrity_test.DataIntegrityTest)
        return

    if args.dry_run:
        run_test(args.files, config_integrity_test.ReconcilePresubmitTest)

    r = tag_reconciler.TagReconciler()
    for f in args.files:
        logging.debug('---Processing {0}---'.format(f))
        with open(f) as tag_map:
            data = json.load(tag_map)
            r.reconcile_tags(data, args.dry_run)