pxe: improve autostart

This commit is contained in:
pedro 2024-09-26 13:56:26 -03:00
parent b2e82e7bb9
commit 349e0eb480
2 changed files with 2 additions and 3 deletions

View File

@ -264,7 +264,6 @@ prepare_app() {
# startup script execution # startup script execution
cat > "${ISO_PATH}/chroot/root/.profile" <<END cat > "${ISO_PATH}/chroot/root/.profile" <<END
set -x set -x
set -e
if [ -f /tmp/workbench_lock ]; then if [ -f /tmp/workbench_lock ]; then
return 0 return 0
@ -285,8 +284,8 @@ fi
# clearly specify the right working directory, used in the python script as os.getcwd() # clearly specify the right working directory, used in the python script as os.getcwd()
cd /mnt cd /mnt
pipenv run python /opt/workbench/workbench-script.py --config /mnt/settings.ini pipenv run python /opt/workbench/workbench-script.py --config /mnt/settings.ini
stty echo
stty echo
set +x set +x
set +e set +e
END END

View File

@ -276,7 +276,7 @@ def save_snapshot_in_disk(snapshot, path):
f.write(json.dumps(snapshot)) f.write(json.dumps(snapshot))
print(f"workbench: INFO: Snapshot written in fallback path '{fallback_filename}'") print(f"workbench: INFO: Snapshot written in fallback path '{fallback_filename}'")
except Exception as e: except Exception as e:
print(f"workbench: ERROR: Failed to write in fallback path: {fallback_filename}. Could not save snapshot locally.") print(f"workbench: ERROR: Failed to write in fallback path: {e}. Could not save snapshot locally.")
# TODO sanitize url, if url is like this, it fails # TODO sanitize url, if url is like this, it fails
# url = 'http://127.0.0.1:8000/api/snapshot/' # url = 'http://127.0.0.1:8000/api/snapshot/'