27 lines
790 B
Python
27 lines
790 B
Python
"""Host installation endpoint backed by the existing UVM installer."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from fastapi import APIRouter, Depends
|
|
|
|
from ..api_models import InstallRequest, InstallResponse
|
|
from ..app import Application
|
|
from .dependencies import get_authorized_application
|
|
|
|
|
|
router = APIRouter(tags=["installation"])
|
|
|
|
|
|
@router.post("/install", response_model=InstallResponse)
|
|
def install(
|
|
request: InstallRequest,
|
|
application: Application = Depends(get_authorized_application),
|
|
) -> InstallResponse:
|
|
firecracker, assets = application.installer.install(force_assets=request.force)
|
|
application.state_store.initialize()
|
|
return InstallResponse(
|
|
firecracker=str(firecracker),
|
|
kernel=str(assets.kernel),
|
|
rootfs=str(assets.rootfs),
|
|
)
|