Begin Firecracker microVM support
This commit is contained in:
parent
fa6af127c1
commit
ed8ad1bee9
11 changed files with 290 additions and 7 deletions
59
config/checks.py
Normal file
59
config/checks.py
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import shutil
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.checks import Tags
|
||||
from django.core.checks import Warning as DjangoWarning
|
||||
from django.core.checks import register
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from django.core.checks import CheckMessage
|
||||
|
||||
REQUIRED_DEV_COMMANDS: tuple[str, ...] = (
|
||||
"uname",
|
||||
"curl",
|
||||
"basename",
|
||||
"grep",
|
||||
"sort",
|
||||
"tail",
|
||||
"wget",
|
||||
"unsquashfs",
|
||||
"ssh-keygen",
|
||||
"sudo",
|
||||
"chown",
|
||||
"truncate",
|
||||
"mkfs.ext4",
|
||||
"e2fsck",
|
||||
)
|
||||
|
||||
|
||||
@register(Tags.compatibility)
|
||||
def check_required_dev_commands(*_: object, **__: object) -> list[CheckMessage]:
|
||||
"""Warn in dev-like runtime when host tooling for init script is missing.
|
||||
|
||||
Returns:
|
||||
A list of CheckMessage objects representing any issues found.
|
||||
"""
|
||||
if not (settings.DEBUG or getattr(settings, "TESTING", False)):
|
||||
return []
|
||||
|
||||
missing_commands: list[str] = [
|
||||
command for command in REQUIRED_DEV_COMMANDS if shutil.which(command) is None
|
||||
]
|
||||
|
||||
if not missing_commands:
|
||||
return []
|
||||
|
||||
return [
|
||||
DjangoWarning(
|
||||
"Missing host commands used by get_rootfs.bash.",
|
||||
hint=(
|
||||
"Dev-only tooling missing: "
|
||||
f"{', '.join(missing_commands)}. "
|
||||
"These are required for local VM/rootfs setup during development, not production runtime."
|
||||
),
|
||||
id="tussilago.W001",
|
||||
),
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue