Debug-Modus bei jedem installation_completed, Vorlagenname an build_customer_iso.sh (Kunden-ISO-Test R6/R10)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cec4dcb2d6
commit
4d5d6090b4
1 file changed
+45
-1
@@ -3724,6 +3724,32 @@ def compute_file_sha256(path) -> str:
|
||||
|
||||
return hasher.hexdigest()
|
||||
|
||||
def fetch_vorlage_label_for_session(session_id: str) -> str | None:
|
||||
"""
|
||||
Name der Bereitstellungsvorlage einer Enrollment Session - fuer den
|
||||
Boot-Menue-Eintrag der Kunden-ISO (build_customer_iso.sh, VORLAGE_LABEL).
|
||||
"""
|
||||
|
||||
try:
|
||||
with get_database_connection() as conn:
|
||||
with conn.cursor() as cur:
|
||||
cur.execute(
|
||||
"""
|
||||
SELECT bv.label
|
||||
FROM enrollment_sessions es
|
||||
JOIN bereitstellungsvorlagen bv ON bv.id = es.bereitstellungsvorlage_id
|
||||
WHERE es.id = %s
|
||||
""",
|
||||
(session_id,),
|
||||
)
|
||||
row = cur.fetchone()
|
||||
except Exception:
|
||||
# Rein kosmetisch - ein Fehler hier darf den ISO-Bau nie verhindern.
|
||||
return None
|
||||
|
||||
return row[0] if row else None
|
||||
|
||||
|
||||
ROOT_PASSWORD_HASH_PATTERN = re.compile(r"^\$6\$[./A-Za-z0-9]{1,16}\$[./A-Za-z0-9]{86}$")
|
||||
|
||||
|
||||
@@ -3737,6 +3763,7 @@ def run_iso_build(
|
||||
|
||||
organization = fetch_organization(organization_id)
|
||||
volid = compute_iso_volid(organization["name"] if organization else "TUXFLOTTE")
|
||||
vorlage_label = (fetch_vorlage_label_for_session(activation_code) or "").replace("\n", " ")
|
||||
|
||||
try:
|
||||
# De-Root-Umzug (07.09.2026): der Dienst selbst laeuft nicht mehr als
|
||||
@@ -3760,7 +3787,11 @@ def run_iso_build(
|
||||
"-",
|
||||
volid,
|
||||
],
|
||||
input=f"WIFI_PSK={wifi_psk or ''}\nROOT_PASSWORD_HASH={root_password_hash or ''}\n",
|
||||
input=(
|
||||
f"WIFI_PSK={wifi_psk or ''}\n"
|
||||
f"ROOT_PASSWORD_HASH={root_password_hash or ''}\n"
|
||||
f"VORLAGE_LABEL={vorlage_label}\n"
|
||||
),
|
||||
cwd=TUXFLOTTE_INSTALLER_DIR,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
@@ -4373,6 +4404,19 @@ def post_installation_event(device_id: str, payload: InstallationEventRequest):
|
||||
|
||||
record_installation_event(device_id, payload.event_type, payload.detail)
|
||||
|
||||
# Kunden-ISO-Test 02.10.2026 (R6): der automatische Debug-Modus beim
|
||||
# allerersten agent/bootstrap (siehe dort) greift bei der
|
||||
# Neuinstallation eines schon bekannten Geraets nicht - dann blieb es
|
||||
# beim 6h-Poll-Intervall. Jede abgeschlossene Installation schaltet ihn
|
||||
# deshalb ebenfalls ein, damit Nachzuegler-Auftraege zeitnah ankommen.
|
||||
if payload.event_type == "installation_completed":
|
||||
with get_database_connection() as conn:
|
||||
with conn.cursor() as cur:
|
||||
cur.execute(
|
||||
"UPDATE devices SET debug_mode_until = %s WHERE id = %s",
|
||||
(datetime.now(timezone.utc) + timedelta(hours=DEBUG_MODE_DURATION_HOURS), device_id),
|
||||
)
|
||||
|
||||
return {"success": True}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user