From a798a2466fecaefdf5e17abf2be7d1e01ed4ed79 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Mon, 8 Feb 2021 10:45:34 +0100 Subject: [PATCH] Change Supervisor update flow with AppArmor (#2529) --- supervisor/supervisor.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/supervisor/supervisor.py b/supervisor/supervisor.py index fe7329d75..32d55f52c 100644 --- a/supervisor/supervisor.py +++ b/supervisor/supervisor.py @@ -125,6 +125,14 @@ class Supervisor(CoreSysAttributes): _LOGGER.warning("Version %s is already installed", version) return + # First update own AppArmor + try: + await self.update_apparmor() + except SupervisorError as err: + _LOGGER.critical("Abort update because of an issue with AppArmor!") + raise SupervisorUpdateError() from err + + # Update container _LOGGER.info("Update Supervisor to version %s", version) try: await self.instance.install( @@ -144,8 +152,6 @@ class Supervisor(CoreSysAttributes): self.sys_config.version = version self.sys_config.save_data() - with suppress(SupervisorError): - await self.update_apparmor() self.sys_create_task(self.sys_core.stop()) @Job(conditions=[JobCondition.RUNNING], on_condition=SupervisorJobError)