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 test_create_archive_should_call_attic_with_parameters(): insert_subprocess_mock(('attic', 'create', '--exclude-from', 'excludes', 'repo::host-now', 'foo', 'bar'), ) insert_platform_mock() insert_datetime_mock() module.create_archive( excludes_filename='excludes', verbose=False, source_directories='foo bar', repository='repo', )
def test_create_archive_should_call_attic_with_parameters(): insert_subprocess_mock( ('attic', 'create', '--exclude-from', 'excludes', 'repo::host-now', 'foo', 'bar'), ) insert_platform_mock() insert_datetime_mock() module.create_archive( excludes_filename='excludes', verbose=False, source_directories='foo bar', repository='repo', )
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)