예제 #1
0
파일: cmd.py 프로젝트: mgax/Probity
def do_checksum(args):
    if args.quiet:
        def handle_final(evt):
            print '%s: %s' % (evt.name, evt.checksum)
        for evt in walk.walk_path(args.target, handle_final):
            pass
    else:
        with probfile.YamlDumper(sys.stdout) as output:
            for evt in walk.walk_path(args.target):
                output.write(evt)
예제 #2
0
파일: cmd.py 프로젝트: mgax/Probity
def do_backup(args):
    backup_pool = backup.Backup(args.backup_path)
    with (probfile.YamlDumper(sys.stdout) if args.verbose else
          DummyOutput()) as output:
        for evt in walk.walk_path(args.target):
            backup_pool.store_event(evt)
            output.write(evt)
예제 #3
0
파일: cmd.py 프로젝트: mgax/Probity
def do_verify(args):
    reference = read_checksum_file(args.reference_path)
    comparator = compare.Comparator(reference)
    for evt in walk.walk_path(args.target):
        comparator.update(evt)
    report = comparator.report()
    if report['missing']:
        print 'Missing files:'
        for file_path in report['missing']:
            print '  %s: %s' % (file_path, reference[file_path])