From b3e0d6e01f81496338fc7a8b8009e88d35248ca4 Mon Sep 17 00:00:00 2001 From: "juvenal.diaz" Date: Thu, 5 Nov 2026 10:58:12 -0600 Subject: [PATCH] Disable unsafe lab scheduler and fix OCI state status --- bootstrap/edge/main.tf | 6 +++--- bootstrap/edge/variables.tf | 7 ++++++- docs/app-ops.md | 4 ++++ docs/templates/app-ops.md.tmpl | 4 ++++ lib/jeannie/commands.sh | 18 +++++++++++------- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/bootstrap/edge/main.tf b/bootstrap/edge/main.tf index d3c76d3..6feab2b 100644 --- a/bootstrap/edge/main.tf +++ b/bootstrap/edge/main.tf @@ -429,7 +429,7 @@ EOF #!/bin/sh set -eu . /etc/homelab-lab-window.env -action="${1:?start or stop is required}" +action="$${1:?start or stop is required}" case "$action" in start|stop) ;; *) exit 2 ;; esac payload="$(printf '{"command":"lab-window","args":["%s"]}' "$action")" response="$(curl --noproxy '*' -fsS --connect-timeout 10 --max-time 30 \ @@ -469,7 +469,7 @@ SERVICE_EOT [Unit] Description=Start Jeannie lab at 08:00 local time [Timer] -OnCalendar=*-*-* 08:00:00 ${lab_schedule_timezone} +OnCalendar=*-*-* 08:00:00 $lab_schedule_timezone Unit=homelab-lab-window-start.service [Install] WantedBy=timers.target @@ -478,7 +478,7 @@ SERVICE_EOT [Unit] Description=Stop Jeannie lab at 17:00 local time [Timer] -OnCalendar=*-*-* 17:00:00 ${lab_schedule_timezone} +OnCalendar=*-*-* 17:00:00 $lab_schedule_timezone Unit=homelab-lab-window-stop.service [Install] WantedBy=timers.target diff --git a/bootstrap/edge/variables.tf b/bootstrap/edge/variables.tf index 903d22f..6d94392 100644 --- a/bootstrap/edge/variables.tf +++ b/bootstrap/edge/variables.tf @@ -85,7 +85,12 @@ variable "edge_install_docker" { variable "lab_schedule_enabled" { type = bool - default = true + default = false + + validation { + condition = !var.lab_schedule_enabled + error_message = "The legacy SSH-based lab scheduler is disabled until OCI agent installation and lifecycle recovery are implemented." + } } variable "lab_schedule_api_url" { diff --git a/docs/app-ops.md b/docs/app-ops.md index 5f1cb2f..e610bae 100644 --- a/docs/app-ops.md +++ b/docs/app-ops.md @@ -216,6 +216,10 @@ when Pimox workers or cluster networking are the thing being investigated. ## Scheduled lab power window +**Not available yet.** The original SSH-based scheduler is disabled while its +OCI agent installation, credential handling, and shutdown recovery are being +reworked. Do not apply or enable the timers described below. + The OCI edge can keep the management plane available while starting the selected cluster and host services at 08:00 and stopping the data plane at 17:00 in `America/Mexico_City`. The edge timer calls the authenticated Jeannie diff --git a/docs/templates/app-ops.md.tmpl b/docs/templates/app-ops.md.tmpl index 0561c9c..ca68baa 100644 --- a/docs/templates/app-ops.md.tmpl +++ b/docs/templates/app-ops.md.tmpl @@ -216,6 +216,10 @@ when Pimox workers or cluster networking are the thing being investigated. ## Scheduled lab power window +**Not available yet.** The original SSH-based scheduler is disabled while its +OCI agent installation, credential handling, and shutdown recovery are being +reworked. Do not apply or enable the timers described below. + The OCI edge can keep the management plane available while starting the selected cluster and host services at 08:00 and stopping the data plane at 17:00 in `America/Mexico_City`. The edge timer calls the authenticated Jeannie diff --git a/lib/jeannie/commands.sh b/lib/jeannie/commands.sh index 98d11ab..2c7a2c5 100644 --- a/lib/jeannie/commands.sh +++ b/lib/jeannie/commands.sh @@ -775,12 +775,8 @@ lab_window() { start_cluster || return 1 ;; stop) - require_debian_server "lab-window stop" - echo "Stopping the scheduled lab window; keeping jeannie-server and the OCI edge available." - shutdown_rpi_services || return 1 - stop_cluster || return 1 - shutdown_oci_email_services || return 1 - shutdown_debian_services + echo "Scheduled shutdown is disabled: the API execution worker must remain available for the next startup." >&2 + return 1 ;; *) echo "Usage: ./jeannie lab-window {start|stop|status}" >&2 @@ -4110,7 +4106,15 @@ oci_foundation_manage() { python3 "${REPO_ROOT}/tests/jeannie/test_oci_foundation_resolve.py" ;; status) - tofu -chdir="${stack}" show "${tofu_state_args[@]}" -no-color 2>/dev/null || echo "OCI foundation has no state yet." + if [[ -n "${state_file}" ]]; then + if [[ ! -f "${state_file}" ]]; then + echo "OCI foundation state file not found: ${state_file}" >&2 + return 1 + fi + tofu -chdir="${stack}" show -no-color "${state_file}" || return 1 + else + tofu -chdir="${stack}" show -no-color || return 1 + fi ;; plan|apply) # Serialize generated import declarations as well as state access.