mirror of
https://github.com/netinvent/npbackup.git
synced 2025-10-26 13:27:11 +08:00
!fixup Make config file version comparaison version aware
This commit is contained in:
parent
ab3a4efc28
commit
41f5eca747
1 changed files with 7 additions and 5 deletions
|
|
@ -834,7 +834,7 @@ def _load_config_file(config_file: Path) -> Union[bool, dict]:
|
||||||
logger.critical(f"Config file {config_file} seems empty !")
|
logger.critical(f"Config file {config_file} seems empty !")
|
||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
conf_version = version.parse(full_config.g("conf_version"))
|
conf_version = version.parse(str(full_config.g("conf_version")))
|
||||||
if conf_version < version.parse(
|
if conf_version < version.parse(
|
||||||
MIN_CONF_VERSION
|
MIN_CONF_VERSION
|
||||||
) or conf_version > version.parse(MAX_CONF_VERSION):
|
) or conf_version > version.parse(MAX_CONF_VERSION):
|
||||||
|
|
@ -842,17 +842,19 @@ def _load_config_file(config_file: Path) -> Union[bool, dict]:
|
||||||
f"Config file version {str(conf_version)} is not in required version range min={MIN_CONF_VERSION}, max={MAX_CONF_VERSION}"
|
f"Config file version {str(conf_version)} is not in required version range min={MIN_CONF_VERSION}, max={MAX_CONF_VERSION}"
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
except (AttributeError, TypeError):
|
except (AttributeError, TypeError) as exc:
|
||||||
logger.critical(
|
logger.critical(
|
||||||
f"Cannot read conf version from config file {config_file}, which seems bogus"
|
f"Cannot read conf version from config file {config_file}, which seems bogus: {exc}"
|
||||||
)
|
)
|
||||||
|
logger.debug("Trace:", exc_info=True)
|
||||||
return False
|
return False
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Loaded config {_get_config_file_checksum(config_file)} in {config_file.absolute()}"
|
f"Loaded config {_get_config_file_checksum(config_file)} in {config_file.absolute()}"
|
||||||
)
|
)
|
||||||
return full_config
|
return full_config
|
||||||
except OSError:
|
except OSError as exc:
|
||||||
logger.critical(f"Cannot load configuration file from {config_file}")
|
logger.critical(f"Cannot load configuration file from {config_file}: {exc}")
|
||||||
|
logger.debut("Trace:", exc_info=True)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue