|
|
@@ -184,7 +184,21 @@ pub fn handle_station_command_nonblocking(
|
|
|
} else {
|
|
|
args.get_str_or("action", "enable").to_ascii_lowercase()
|
|
|
};
|
|
|
+ st.ensure_persistent_baseline();
|
|
|
let seq = st.set_stage_intent(&stage, &action, args);
|
|
|
+ st.log_debug(
|
|
|
+ "INTENT",
|
|
|
+ &format!(
|
|
|
+ "SET_STAGE_INTENT stage={} action={} seq={} operator={} has_mem_params={} has_amt={} has_mt={}",
|
|
|
+ stage,
|
|
|
+ action,
|
|
|
+ seq,
|
|
|
+ operator,
|
|
|
+ args.get("memory_params").is_some(),
|
|
|
+ args.get("amt").is_some() || args.get("settings").is_some(),
|
|
|
+ args.get("mt").is_some() || args.get("selection").is_some(),
|
|
|
+ ),
|
|
|
+ );
|
|
|
match stage.as_str() {
|
|
|
"uip" | "uip1" | "uip2" => {
|
|
|
if let Some(ovs) = args.get_arr("uip_overrides") {
|
|
|
@@ -370,7 +384,7 @@ pub fn handle_station_command_nonblocking(
|
|
|
}
|
|
|
_ => {}
|
|
|
}
|
|
|
- save_station_settings(data_dir, st);
|
|
|
+ // Transient in-memory intent update only — never overwrite persistent Web baseline on disk!
|
|
|
let mut res = JsonVal::obj();
|
|
|
res.set("stage", JsonVal::Str(stage.clone()));
|
|
|
res.set("action", JsonVal::Str(action.clone()));
|
|
|
@@ -418,6 +432,7 @@ pub fn handle_station_command_nonblocking(
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ st.clear_persistent_baseline();
|
|
|
save_station_settings(data_dir, st);
|
|
|
let preset_label = found
|
|
|
.get_str("label")
|
|
|
@@ -469,6 +484,7 @@ pub fn handle_station_command_nonblocking(
|
|
|
{
|
|
|
extra_lines.extend(built);
|
|
|
}
|
|
|
+ st.ensure_persistent_baseline();
|
|
|
if !ovs.is_empty() {
|
|
|
st.uip_overrides = ovs;
|
|
|
}
|
|
|
@@ -477,8 +493,12 @@ pub fn handle_station_command_nonblocking(
|
|
|
}
|
|
|
}
|
|
|
if st.diag_state != "online" || !st.prompt_ready || st.prompt_kind != "uip" {
|
|
|
+ st.ensure_persistent_baseline();
|
|
|
let seq = st.set_stage_intent("uip", "continue_uip", args);
|
|
|
- save_station_settings(data_dir, st);
|
|
|
+ st.log_debug(
|
|
|
+ "INTENT",
|
|
|
+ &format!("QUEUED method=ContinueUip stage=uip seq={} operator={}", seq, operator),
|
|
|
+ );
|
|
|
let mut res = JsonVal::obj();
|
|
|
res.set("action", JsonVal::Str("ContinueUip".to_string()));
|
|
|
res.set("confirmation", JsonVal::Str("queued_intent".to_string()));
|
|
|
@@ -550,12 +570,17 @@ pub fn handle_station_command_nonblocking(
|
|
|
})
|
|
|
.unwrap_or(false);
|
|
|
if !(st.prompt_ready && st.prompt_kind == "amt" && this_cpu_done) {
|
|
|
+ st.ensure_persistent_baseline();
|
|
|
st.amt_settings
|
|
|
.set("action", JsonVal::Str("skip".to_string()));
|
|
|
}
|
|
|
if st.diag_state != "online" || !st.prompt_ready || st.prompt_kind != "amt" {
|
|
|
+ st.ensure_persistent_baseline();
|
|
|
let seq = st.set_stage_intent("amt", "skip_amt", args);
|
|
|
- save_station_settings(data_dir, st);
|
|
|
+ st.log_debug(
|
|
|
+ "INTENT",
|
|
|
+ &format!("QUEUED method=SkipAmt stage=amt seq={} operator={}", seq, operator),
|
|
|
+ );
|
|
|
let mut res = JsonVal::obj();
|
|
|
res.set("action", JsonVal::Str("SkipAmt".to_string()));
|
|
|
res.set("confirmation", JsonVal::Str("queued_intent".to_string()));
|
|
|
@@ -599,6 +624,7 @@ pub fn handle_station_command_nonblocking(
|
|
|
let pxe_host = pxe_state.get_str_or("pxe_host", "");
|
|
|
sync_mt86_cfg_all_candidates(&pxe_host, pxe_tftp_dir, &cfg_text);
|
|
|
}
|
|
|
+ st.clear_persistent_baseline();
|
|
|
save_station_settings(data_dir, st);
|
|
|
let mut details = JsonVal::obj();
|
|
|
details.set(
|
|
|
@@ -663,11 +689,15 @@ pub fn handle_station_command_nonblocking(
|
|
|
Ok(c) => c,
|
|
|
Err(e) => return StationCmdExec::Immediate(Err(e), None),
|
|
|
};
|
|
|
+ st.ensure_persistent_baseline();
|
|
|
st.uip_overrides = ovs;
|
|
|
st.uip_raw_commands = raws;
|
|
|
if st.diag_state != "online" || !st.prompt_ready || st.prompt_kind != "uip" {
|
|
|
let seq = st.set_stage_intent("uip", "apply_uip", args);
|
|
|
- save_station_settings(data_dir, st);
|
|
|
+ st.log_debug(
|
|
|
+ "INTENT",
|
|
|
+ &format!("QUEUED method=ApplyUipParameters stage=uip seq={} lines={} operator={}", seq, lines.len(), operator),
|
|
|
+ );
|
|
|
let mut res = JsonVal::obj();
|
|
|
res.set(
|
|
|
"commands",
|
|
|
@@ -745,6 +775,7 @@ pub fn handle_station_command_nonblocking(
|
|
|
Err(e) => return StationCmdExec::Immediate(Err(e), None),
|
|
|
};
|
|
|
st.amt_settings = settings.clone();
|
|
|
+ st.clear_persistent_baseline();
|
|
|
save_station_settings(data_dir, st);
|
|
|
let mut details = JsonVal::obj();
|
|
|
details.set("amt_settings", settings.clone());
|
|
|
@@ -785,9 +816,13 @@ pub fn handle_station_command_nonblocking(
|
|
|
Err(e) => return StationCmdExec::Immediate(Err(e), None),
|
|
|
};
|
|
|
if st.diag_state != "online" || !st.prompt_ready || st.prompt_kind != "amt" {
|
|
|
+ st.ensure_persistent_baseline();
|
|
|
st.amt_settings = settings;
|
|
|
let seq = st.set_stage_intent("amt", "enable", args);
|
|
|
- save_station_settings(data_dir, st);
|
|
|
+ st.log_debug(
|
|
|
+ "INTENT",
|
|
|
+ &format!("QUEUED method=ApplyAmtSettings stage=amt seq={} cmds={} operator={}", seq, cmds.len(), operator),
|
|
|
+ );
|
|
|
let mut res = JsonVal::obj();
|
|
|
res.set("confirmation", JsonVal::Str("queued_intent".to_string()));
|
|
|
res.set("sequence", JsonVal::Num(seq as f64));
|
|
|
@@ -885,11 +920,15 @@ pub fn handle_station_command_nonblocking(
|
|
|
if args.get_bool("run_amt") == Some(false)
|
|
|
|| args.get("amt").and_then(|a| a.get_bool("enabled")) == Some(false)
|
|
|
{
|
|
|
+ st.ensure_persistent_baseline();
|
|
|
st.amt_settings
|
|
|
.set("action", JsonVal::Str("skip".to_string()));
|
|
|
if st.diag_state != "online" || !st.prompt_ready || st.prompt_kind != "amt" {
|
|
|
let seq = st.set_stage_intent("amt", "skip_amt", args);
|
|
|
- save_station_settings(data_dir, st);
|
|
|
+ st.log_debug(
|
|
|
+ "INTENT",
|
|
|
+ &format!("QUEUED method=StartAmt_skip stage=amt seq={} operator={}", seq, operator),
|
|
|
+ );
|
|
|
let mut res = JsonVal::obj();
|
|
|
res.set("action", JsonVal::Str("SkipAmt".to_string()));
|
|
|
res.set("confirmation", JsonVal::Str("queued_intent".to_string()));
|
|
|
@@ -918,10 +957,14 @@ pub fn handle_station_command_nonblocking(
|
|
|
.unwrap_or_default();
|
|
|
let mut merged_amt = effective_settings.clone();
|
|
|
merged_amt.set("action", JsonVal::Str("run".to_string()));
|
|
|
+ st.ensure_persistent_baseline();
|
|
|
st.amt_settings = merged_amt;
|
|
|
if st.diag_state != "online" || !st.prompt_ready || st.prompt_kind != "amt" {
|
|
|
let seq = st.set_stage_intent("amt", "start_amt", args);
|
|
|
- save_station_settings(data_dir, st);
|
|
|
+ st.log_debug(
|
|
|
+ "INTENT",
|
|
|
+ &format!("QUEUED method=StartAmt stage=amt seq={} cmds={} operator={}", seq, setup_cmds.len(), operator),
|
|
|
+ );
|
|
|
let mut res = JsonVal::obj();
|
|
|
res.set("confirmation", JsonVal::Str("queued_intent".to_string()));
|
|
|
res.set("sequence", JsonVal::Num(seq as f64));
|
|
|
@@ -977,11 +1020,15 @@ pub fn handle_station_command_nonblocking(
|
|
|
if let Some(err) = input_id_mismatch_err(st, args) {
|
|
|
return StationCmdExec::Immediate(Err(err), None);
|
|
|
}
|
|
|
+ st.ensure_persistent_baseline();
|
|
|
st.boot_plan.set("mt_enabled", JsonVal::Bool(false));
|
|
|
st.boot_plan.set("run_mt", JsonVal::Bool(false));
|
|
|
if st.diag_state != "online" || !st.prompt_ready || st.prompt_kind != "uefi" {
|
|
|
let seq = st.set_stage_intent("mt", "skip_mt", args);
|
|
|
- save_station_settings(data_dir, st);
|
|
|
+ st.log_debug(
|
|
|
+ "INTENT",
|
|
|
+ &format!("QUEUED method=SkipMt stage=mt seq={} operator={}", seq, operator),
|
|
|
+ );
|
|
|
let mut res = JsonVal::obj();
|
|
|
res.set("action", JsonVal::Str("SkipMt".to_string()));
|
|
|
res.set("confirmation", JsonVal::Str("queued_intent".to_string()));
|
|
|
@@ -1024,6 +1071,7 @@ pub fn handle_station_command_nonblocking(
|
|
|
let pxe_host = pxe_state.get_str_or("pxe_host", "");
|
|
|
sync_mt86_cfg_all_candidates(&pxe_host, pxe_tftp_dir, &cfg_text);
|
|
|
|
|
|
+ st.ensure_persistent_baseline();
|
|
|
st.mt_selection = sel.clone();
|
|
|
st.boot_plan.set("mt_enabled", JsonVal::Bool(true));
|
|
|
st.boot_plan.set("run_mt", JsonVal::Bool(true));
|
|
|
@@ -1035,7 +1083,10 @@ pub fn handle_station_command_nonblocking(
|
|
|
.replace('/', "\\");
|
|
|
if st.diag_state != "online" || !st.prompt_ready || st.prompt_kind != "uefi" {
|
|
|
let seq = st.set_stage_intent("mt", "start_mt", args);
|
|
|
- save_station_settings(data_dir, st);
|
|
|
+ st.log_debug(
|
|
|
+ "INTENT",
|
|
|
+ &format!("QUEUED method=StartMt stage=mt seq={} operator={}", seq, operator),
|
|
|
+ );
|
|
|
let mut res = JsonVal::obj();
|
|
|
res.set("confirmation", JsonVal::Str("queued_intent".to_string()));
|
|
|
res.set("sequence", JsonVal::Num(seq as f64));
|
|
|
@@ -1136,6 +1187,7 @@ pub fn handle_station_command_nonblocking(
|
|
|
};
|
|
|
let norm = normalize_boot_plan(raw_plan);
|
|
|
st.boot_plan = norm.clone();
|
|
|
+ st.clear_persistent_baseline();
|
|
|
save_station_settings(data_dir, st);
|
|
|
let audit = AuditRecordDraft {
|
|
|
category: "boot_plan".to_string(),
|
|
|
@@ -1289,6 +1341,8 @@ pub fn handle_station_command_nonblocking(
|
|
|
{
|
|
|
return StationCmdExec::Immediate(Err(e), None);
|
|
|
}
|
|
|
+ st.clear_persistent_baseline();
|
|
|
+ save_station_settings(data_dir, st);
|
|
|
let audit = AuditRecordDraft {
|
|
|
category: "profile_library".to_string(),
|
|
|
action: "load_profile_to_workspace".to_string(),
|
|
|
@@ -1424,6 +1478,7 @@ pub fn handle_station_command_nonblocking(
|
|
|
"clear" => {
|
|
|
st.confirm_dimm_replacement();
|
|
|
st.single_run_active = false;
|
|
|
+ st.restore_persistent_baseline("control_task_batch_clear");
|
|
|
let now = now_ms();
|
|
|
st.task_batch.set("batch_id", JsonVal::Str(String::new()));
|
|
|
st.task_batch.set("state", JsonVal::Str("idle".to_string()));
|
|
|
@@ -1451,6 +1506,16 @@ pub fn handle_station_command_nonblocking(
|
|
|
}
|
|
|
}
|
|
|
save_station_settings(data_dir, st);
|
|
|
+ st.log_debug(
|
|
|
+ "BATCH",
|
|
|
+ &format!(
|
|
|
+ "CONTROL_TASK_BATCH action={} batch_id={} state={} operator={}",
|
|
|
+ act,
|
|
|
+ st.task_batch.get_str_or("batch_id", ""),
|
|
|
+ st.task_batch.get_str_or("state", ""),
|
|
|
+ operator
|
|
|
+ ),
|
|
|
+ );
|
|
|
let audit = AuditRecordDraft {
|
|
|
category: "task_batch".to_string(),
|
|
|
action: format!("control_task_batch_{}", act),
|
|
|
@@ -1559,6 +1624,13 @@ pub fn handle_station_command_nonblocking(
|
|
|
};
|
|
|
crate::devices::register_station_host_claim(&st.station_id, claimed);
|
|
|
save_station_settings(data_dir, st);
|
|
|
+ st.log_debug(
|
|
|
+ "CONN",
|
|
|
+ &format!(
|
|
|
+ "CONFIGURE_CONNECTIONS bmc_enabled={} bmc_host={} console_enabled={} console={}:{}({}) operator={}",
|
|
|
+ st.bmc_enabled, st.bmc_host, st.console_enabled, st.console_host, st.console_port, st.console_transport, operator
|
|
|
+ ),
|
|
|
+ );
|
|
|
// Online one-click switch & auto-reconnect without manual disconnect!
|
|
|
if st.console_enabled
|
|
|
&& (!st.console_host.is_empty()
|
|
|
@@ -1608,6 +1680,7 @@ pub fn handle_station_command_nonblocking(
|
|
|
st.uip_raw_commands.push(cmd.to_string());
|
|
|
}
|
|
|
}
|
|
|
+ st.clear_persistent_baseline();
|
|
|
save_station_settings(data_dir, st);
|
|
|
}
|
|
|
let audit = AuditRecordDraft {
|