Add dns-stack profile and stable IP prompt
This commit is contained in:
@@ -3,6 +3,8 @@ import pathlib
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from .constants import FIRSTBOOT_DIR, FIRSTBOOT_DONE, FIRSTBOOT_ERROR, FIRSTBOOT_LOG, FIRSTBOOT_STATE, WEB_ROOT
|
||||
|
||||
PROFILE_FILE = pathlib.Path("/etc/pikit/profile.json")
|
||||
from .helpers import ensure_dir, sha256_file
|
||||
|
||||
DEFAULT_STEPS = [
|
||||
@@ -82,6 +84,18 @@ def read_firstboot_status() -> Dict[str, Any]:
|
||||
ca_path = WEB_ROOT / "assets" / "pikit-ca.crt"
|
||||
ca_hash = sha256_file(ca_path) if ca_path.exists() else None
|
||||
|
||||
profile_summary: Dict[str, Any] = {}
|
||||
if PROFILE_FILE.exists():
|
||||
try:
|
||||
data = json.loads(PROFILE_FILE.read_text())
|
||||
profile_summary = {
|
||||
"id": data.get("id"),
|
||||
"name": data.get("name"),
|
||||
"requires_stable_ip": bool(data.get("requires_stable_ip", False)),
|
||||
}
|
||||
except Exception:
|
||||
profile_summary = {}
|
||||
|
||||
return {
|
||||
"state": state,
|
||||
"steps": steps,
|
||||
@@ -91,6 +105,7 @@ def read_firstboot_status() -> Dict[str, Any]:
|
||||
"error_path": "/api/firstboot/error",
|
||||
"ca_hash": ca_hash,
|
||||
"ca_url": "/assets/pikit-ca.crt",
|
||||
"profile": profile_summary,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user