From 57a53381f29c4d204a79fc82314585a258c10ddf Mon Sep 17 00:00:00 2001 From: cproudlock Date: Thu, 12 Feb 2026 16:58:39 -0500 Subject: [PATCH] Ensure Media.tag exists for all images after import and via cron Webapp now creates Deploy/Control/Media.tag after every image import. Cron updated to create (not just touch) Media.tag for any image directory that has Deploy/Control/. Co-Authored-By: Claude Opus 4.6 --- playbook/pxe_server_setup.yml | 7 +++++-- webapp/app.py | 6 ++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/playbook/pxe_server_setup.yml b/playbook/pxe_server_setup.yml index c661d6b..8d99b81 100644 --- a/playbook/pxe_server_setup.yml +++ b/playbook/pxe_server_setup.yml @@ -391,9 +391,12 @@ force: no loop: "{{ image_types }}" - - name: "Daily cron to refresh Media.tag (PESetup.exe 30-day expiry check)" + - name: "Daily cron to create/refresh Media.tag for all images" copy: - content: "@reboot root find {{ samba_share }}/*/Deploy/Control -name Media.tag -exec touch {} +\n0 0 * * * root find {{ samba_share }}/*/Deploy/Control -name Media.tag -exec touch {} +\n" + content: | + # Create Media.tag in any image with Deploy/Control/ and refresh existing ones + @reboot root for d in {{ samba_share }}/*/Deploy/Control; do [ -d "$d" ] && touch "$d/Media.tag"; done + 0 0 * * * root for d in {{ samba_share }}/*/Deploy/Control; do [ -d "$d" ] && touch "$d/Media.tag"; done dest: /etc/cron.d/media-tag-refresh mode: '0644' diff --git a/webapp/app.py b/webapp/app.py index 944404b..6ba685d 100644 --- a/webapp/app.py +++ b/webapp/app.py @@ -717,6 +717,12 @@ def images_import(): # Flat layout: treat source as Deploy contents _import_deploy(source, dest, target, move=use_move) + # Ensure Media.tag exists (FlatSetupLoader.exe drive detection) + control_dir = os.path.join(dest, "Control") + os.makedirs(control_dir, exist_ok=True) + media_tag = os.path.join(control_dir, "Media.tag") + Path(media_tag).touch() + audit("IMAGE_IMPORT", f"{source} -> {target}") flash( f"Successfully imported content to {FRIENDLY_NAMES.get(target, target)}.",