fix crash on refresh: change ids are strings in the snapd api

for https://bugs.launchpad.net/subiquity/+bug/1913417
This commit is contained in:
Michael Hudson-Doyle 2021-02-10 11:43:58 +13:00
parent e813726aaa
commit 6fa1d9bbd0
3 changed files with 6 additions and 6 deletions

View File

@ -84,11 +84,11 @@ class API:
If wait is true, block until the status is known."""
def POST() -> int:
def POST() -> str:
"""Start the update and return the change id."""
class progress:
def GET(change_id: int) -> dict: ...
def GET(change_id: str) -> dict: ...
class zdev:
def GET() -> List[ZdevInfo]: ...

View File

@ -212,8 +212,8 @@ class RefreshController(SubiquityController):
await self.check_task.wait()
return self.status
async def POST(self, context) -> int:
async def POST(self, context) -> str:
return await self.start_update(context=context)
async def progress_GET(self, change_id: int) -> dict:
async def progress_GET(self, change_id: str) -> dict:
return await self.get_progress(change_id)

View File

@ -132,14 +132,14 @@ class FakeSnapdConnection:
if path == "v2/snaps/subiquity" and body['action'] == 'refresh':
return _FakeMemoryResponse({
"type": "async",
"change": 7,
"change": "7",
"status-code": 200,
"status": "OK",
})
if path == "v2/snaps/subiquity" and body['action'] == 'switch':
return _FakeMemoryResponse({
"type": "async",
"change": 8,
"change": "8",
"status-code": 200,
"status": "Accepted",
})