call into snapd to finish the installation of a core boot classic system
This commit is contained in:
parent
8b2df438d9
commit
c24cfd3d04
|
@ -0,0 +1 @@
|
|||
{"type":"sync","status-code":200,"status":"OK","result":{"id":"5","kind":"install-step-finish","summary":"Finish setup of run system for \"classic\"","status":"Doing","tasks":[{"id":"78","kind":"install-finish","summary":"Finish setup of run system for \"classic\"","status":"Doing","progress":{"label":"","done":1,"total":1},"spawn-time":"2022-10-28T06:21:14.664247396Z"}],"ready":false,"spawn-time":"2022-10-28T06:21:14.66424385Z"}}
|
|
@ -0,0 +1 @@
|
|||
{"type":"sync","status-code":200,"status":"OK","result":{"id":"5","kind":"install-step-finish","summary":"Finish setup of run system for \"classic\"","status":"Done","tasks":[{"id":"78","kind":"install-finish","summary":"Finish setup of run system for \"classic\"","status":"Done","progress":{"label":"","done":1,"total":1},"spawn-time":"2022-10-28T06:21:14.664247396Z","ready-time":"2022-10-28T06:21:19.699805792Z"}],"ready":true,"spawn-time":"2022-10-28T06:21:14.66424385Z","ready-time":"2022-10-28T06:21:19.699808158Z"}}
|
|
@ -481,6 +481,32 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
|||
is_last=structure == volume.structure[-1])
|
||||
disk._partitions.sort(key=lambda p: p.number)
|
||||
|
||||
def _on_volumes(self) -> Dict[str, snapdapi.OnVolume]:
|
||||
# Return a value suitable for use as the 'on-volumes' part of a
|
||||
# SystemActionRequest.
|
||||
#
|
||||
# This must be run after curtin partitioning, which will result in a
|
||||
# call to update_devices which will have set .path on all block
|
||||
# devices.
|
||||
[(key, volume)] = self._system.volumes.items()
|
||||
on_volume = snapdapi.OnVolume.from_volume(volume)
|
||||
for on_volume_structure in on_volume.structure:
|
||||
role = on_volume_structure.role
|
||||
if role in self._role_to_device:
|
||||
on_volume.device = self._role_to_device[role].path
|
||||
return {key: on_volume}
|
||||
|
||||
@with_context(description="making system bootable")
|
||||
async def finish_install(self, context):
|
||||
label = self.app.base_model.source.current.snapd_system_label
|
||||
await snapdapi.post_and_wait(
|
||||
self.app.snapdapi,
|
||||
self.app.snapdapi.v2.systems[label].POST,
|
||||
snapdapi.SystemActionRequest(
|
||||
action=snapdapi.SystemAction.INSTALL,
|
||||
step=snapdapi.SystemActionStep.FINISH,
|
||||
on_volumes=self._on_volumes()))
|
||||
|
||||
async def guided_POST(self, data: GuidedChoice) -> StorageResponse:
|
||||
log.debug(data)
|
||||
if self._system is not None:
|
||||
|
|
|
@ -254,6 +254,7 @@ class InstallController(SubiquityController):
|
|||
).run,
|
||||
]
|
||||
if self.model.source.current.snapd_system_label:
|
||||
fs_controller = self.app.controllers.Filesystem
|
||||
steps.extend([
|
||||
make_curtin_step(
|
||||
name="partitioning", stages=["partitioning"],
|
||||
|
@ -265,6 +266,7 @@ class InstallController(SubiquityController):
|
|||
name="extract", stages=["extract"],
|
||||
acquire_config=self.acquire_generic_config,
|
||||
).run,
|
||||
fs_controller.finish_install,
|
||||
self.setup_target,
|
||||
])
|
||||
else:
|
||||
|
|
|
@ -141,10 +141,17 @@ class FakeSnapdConnection:
|
|||
"status-code": 200,
|
||||
"status": "OK",
|
||||
})
|
||||
change = None
|
||||
if path == "v2/snaps/subiquity" and body['action'] == 'switch':
|
||||
change = "8"
|
||||
if path.startswith('v2/systems/') and body['action'] == 'install':
|
||||
step = body['step']
|
||||
if step == 'finish':
|
||||
change = "5"
|
||||
if change is not None:
|
||||
return _FakeMemoryResponse({
|
||||
"type": "async",
|
||||
"change": "8",
|
||||
"change": change,
|
||||
"status-code": 200,
|
||||
"status": "Accepted",
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue