Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/vorta/borg/_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ def set_version(self, version, path):

def check(self, feature_name):
return Version(self.version) >= MIN_BORG_FOR_FEATURE[feature_name]

def get_version(self):
"""Returns the version and path of the Borg binary."""
return self.version, self.path
14 changes: 13 additions & 1 deletion src/vorta/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import socket
import sys
import unicodedata
import uuid
from datetime import datetime as dt
from datetime import timezone as tz
from functools import reduce
from typing import Any, Callable, Iterable, List, Optional, Tuple, TypeVar

Expand Down Expand Up @@ -417,14 +419,24 @@ def format_archive_name(profile, archive_name_tpl):
"""
hostname = socket.gethostname()
hostname = hostname.split(".")[0]
borg_version = borg_compat.get_version()[0] # Getting only borg version
borg_version_tuple = tuple(borg_version.split("."))
available_vars = {
"pid": os.getpid(),
'hostname': hostname,
'fqdn': _getfqdn(hostname),
"reverse-fqdn": ".".join(reversed(_getfqdn(hostname).split("."))),
'profile_id': profile.id,
'profile_slug': profile.slug(),
'now': dt.now(),
'utc_now': dt.utcnow(),
'utc_now': dt.now(tz.utc),
'utcnow': dt.now(tz.utc),
'user': getpass.getuser(),
"uuid4": str(uuid.uuid4()),
'borgversion': borg_version,
'borgmajor': "%s" % borg_version_tuple[:1],
'borgminor': "%s.%s" % borg_version_tuple[:2],
'borgpatch': "%s.%s.%s" % borg_version_tuple[:3],
}
return archive_name_tpl.format(**available_vars)

Expand Down
Loading