From 573c8e8d05d23619ec644e41de11d5bcc5857920 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Thu, 16 Dec 2021 14:39:30 +1300 Subject: [PATCH] do not accept probert results after user has submitted a filesystem config For https://bugs.launchpad.net/bugs/1954848 --- subiquity/server/controllers/filesystem.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/subiquity/server/controllers/filesystem.py b/subiquity/server/controllers/filesystem.py index aba290d3..0b0501d4 100644 --- a/subiquity/server/controllers/filesystem.py +++ b/subiquity/server/controllers/filesystem.py @@ -75,6 +75,8 @@ class FilesystemController(SubiquityController, FilesystemManipulator): autoinstall_schema = {'type': 'object'} # ... model_name = "filesystem" + _configured = False + def __init__(self, app): self.ai_data = {} super().__init__(app) @@ -104,6 +106,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator): self.ai_data = data async def configured(self): + self._configured = True await super().configured() self.stop_listening_udev() @@ -393,6 +396,12 @@ class FilesystemController(SubiquityController, FilesystemManipulator): key = "ProbeData" storage = await run_in_thread( self.app.prober.get_storage, probe_types) + # It is possible for the user to submit filesystem config + # while a probert probe is running. We don't want to overwrite + # the users config with a blank one if this happens! (See + # https://bugs.launchpad.net/bugs/1954848). + if self._configured: + return fpath = os.path.join(self.app.block_log_dir, fname) with open(fpath, 'w') as fp: json.dump(storage, fp, indent=4)