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
cbe34c4819
commit
cbade449b2
|
@ -468,7 +468,9 @@ This is free software, and you are welcome to redistribute it under certain cond
|
|||
logger.info("Running program initiated auto upgrade")
|
||||
# Don't log upgrade check errors if we're in auto upgrade mode
|
||||
# since it will change the whole exit code of the program
|
||||
result = upgrade_runner.run_upgrade(full_config, ignore_errors=False if args.auto_upgrade else True)
|
||||
result = upgrade_runner.run_upgrade(
|
||||
full_config, ignore_errors=False if args.auto_upgrade else True
|
||||
)
|
||||
if result:
|
||||
sys.exit(0)
|
||||
elif args.auto_upgrade:
|
||||
|
|
|
@ -119,7 +119,7 @@ def metric_writer(
|
|||
metrics.append(
|
||||
f'npbackup_exec_state{{{labels},action="{operation}",repo_name="{repo_name}",timestamp="{int(datetime.now(timezone.utc).timestamp())}"}} {exec_state}'
|
||||
)
|
||||
|
||||
|
||||
# Add upgrade state if upgrades activated
|
||||
upgrade_state = os.environ.get("NPBACKUP_UPGRADE_STATE", None)
|
||||
try:
|
||||
|
|
|
@ -119,6 +119,6 @@ def run_upgrade(full_config: dict, ignore_errors: bool = False) -> bool:
|
|||
auto_upgrade_host_identity=auto_upgrade_host_identity,
|
||||
installed_version=npbackup_version,
|
||||
group=group,
|
||||
ignore_errors=ignore_errors
|
||||
ignore_errors=ignore_errors,
|
||||
)
|
||||
return result
|
||||
|
|
|
@ -42,7 +42,9 @@ def sha256sum_data(data):
|
|||
return sha256.hexdigest()
|
||||
|
||||
|
||||
def _check_new_version(upgrade_url: str, username: str, password: str, ignore_errors: bool = False) -> bool:
|
||||
def _check_new_version(
|
||||
upgrade_url: str, username: str, password: str, ignore_errors: bool = False
|
||||
) -> bool:
|
||||
"""
|
||||
Check if we have a newer version of npbackup
|
||||
"""
|
||||
|
@ -122,13 +124,15 @@ def auto_upgrader(
|
|||
We must check that we run a compiled binary first
|
||||
We assume that we run a onefile nuitka binary
|
||||
"""
|
||||
if not IS_COMPILED and False: #WIP
|
||||
if not IS_COMPILED and False: # WIP
|
||||
logger.info(
|
||||
"Auto upgrade will only upgrade compiled verions. Please use 'pip install --upgrade npbackup' instead"
|
||||
)
|
||||
return False
|
||||
|
||||
res = _check_new_version(upgrade_url, username, password, ignore_errors=ignore_errors)
|
||||
res = _check_new_version(
|
||||
upgrade_url, username, password, ignore_errors=ignore_errors
|
||||
)
|
||||
# Let's set a global environment variable which we can check later in metrics
|
||||
os.environ["NPBACKUP_UPGRADE_STATE"] = "0"
|
||||
if not res:
|
||||
|
|
Loading…
Reference in a new issue