mirror of
https://github.com/netinvent/npbackup.git
synced 2024-11-10 09:03:02 +08:00
Reformat files with black
This commit is contained in:
parent
93b892c3e6
commit
83dcb55b17
5 changed files with 24 additions and 8 deletions
|
@ -28,4 +28,6 @@ for audience in audiences:
|
||||||
exe_path = os.path.join(basepath, audience, "windows", arch, binary)
|
exe_path = os.path.join(basepath, audience, "windows", arch, binary)
|
||||||
result = signer.sign(exe_path, bitness=arch)
|
result = signer.sign(exe_path, bitness=arch)
|
||||||
if not result:
|
if not result:
|
||||||
raise EnvironmentError("Could not sign executable ! Is the PKI key connected ?")
|
raise EnvironmentError(
|
||||||
|
"Could not sign executable ! Is the PKI key connected ?"
|
||||||
|
)
|
||||||
|
|
|
@ -80,9 +80,15 @@ def metric_writer(config_dict: dict, restic_result: bool, result_string: str):
|
||||||
if additional_label:
|
if additional_label:
|
||||||
try:
|
try:
|
||||||
label, value = additional_label.split("=")
|
label, value = additional_label.split("=")
|
||||||
label_string += ',{}="{}"'.format(label.strip(), value.strip())
|
label_string += ',{}="{}"'.format(
|
||||||
|
label.strip(), value.strip()
|
||||||
|
)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logger.error("Bogus additional label \"{}\" defined in configuration.".format(additional_label))
|
logger.error(
|
||||||
|
'Bogus additional label "{}" defined in configuration.'.format(
|
||||||
|
additional_label
|
||||||
|
)
|
||||||
|
)
|
||||||
except (KeyError, AttributeError, TypeError):
|
except (KeyError, AttributeError, TypeError):
|
||||||
logger.error("Bogus additional labels defined in configuration.")
|
logger.error("Bogus additional labels defined in configuration.")
|
||||||
logger.debug("Trace:", exc_info=True)
|
logger.debug("Trace:", exc_info=True)
|
||||||
|
@ -360,12 +366,15 @@ class NPBackupRunner:
|
||||||
key, value = env_variable.split("=")
|
key, value = env_variable.split("=")
|
||||||
expanded_env_vars[key.strip()] = value.strip()
|
expanded_env_vars[key.strip()] = value.strip()
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logger.error("Bogus environment variable \"{}\" defined in configuration.".format(env_variable))
|
logger.error(
|
||||||
|
'Bogus environment variable "{}" defined in configuration.'.format(
|
||||||
|
env_variable
|
||||||
|
)
|
||||||
|
)
|
||||||
except (KeyError, AttributeError, TypeError):
|
except (KeyError, AttributeError, TypeError):
|
||||||
logger.error("Bogus environment variables defined in configuration.")
|
logger.error("Bogus environment variables defined in configuration.")
|
||||||
logger.debug("Trace:", exc_info=True)
|
logger.debug("Trace:", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.restic_runner.environment_variables = expanded_env_vars
|
self.restic_runner.environment_variables = expanded_env_vars
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
|
@ -76,7 +76,7 @@ def config_gui(config_dict: dict, config_file: str):
|
||||||
"password_command",
|
"password_command",
|
||||||
"auto_upgrade_server_username",
|
"auto_upgrade_server_username",
|
||||||
"auto_upgrade_server_password",
|
"auto_upgrade_server_password",
|
||||||
"encrypted_variables"
|
"encrypted_variables",
|
||||||
]:
|
]:
|
||||||
try:
|
try:
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -241,7 +241,12 @@ def upload_metrics(destination, authentication, no_cert_verify, metrics):
|
||||||
data += "{}\n".format(metric)
|
data += "{}\n".format(metric)
|
||||||
logger.debug("metrics:\n{}".format(data))
|
logger.debug("metrics:\n{}".format(data))
|
||||||
result = requests.post(
|
result = requests.post(
|
||||||
destination, headers=headers, data=data, auth=authentication, timeout=4, verify=not no_cert_verify
|
destination,
|
||||||
|
headers=headers,
|
||||||
|
data=data,
|
||||||
|
auth=authentication,
|
||||||
|
timeout=4,
|
||||||
|
verify=not no_cert_verify,
|
||||||
)
|
)
|
||||||
if result.status_code == 200:
|
if result.status_code == 200:
|
||||||
logger.info("Metrics pushed succesfully.")
|
logger.info("Metrics pushed succesfully.")
|
||||||
|
|
|
@ -104,7 +104,7 @@ class ResticRunner:
|
||||||
self.repository = None
|
self.repository = None
|
||||||
|
|
||||||
for env_variable, value in self.environment_variables.items():
|
for env_variable, value in self.environment_variables.items():
|
||||||
logger.warning("Setting envrionment variable \"{}\"".format(env_variable))
|
logger.warning('Setting envrionment variable "{}"'.format(env_variable))
|
||||||
os.environ[env_variable] = value
|
os.environ[env_variable] = value
|
||||||
|
|
||||||
def _remove_env(self) -> None:
|
def _remove_env(self) -> None:
|
||||||
|
|
Loading…
Reference in a new issue