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
5f211ca0ba
commit
d025a57346
|
@ -107,8 +107,9 @@ def run_upgrade(full_config: dict, ignore_errors: bool = False) -> bool:
|
||||||
logger.warning(f"Missing auto upgrade info, cannot launch auto upgrade")
|
logger.warning(f"Missing auto upgrade info, cannot launch auto upgrade")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
evaluated_full_config = npbackup.configuration.evaluate_variables(
|
||||||
evaluated_full_config = npbackup.configuration.evaluate_variables(full_config, full_config)
|
full_config, full_config
|
||||||
|
)
|
||||||
auto_upgrade_host_identity = evaluated_full_config.g(
|
auto_upgrade_host_identity = evaluated_full_config.g(
|
||||||
"global_options.auto_upgrade_host_identity"
|
"global_options.auto_upgrade_host_identity"
|
||||||
)
|
)
|
||||||
|
|
|
@ -148,9 +148,7 @@ def auto_upgrader(
|
||||||
if IS_LEGACY:
|
if IS_LEGACY:
|
||||||
platform_and_arch += "-legacy"
|
platform_and_arch += "-legacy"
|
||||||
try:
|
try:
|
||||||
host_id = "{}/{}/{}".format(
|
host_id = "{}/{}/{}".format(auto_upgrade_host_identity, npbackup_version, group)
|
||||||
auto_upgrade_host_identity, npbackup_version, group
|
|
||||||
)
|
|
||||||
id_record = "{}/{}".format(platform_and_arch, host_id)
|
id_record = "{}/{}".format(platform_and_arch, host_id)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
id_record = platform_and_arch
|
id_record = platform_and_arch
|
||||||
|
|
|
@ -124,7 +124,9 @@ async def current_version(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.get("/upgrades/{platform}/{arch}", response_model=Union[FileSend, dict], status_code=200)
|
@app.get(
|
||||||
|
"/upgrades/{platform}/{arch}", response_model=Union[FileSend, dict], status_code=200
|
||||||
|
)
|
||||||
@app.get(
|
@app.get(
|
||||||
"/upgrades/{platform}/{arch}/{auto_upgrade_host_identity}",
|
"/upgrades/{platform}/{arch}/{auto_upgrade_host_identity}",
|
||||||
response_model=Union[FileSend, dict],
|
response_model=Union[FileSend, dict],
|
||||||
|
|
|
@ -86,7 +86,9 @@ def get_current_version() -> Optional[CurrentVersion]:
|
||||||
logger.error("Trace:", exc_info=True)
|
logger.error("Trace:", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
def get_file(file: FileGet, content: bool = False) -> Optional[Union[FileSend, bytes, dict]]:
|
def get_file(
|
||||||
|
file: FileGet, content: bool = False
|
||||||
|
) -> Optional[Union[FileSend, bytes, dict]]:
|
||||||
possible_filename = "npbackup.zip"
|
possible_filename = "npbackup.zip"
|
||||||
path = os.path.join(
|
path = os.path.join(
|
||||||
config_dict["upgrades"]["data_root"],
|
config_dict["upgrades"]["data_root"],
|
||||||
|
@ -104,7 +106,7 @@ def get_file(file: FileGet, content: bool = False) -> Optional[Union[FileSend, b
|
||||||
"filename": None,
|
"filename": None,
|
||||||
"file_length": 0,
|
"file_length": 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
with open(path, "rb") as fh:
|
with open(path, "rb") as fh:
|
||||||
bytes = fh.read()
|
bytes = fh.read()
|
||||||
if content:
|
if content:
|
||||||
|
|
Loading…
Reference in a new issue