mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-23 14:41:43 +00:00
Refactor: call getfqdn() once per call of replace_placeholders()
This commit is contained in:
parent
85fb38e2f3
commit
294f06b565
1 changed files with 3 additions and 2 deletions
|
@ -180,10 +180,11 @@ def format_line(format, data):
|
|||
def replace_placeholders(text):
|
||||
"""Replace placeholders in text with their values."""
|
||||
current_time = datetime.now()
|
||||
fqdn = socket.getfqdn()
|
||||
data = {
|
||||
'pid': os.getpid(),
|
||||
'fqdn': socket.getfqdn(),
|
||||
'reverse-fqdn': '.'.join(reversed(socket.getfqdn().split('.'))),
|
||||
'fqdn': fqdn,
|
||||
'reverse-fqdn': '.'.join(reversed(fqdn.split('.'))),
|
||||
'hostname': socket.gethostname(),
|
||||
'now': DatetimeWrapper(current_time.now()),
|
||||
'utcnow': DatetimeWrapper(current_time.utcnow()),
|
||||
|
|
Loading…
Reference in a new issue