def main(): parser = ArgumentParser() parser.add_argument( '--config', dest='config_filename', default='/etc/atticmatic/config', help='Configuration filename', ) parser.add_argument( '--excludes', dest='excludes_filename', default='/etc/atticmatic/excludes', help='Excludes filename', ) parser.add_argument( '--verbose', action='store_true', help='Display verbose progress information', ) args = parser.parse_args() try: location_config, retention_config = parse_configuration(args.config_filename) create_archive(args.excludes_filename, args.verbose, *location_config) prune_archives(location_config.repository, args.verbose, *retention_config) except (ValueError, CalledProcessError), error: print(error, file=sys.stderr) sys.exit(1)
def main(): try: args = parse_arguments(*sys.argv[1:]) location_config, retention_config = parse_configuration(args.config_filename) repository = location_config['repository'] create_archive(args.excludes_filename, args.verbose, **location_config) prune_archives(args.verbose, repository, retention_config) check_archives(args.verbose, repository) except (ValueError, IOError, CalledProcessError) as error: print(error, file=sys.stderr) sys.exit(1)
def main(): try: args = parse_arguments(*sys.argv[1:]) location_config, retention_config = parse_configuration( args.config_filename) repository = location_config['repository'] create_archive(args.excludes_filename, args.verbose, **location_config) prune_archives(args.verbose, repository, retention_config) check_archives(args.verbose, repository) except (ValueError, IOError, CalledProcessError) as error: print(error, file=sys.stderr) sys.exit(1)
def test_prune_archives_with_verbose_should_call_attic_with_verbose_parameters(): insert_subprocess_mock( ( 'attic', 'prune', 'repo', '--keep-daily', '1', '--keep-weekly', '2', '--keep-monthly', '3', '--verbose', ), ) module.prune_archives( repository='repo', verbose=True, keep_daily=1, keep_weekly=2, keep_monthly=3 )
def test_prune_archives_should_call_attic_with_parameters(): retention_config = flexmock() flexmock(module).should_receive('_make_prune_flags').with_args(retention_config).and_return( BASE_PRUNE_FLAGS, ) insert_subprocess_mock( ( 'attic', 'prune', 'repo', '--keep-daily', '1', '--keep-weekly', '2', '--keep-monthly', '3', ), ) module.prune_archives( verbose=False, repository='repo', retention_config=retention_config, )
def test_prune_archives_should_call_attic_with_parameters(): retention_config = flexmock() flexmock(module).should_receive('make_prune_flags').with_args( retention_config).and_return(BASE_PRUNE_FLAGS, ) insert_subprocess_mock(( 'attic', 'prune', 'repo', '--keep-daily', '1', '--keep-weekly', '2', '--keep-monthly', '3', ), ) module.prune_archives( verbose=False, repository='repo', retention_config=retention_config, )