Don't expand config to empty strings

This commit is contained in:
deajan 2024-05-09 13:51:28 +02:00
parent 0f6436ea15
commit 2e363593b9
2 changed files with 4 additions and 1 deletions

View file

@ -376,6 +376,8 @@ def evaluate_variables(repo_config: dict, full_config: dict) -> dict:
if "${HOSTNAME}" in value:
value = value.replace("${HOSTNAME}", platform.node())
if value == "":
value = None
return value
# We need to make a loop to catch all nested variables (ie variable in a variable)

View file

@ -178,7 +178,8 @@ def restic_json_to_prometheus(
"""
_labels = []
for key, value in labels.items():
_labels.append(f'{key.strip()}="{value.strip()}"')
if value:
_labels.append(f'{key.strip()}="{value.strip()}"')
labels = ",".join(_labels)
# Take last line of restic output