Merge pull request #1146 from mwhudson/lp-1954848

do not accept probert results after user has submitted a filesystem config
This commit is contained in:
Dan Bungert 2022-01-10 08:51:45 -07:00 committed by GitHub
commit 540049143d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -75,6 +75,8 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
autoinstall_schema = {'type': 'object'} # ... autoinstall_schema = {'type': 'object'} # ...
model_name = "filesystem" model_name = "filesystem"
_configured = False
def __init__(self, app): def __init__(self, app):
self.ai_data = {} self.ai_data = {}
super().__init__(app) super().__init__(app)
@ -104,6 +106,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
self.ai_data = data self.ai_data = data
async def configured(self): async def configured(self):
self._configured = True
await super().configured() await super().configured()
self.stop_listening_udev() self.stop_listening_udev()
@ -393,6 +396,12 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
key = "ProbeData" key = "ProbeData"
storage = await run_in_thread( storage = await run_in_thread(
self.app.prober.get_storage, probe_types) 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) fpath = os.path.join(self.app.block_log_dir, fname)
with open(fpath, 'w') as fp: with open(fpath, 'w') as fp:
json.dump(storage, fp, indent=4) json.dump(storage, fp, indent=4)