mirror of
https://github.com/netinvent/npbackup.git
synced 2024-09-20 06:46:13 +08:00
Reformat files with black
This commit is contained in:
parent
93b892c3e6
commit
83dcb55b17
|
@ -28,4 +28,6 @@ for audience in audiences:
|
|||
exe_path = os.path.join(basepath, audience, "windows", arch, binary)
|
||||
result = signer.sign(exe_path, bitness=arch)
|
||||
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:
|
||||
try:
|
||||
label, value = additional_label.split("=")
|
||||
label_string += ',{}="{}"'.format(label.strip(), value.strip())
|
||||
label_string += ',{}="{}"'.format(
|
||||
label.strip(), value.strip()
|
||||
)
|
||||
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):
|
||||
logger.error("Bogus additional labels defined in configuration.")
|
||||
logger.debug("Trace:", exc_info=True)
|
||||
|
@ -360,12 +366,15 @@ class NPBackupRunner:
|
|||
key, value = env_variable.split("=")
|
||||
expanded_env_vars[key.strip()] = value.strip()
|
||||
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):
|
||||
logger.error("Bogus environment variables defined in configuration.")
|
||||
logger.debug("Trace:", exc_info=True)
|
||||
|
||||
|
||||
try:
|
||||
self.restic_runner.environment_variables = expanded_env_vars
|
||||
except ValueError:
|
||||
|
|
|
@ -76,7 +76,7 @@ def config_gui(config_dict: dict, config_file: str):
|
|||
"password_command",
|
||||
"auto_upgrade_server_username",
|
||||
"auto_upgrade_server_password",
|
||||
"encrypted_variables"
|
||||
"encrypted_variables",
|
||||
]:
|
||||
try:
|
||||
if (
|
||||
|
|
|
@ -241,7 +241,12 @@ def upload_metrics(destination, authentication, no_cert_verify, metrics):
|
|||
data += "{}\n".format(metric)
|
||||
logger.debug("metrics:\n{}".format(data))
|
||||
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:
|
||||
logger.info("Metrics pushed succesfully.")
|
||||
|
|
|
@ -104,7 +104,7 @@ class ResticRunner:
|
|||
self.repository = None
|
||||
|
||||
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
|
||||
|
||||
def _remove_env(self) -> None:
|
||||
|
|
Loading…
Reference in a new issue