refs #1016 chdir() out of a deleted directory

pull/5/head
Natalia Serrano 2024-10-22 15:18:04 +00:00
parent dd44a43ec2
commit ab79c9f6eb
1 changed files with 7 additions and 3 deletions

View File

@ -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)