From ab79c9f6eb4588234fba91c1b8bcc0baba9678da Mon Sep 17 00:00:00 2001 From: Natalia Serrano Date: Tue, 22 Oct 2024 15:18:04 +0000 Subject: [PATCH] refs #1016 chdir() out of a deleted directory --- installer/ogboot_installer.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/installer/ogboot_installer.py b/installer/ogboot_installer.py index 41a24e0..a00276a 100755 --- a/installer/ogboot_installer.py +++ b/installer/ogboot_installer.py @@ -486,6 +486,7 @@ def install_ipxe(): logger.info ('iPXE already present--not compiling again') return True + cwd = os.getcwd() with tempfile.TemporaryDirectory() as clone_dir: logger.info(f"Clonando el repositorio {ipxe_repo_url}") if subprocess.call(["git", "-c", "http.sslVerify=false", "clone", ipxe_repo_url, clone_dir]) == 0: @@ -528,6 +529,7 @@ def install_ipxe(): subprocess.call(["chown", "-R", "tftp:ogboot", f"{INSTALL_OGBOOT_TARGET}/tftpboot/ipxe_scripts/templates"]) subprocess.call(["chmod", "-R", "775", f"{INSTALL_OGBOOT_TARGET}/tftpboot/ipxe_scripts/templates"]) subprocess.call(["cp", f"{REPO_DIR}/tftpboot/ipxe_scripts/templates/pxe_default", f"{INSTALL_OGBOOT_TARGET}/tftpboot/ipxe_scripts/templates"]) + os.chdir(cwd) return True def get_ip_address(interface): @@ -844,8 +846,8 @@ except Exception as e: try: logger.info("Installing iPXE") if not install_ipxe(): - logger.error(f"Error installing iPXE: {e}") - exit(1) + logger.error(f"Error installing iPXE") + exit(1) except Exception as e: logger.error(f"Error installing iPXE: {e}") exit(1) @@ -859,7 +861,9 @@ except Exception as e: try: logger.info("Create the structure of the accesses to the server from the client (shared)") - copyClientFiles() + if not copyClientFiles(): + logger.error(f"Error creating client structure") + exit(1) except Exception as e: logger.error(f"Error creating client structure: {e}") exit(1)