filesystem: give Source.get_handler variation name
In order to lookup the snapd system correctly, we need the correct variant information, and it works best by name.
This commit is contained in:
parent
03c48daded
commit
1bcf66c89b
|
@ -211,8 +211,9 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
|||
await super().configured()
|
||||
self.stop_listening_udev()
|
||||
|
||||
async def _mount_systems_dir(self):
|
||||
self._source_handler = self.app.controllers.Source.get_handler()
|
||||
async def _mount_systems_dir(self, variation_name):
|
||||
self._source_handler = \
|
||||
self.app.controllers.Source.get_handler(variation_name)
|
||||
source_path = self._source_handler.setup()
|
||||
cur_systems_dir = '/var/lib/snapd/seed/systems'
|
||||
source_systems_dir = os.path.join(source_path, cur_systems_dir[1:])
|
||||
|
@ -234,9 +235,9 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
|||
self._source_handler.cleanup()
|
||||
self._source_handler = None
|
||||
|
||||
async def _get_system(self, label):
|
||||
async def _get_system(self, variation_name, label):
|
||||
try:
|
||||
await self._mount_systems_dir()
|
||||
await self._mount_systems_dir(variation_name)
|
||||
except NoSnapdSystemsOnSource:
|
||||
return None
|
||||
try:
|
||||
|
@ -304,7 +305,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
|||
system = None
|
||||
label = variation.snapd_system_label
|
||||
if label is not None:
|
||||
system = await self._get_system(label)
|
||||
system = await self._get_system(name, label)
|
||||
log.debug("got system %s for variation %s", system, name)
|
||||
if system is not None and len(system.volumes) > 0:
|
||||
self._variation_info[name] = self.info_for_system(
|
||||
|
@ -606,7 +607,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
|||
async def guided_core_boot(self, disk: Disk):
|
||||
# Formatting for a core boot classic system relies on some curtin
|
||||
# features that are only available with v2 partitioning.
|
||||
await self._mount_systems_dir()
|
||||
await self._mount_systems_dir(self._info.name)
|
||||
self.model.storage_version = 2
|
||||
[volume] = self._info.system.volumes.values()
|
||||
self._on_volume = snapdapi.OnVolume.from_volume(volume)
|
||||
|
|
|
@ -833,6 +833,7 @@ class TestCoreBootInstallMethods(IsolatedAsyncioTestCase):
|
|||
self.fsc = FilesystemController(app=self.app)
|
||||
self.fsc._configured = True
|
||||
self.fsc.model = make_model(Bootloader.UEFI)
|
||||
self.fsc._mount_systems_dir = mock.AsyncMock()
|
||||
|
||||
def _add_details_for_structures(self, structures):
|
||||
self.fsc._info = VariationInfo(
|
||||
|
|
Loading…
Reference in New Issue