machine: abort validation if the backup config is loaded

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-10-21 08:15:45 -04:00
parent 1190aba4b7
commit 4df0b4d532
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
2 changed files with 12 additions and 1 deletions

View File

@ -1226,6 +1226,14 @@ class InstallValidator:
msg += ", force is enabled"
logging.info(msg)
self.validation_enabled = self.force_validation
is_bkp_cfg = self.server.get_app_args().get("is_backup_config", False)
if self.validation_enabled and is_bkp_cfg:
self.server.add_warning(
"Backup configuration loaded, aborting install validation. "
"Please correct the configuration issue and restart moonraker."
)
self.validation_enabled = False
return
async def perform_validation(self) -> bool:
db: MoonrakerDatabase = self.server.lookup_component("database")

View File

@ -469,7 +469,8 @@ def main(cmd_line_args: argparse.Namespace) -> None:
"startup_warnings": startup_warnings,
"verbose": cmd_line_args.verbose,
"debug": cmd_line_args.debug,
"asyncio_debug": cmd_line_args.asyncio_debug
"asyncio_debug": cmd_line_args.asyncio_debug,
"is_backup_config": False
}
# Setup Logging
@ -502,6 +503,7 @@ def main(cmd_line_args: argparse.Namespace) -> None:
estatus = 1
break
app_args["config_file"] = backup_cfg
app_args["is_backup_config"] = True
warn_list = list(startup_warnings)
app_args["startup_warnings"] = warn_list
warn_list.append(
@ -531,6 +533,7 @@ def main(cmd_line_args: argparse.Namespace) -> None:
if alt_config_loaded:
app_args["config_file"] = cfg_file
app_args["startup_warnings"] = startup_warnings
app_args["is_backup_config"] = False
alt_config_loaded = False
event_loop.close()
# Since we are running outside of the the server