mirror of
https://github.com/netinvent/npbackup.git
synced 2025-10-08 04:34:46 +08:00
Upgrade server: log more errors
This commit is contained in:
parent
da47e27203
commit
af48ded735
1 changed files with 8 additions and 7 deletions
|
@ -7,7 +7,7 @@ __intname__ = "npbackup.upgrade_server.crud"
|
||||||
__author__ = "Orsiris de Jong"
|
__author__ = "Orsiris de Jong"
|
||||||
__copyright__ = "Copyright (C) 2023-2024 NetInvent"
|
__copyright__ = "Copyright (C) 2023-2024 NetInvent"
|
||||||
__license__ = "GPL-3.0-only"
|
__license__ = "GPL-3.0-only"
|
||||||
__build__ = "2023020601"
|
__build__ = "2024091701"
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@ -66,8 +66,9 @@ def store_host_info(destination: str, host_id: dict) -> None:
|
||||||
)
|
)
|
||||||
with open(destination, "a", encoding="utf-8") as fpw:
|
with open(destination, "a", encoding="utf-8") as fpw:
|
||||||
fpw.write(data)
|
fpw.write(data)
|
||||||
except OSError:
|
except OSError as exc:
|
||||||
logger.error("Cannot write statistics file")
|
logger.error("Cannot write statistics file")
|
||||||
|
logger.error("Trace:", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
def get_current_version() -> Optional[CurrentVersion]:
|
def get_current_version() -> Optional[CurrentVersion]:
|
||||||
|
@ -77,16 +78,16 @@ def get_current_version() -> Optional[CurrentVersion]:
|
||||||
with open(path, "r", encoding="utf-8") as fh:
|
with open(path, "r", encoding="utf-8") as fh:
|
||||||
ver = fh.readline().strip()
|
ver = fh.readline().strip()
|
||||||
return CurrentVersion(version=ver)
|
return CurrentVersion(version=ver)
|
||||||
except OSError:
|
except OSError as exc:
|
||||||
logger.error("Cannot get current version")
|
logger.error("Cannot get current version")
|
||||||
except Exception:
|
logger.error("Trace:", exc_info=True)
|
||||||
|
except Exception as exc:
|
||||||
logger.error("Version seems to be bogus in VERSION file")
|
logger.error("Version seems to be bogus in VERSION file")
|
||||||
|
logger.error("Trace:", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
def get_file(file: FileGet, content: bool = False) -> Optional[Union[FileSend, bytes]]:
|
def get_file(file: FileGet, content: bool = False) -> Optional[Union[FileSend, bytes]]:
|
||||||
possible_filename = "npbackup{}".format(
|
possible_filename = "npbackup.zip"
|
||||||
".exe" if file.platform.value == "windows" else ""
|
|
||||||
)
|
|
||||||
path = os.path.join(
|
path = os.path.join(
|
||||||
config_dict["upgrades"]["data_root"],
|
config_dict["upgrades"]["data_root"],
|
||||||
file.platform.value,
|
file.platform.value,
|
||||||
|
|
Loading…
Add table
Reference in a new issue