download-drivers: fix BIOS push path + 3-col models.txt + don't overwrite
Three related fixes: 1. Hard-coded BIOS push path was /srv/samba/enrollment/BIOS, which does not exist on the live PXE server. Real path is the shared /srv/samba/winpeapps/_shared/BIOS/ where check-bios.cmd lives and playbook task pxe_server_setup.yml:485 deploys Flash64W.exe + the per-model BIOS .exe files. 2. Generated models.txt was 2-column (ModelSubstring|BIOSFile) but check-bios.cmd reads tokens=1,2,3 with delims=| and uses field 3 for the version compare. Without the 3rd column, the version-skip logic never engages and every imaged PC re-flashes BIOS on every boot. Now writes 3-column (ModelSubstring|BIOSFile|Version). 3. The script overwrote the live models.txt with only the entries it touched in the current run. Live had 50+ entries; a single-model run wiped the other 49. Now prints the lines and asks the operator to merge them into playbook/shopfloor-setup/BIOS/models.txt and re-deploy via scripts/deploy-bios.sh. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -714,9 +714,12 @@ def main():
|
|||||||
for i, d in enumerate(download_plan, 1)]
|
for i, d in enumerate(download_plan, 1)]
|
||||||
concurrent.futures.wait(futures)
|
concurrent.futures.wait(futures)
|
||||||
|
|
||||||
# --- Download BIOS (goes to enrollment share, shared across all images) ---
|
# --- Download BIOS (goes to shared winpeapps dir, read by check-bios.cmd
|
||||||
|
# in WinPE phase via \\10.9.100.1\winpeapps\_shared\BIOS\). Playbook
|
||||||
|
# task at pxe_server_setup.yml:485 deploys check-bios.cmd + Flash64W.exe
|
||||||
|
# to this same directory. ---
|
||||||
bios_ok = bios_err = 0
|
bios_ok = bios_err = 0
|
||||||
bios_dir = "/srv/samba/enrollment/BIOS"
|
bios_dir = "/srv/samba/winpeapps/_shared/BIOS"
|
||||||
if bios_updates:
|
if bios_updates:
|
||||||
print(f"{'=' * 60}")
|
print(f"{'=' * 60}")
|
||||||
print(f" BIOS Updates -> {bios_dir}")
|
print(f" BIOS Updates -> {bios_dir}")
|
||||||
@@ -736,7 +739,7 @@ def main():
|
|||||||
if existing == b["version"]:
|
if existing == b["version"]:
|
||||||
with _lock:
|
with _lock:
|
||||||
print(f" Up to date (v{b['version']})")
|
print(f" Up to date (v{b['version']})")
|
||||||
models_txt.append(f"{b['model']}|{b['filename']}")
|
models_txt.append(f"{b['model']}|{b['filename']}|{b['version']}")
|
||||||
return
|
return
|
||||||
|
|
||||||
# BIOS .exe goes as-is (not extracted)
|
# BIOS .exe goes as-is (not extracted)
|
||||||
@@ -769,18 +772,24 @@ def main():
|
|||||||
print(f" [{b['model']}] Done.")
|
print(f" [{b['model']}] Done.")
|
||||||
bios_ok += 1
|
bios_ok += 1
|
||||||
manifest.setdefault("BIOS", {})[b["model"]] = b["version"]
|
manifest.setdefault("BIOS", {})[b["model"]] = b["version"]
|
||||||
models_txt.append(f"{b['model']}|{b['filename']}")
|
models_txt.append(f"{b['model']}|{b['filename']}|{b['version']}")
|
||||||
|
|
||||||
with concurrent.futures.ThreadPoolExecutor(max_workers=workers) as pool:
|
with concurrent.futures.ThreadPoolExecutor(max_workers=workers) as pool:
|
||||||
futures = [pool.submit(_process_one_bios, b) for b in bios_updates]
|
futures = [pool.submit(_process_one_bios, b) for b in bios_updates]
|
||||||
concurrent.futures.wait(futures)
|
concurrent.futures.wait(futures)
|
||||||
|
|
||||||
# Generate models.txt for check-bios.cmd
|
# Print manifest entries for check-bios.cmd. Do NOT overwrite the
|
||||||
|
# live models.txt: this script only knows about the entries it
|
||||||
|
# touched this run, so an overwrite would wipe the 50+ existing
|
||||||
|
# entries. Instead print so the operator can merge them into
|
||||||
|
# playbook/shopfloor-setup/BIOS/models.txt and re-deploy.
|
||||||
|
# Format: ModelSubstring|BIOSFile|Version (check-bios.cmd reads
|
||||||
|
# tokens=1,2,3 with delims=|; field 3 used for version compare).
|
||||||
if models_txt:
|
if models_txt:
|
||||||
manifest_content = "# ModelSubstring|BIOSFile\\n" + "\\n".join(models_txt) + "\\n"
|
print(f"\n Add these lines to playbook/shopfloor-setup/BIOS/models.txt:")
|
||||||
ssh_cmd(args.server,
|
for line in models_txt:
|
||||||
f"printf '{manifest_content}' > '{bios_dir}/models.txt'")
|
print(f" {line}")
|
||||||
print(f"\n models.txt updated ({len(models_txt)} entries)")
|
print(f" Then re-deploy via scripts/deploy-bios.sh.")
|
||||||
|
|
||||||
# --- Save manifest ---
|
# --- Save manifest ---
|
||||||
completed, skipped, errors = counters["completed"], counters["skipped"], counters["errors"]
|
completed, skipped, errors = counters["completed"], counters["skipped"], counters["errors"]
|
||||||
|
|||||||
Reference in New Issue
Block a user