Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new placeholder keys #1956

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AdwaitSalankar
Copy link
Contributor

Description

Added some Placeholder keys to vorta

Related Issue

Fixes #1954

Screenshots:

Screenshot from 2024-03-06 00-37-20

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the CONTRIBUTING guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.

Comment on lines +420 to +425
fqdn = _getfqdn(hostname)
borg_version = os.getenv("BORG_VERSION")
if not borg_version:
borg_version = subprocess.run(['borg', '--version'], stdout=subprocess.PIPE).stdout.decode('utf-8')
borg_version = borg_version.split(' ')[1]
borg_version_tuple = tuple(borg_version.split("."))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vorta already queries borg version information on startup. Why not use that?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vorta already queries borg version information on startup. Why not use that?

I get circular import error when importing borg_compat in utils.py:
ImportError: cannot import name 'borg_compat' from partially initialized module 'vorta.utils' (most likely due to a circular import). This is probably why borg version is being queried again here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, be aware of circular imports. Helper functions and modules should only be used by higher level. So maybe format_archive_name() should be moved elsewhere, since it uses helper functions now.

@m3nu m3nu marked this pull request as draft May 25, 2024 13:04
fqdn = _getfqdn(hostname)
borg_version = os.getenv("BORG_VERSION")
if not borg_version:
borg_version = subprocess.run(['borg', '--version'], stdout=subprocess.PIPE).stdout.decode('utf-8')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are basically sidestepping everything we do to correctly detect the right borg binary. So while this may work in many cases, it will break in others. So as already mentioned before, it will be better to use the existing borg_compat module.

@m3nu
Copy link
Contributor

m3nu commented May 25, 2024

Added 2 comments. A third issue is documenting those new keys. Can we add them in a tooltip? Should there be a docs link?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to use some placeholders in archive names
4 participants