mirror: add new endpoint to submit mirror without marking configured

The POST handler for /mirror applies the URL passed but also marks the
model configured. That said, we want the ability to:

 1. supply a mirror URL
 2. run the mirror test
 3. mark the model configured if the test is successful

This patches creates a new endpoint: /mirror/candidate that does the
same as /mirror except that it does not mark the model configured.

It is therefore suitable for step 1.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
Olivier Gayot 2023-01-06 10:58:37 +01:00
parent 86fb20ec04
commit 5177a6a8f6
2 changed files with 7 additions and 0 deletions

View File

@ -345,6 +345,9 @@ class API:
def GET() -> str: ...
def POST(data: Payload[str]): ...
class candidate:
def POST(url: Payload[str]) -> None: ...
class disable_components:
def GET() -> List[str]: ...
def POST(data: Payload[List[str]]): ...

View File

@ -177,6 +177,10 @@ class MirrorController(SubiquityController):
self.model.set_mirror(data)
await self.configured()
async def candidate_POST(self, url: str) -> None:
log.debug(url)
self.model.set_mirror(url)
async def disable_components_GET(self) -> List[str]:
return sorted(self.model.disabled_components)