Merge pull request #1832 from ogayot/variation-bug
Fix crash when switching sources having different variations
This commit is contained in:
commit
7549af4ad0
|
@ -1,4 +1,4 @@
|
|||
#source-catalog: examples/sources/desktop.yaml
|
||||
#source-catalog: examples/sources/desktop-standard.yaml
|
||||
Source:
|
||||
source: ubuntu-desktop
|
||||
Welcome:
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
- default: true
|
||||
description:
|
||||
en: A full featured Ubuntu Desktop.
|
||||
id: ubuntu-desktop
|
||||
locale_support: langpack
|
||||
name:
|
||||
en: Ubuntu Desktop
|
||||
path: standard.squashfs
|
||||
preinstalled_langs:
|
||||
- de
|
||||
- en
|
||||
- es
|
||||
- fr
|
||||
- it
|
||||
- pt
|
||||
- ru
|
||||
- zh
|
||||
- ''
|
||||
size: 4033826816
|
||||
type: fsimage-layered
|
||||
variant: desktop
|
||||
variations:
|
||||
enhanced-secureboot:
|
||||
path: standard.enhanced-secureboot.squashfs
|
||||
size: 4336062464
|
||||
snapd_system_label: enhanced-secureboot-desktop
|
||||
standard:
|
||||
path: standard.squashfs
|
||||
size: 4033826816
|
|
@ -1,11 +1,11 @@
|
|||
- default: true
|
||||
description:
|
||||
en: A full featured Ubuntu Desktop.
|
||||
id: ubuntu-desktop
|
||||
en: A minimal but usable Ubuntu Desktop.
|
||||
id: ubuntu-desktop-minimal
|
||||
locale_support: langpack
|
||||
name:
|
||||
en: Ubuntu Desktop
|
||||
path: standard.squashfs
|
||||
en: Ubuntu Desktop (minimized)
|
||||
path: minimal.squashfs
|
||||
preinstalled_langs:
|
||||
- de
|
||||
- en
|
||||
|
@ -16,14 +16,42 @@
|
|||
- ru
|
||||
- zh
|
||||
- ''
|
||||
size: 4033826816
|
||||
size: 4015337472
|
||||
type: fsimage-layered
|
||||
variant: desktop
|
||||
variations:
|
||||
minimal:
|
||||
path: minimal.squashfs
|
||||
size: 4015337472
|
||||
minimal-enhanced-secureboot:
|
||||
path: minimal.enhanced-secureboot.squashfs
|
||||
size: 4319010816
|
||||
snapd_system_label: enhanced-secureboot-desktop
|
||||
- description:
|
||||
en: A full featured Ubuntu Desktop.
|
||||
id: ubuntu-desktop
|
||||
locale_support: langpack
|
||||
name:
|
||||
en: Ubuntu Desktop
|
||||
path: minimal.standard.squashfs
|
||||
preinstalled_langs:
|
||||
- de
|
||||
- en
|
||||
- es
|
||||
- fr
|
||||
- it
|
||||
- pt
|
||||
- ru
|
||||
- zh
|
||||
- ''
|
||||
size: 5735194624
|
||||
type: fsimage-layered
|
||||
variant: desktop
|
||||
variations:
|
||||
enhanced-secureboot:
|
||||
path: standard.enhanced-secureboot.squashfs
|
||||
size: 4336062464
|
||||
path: minimal.standard.enhanced-secureboot.squashfs
|
||||
size: 6006235136
|
||||
snapd_system_label: enhanced-secureboot-desktop
|
||||
standard:
|
||||
path: standard.squashfs
|
||||
size: 4033826816
|
||||
path: minimal.standard.squashfs
|
||||
size: 5735194624
|
||||
|
|
|
@ -404,6 +404,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
|||
return info
|
||||
|
||||
async def _examine_systems(self):
|
||||
self._variation_info.clear()
|
||||
catalog_entry = self.app.base_model.source.current
|
||||
for name, variation in catalog_entry.variations.items():
|
||||
system = None
|
||||
|
|
|
@ -369,6 +369,36 @@ class TestSubiquityControllerFilesystem(IsolatedAsyncioTestCase):
|
|||
await self.fsc._pre_shutdown()
|
||||
mock_run.assert_called_once_with(["mountpoint", "/target"])
|
||||
|
||||
async def test_examine_systems(self):
|
||||
# In LP: #2037723 and other similar reports, the user selects the
|
||||
# source 'ubuntu-desktop-minimal' first and then switches to
|
||||
# 'ubuntu-desktop'. The variations of those two sources are different.
|
||||
# Upon switching to the new source, we forgot to discard the old
|
||||
# variations. This lead to a crash further in the install.
|
||||
self.fsc.model = model = make_model(Bootloader.UEFI)
|
||||
make_disk(model)
|
||||
self.app.base_model.source.current.type = "fsimage"
|
||||
self.app.base_model.source.current.variations = {
|
||||
"minimal": CatalogEntryVariation(path="", size=1),
|
||||
}
|
||||
|
||||
self.app.dr_cfg = DRConfig()
|
||||
self.app.dr_cfg.systems_dir_exists = True
|
||||
|
||||
await self.fsc._examine_systems()
|
||||
|
||||
self.assertEqual(len(self.fsc._variation_info), 1)
|
||||
self.assertEqual(self.fsc._variation_info["minimal"].name, "minimal")
|
||||
|
||||
self.app.base_model.source.current.variations = {
|
||||
"default": CatalogEntryVariation(path="", size=1),
|
||||
}
|
||||
|
||||
await self.fsc._examine_systems()
|
||||
|
||||
self.assertEqual(len(self.fsc._variation_info), 1)
|
||||
self.assertEqual(self.fsc._variation_info["default"].name, "default")
|
||||
|
||||
|
||||
class TestGuided(IsolatedAsyncioTestCase):
|
||||
boot_expectations = [
|
||||
|
|
Loading…
Reference in New Issue