Block shutdown controller on installation done

A race existed due to ~he shutdown controller not waiting for the
install task to be complete.

Co-authored-by: Didier Roche <didrocks@ubuntu.com>
This commit is contained in:
Jean-Baptiste Lallement 2021-09-09 15:01:47 +02:00 committed by Didier Roche
parent fecd1cc68c
commit 44b0b66531
1 changed files with 6 additions and 2 deletions

View File

@ -31,10 +31,14 @@ class SetupShutdownController(ShutdownController):
self.app.controllers.Install = self.app.controllers.Configure
def start(self):
# Do not copy logs to target
self.server_reboot_event.set()
self.app.aio_loop.create_task(self._wait_install())
self.app.aio_loop.create_task(self._run())
async def _wait_install(self):
await self.app.controllers.Install.install_task
await self.app.controllers.Late.run_event.wait()
self.server_reboot_event.set()
@with_context(description='mode={self.mode.name}')
def shutdown(self, context):
self.shuttingdown_event.set()