export_tar.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import logging
  2. import borgmatic.borg.export_tar
  3. import borgmatic.borg.repo_list
  4. import borgmatic.config.validate
  5. logger = logging.getLogger(__name__)
  6. def run_export_tar(
  7. repository,
  8. config,
  9. local_borg_version,
  10. export_tar_arguments,
  11. global_arguments,
  12. local_path,
  13. remote_path,
  14. ):
  15. '''
  16. Run the "export-tar" action for the given repository.
  17. '''
  18. if export_tar_arguments.repository is None or borgmatic.config.validate.repositories_match(
  19. repository,
  20. export_tar_arguments.repository,
  21. ):
  22. logger.info(f'Exporting archive {export_tar_arguments.archive} as tar file')
  23. borgmatic.borg.export_tar.export_tar_archive(
  24. global_arguments.dry_run,
  25. repository['path'],
  26. borgmatic.borg.repo_list.resolve_archive_name(
  27. repository['path'],
  28. export_tar_arguments.archive,
  29. config,
  30. local_borg_version,
  31. global_arguments,
  32. local_path,
  33. remote_path,
  34. ),
  35. export_tar_arguments.paths,
  36. export_tar_arguments.destination,
  37. config,
  38. local_borg_version,
  39. global_arguments,
  40. local_path=local_path,
  41. remote_path=remote_path,
  42. tar_filter=export_tar_arguments.tar_filter,
  43. strip_components=export_tar_arguments.strip_components,
  44. )