mirror of https://github.com/borgbackup/borg.git
Refactor: call getfqdn() once per call of replace_placeholders()
This commit is contained in:
parent
85fb38e2f3
commit
294f06b565
|
@ -180,10 +180,11 @@ def format_line(format, data):
|
||||||
def replace_placeholders(text):
|
def replace_placeholders(text):
|
||||||
"""Replace placeholders in text with their values."""
|
"""Replace placeholders in text with their values."""
|
||||||
current_time = datetime.now()
|
current_time = datetime.now()
|
||||||
|
fqdn = socket.getfqdn()
|
||||||
data = {
|
data = {
|
||||||
'pid': os.getpid(),
|
'pid': os.getpid(),
|
||||||
'fqdn': socket.getfqdn(),
|
'fqdn': fqdn,
|
||||||
'reverse-fqdn': '.'.join(reversed(socket.getfqdn().split('.'))),
|
'reverse-fqdn': '.'.join(reversed(fqdn.split('.'))),
|
||||||
'hostname': socket.gethostname(),
|
'hostname': socket.gethostname(),
|
||||||
'now': DatetimeWrapper(current_time.now()),
|
'now': DatetimeWrapper(current_time.now()),
|
||||||
'utcnow': DatetimeWrapper(current_time.utcnow()),
|
'utcnow': DatetimeWrapper(current_time.utcnow()),
|
||||||
|
|
Loading…
Reference in New Issue