refs #477 Adds tftpboot dirs creations

ogboot_installer
Luis Gerardo Romero Garcia 2024-07-01 11:36:32 +02:00
parent eb5080da08
commit a72a61e758
1 changed files with 22 additions and 14 deletions

View File

@ -300,20 +300,28 @@ def og_core_create_user(OPENGNSYS_CLIENT_USER):
logger.info(f"User {OPENGNSYS_CLIENT_USER} created successfully.")
def og_boot_create_dirs():
if os.path.exists(INSTALL_OGBOOT_TARGET):
if not os.path.isdir(INSTALL_OGBOOT_TARGET):
raise NotADirectoryError(f"{INSTALL_OGBOOT_TARGET} exists and is not a directory.")
else:
logger.warning(f"{INSTALL_OGBOOT_TARGET} directory already exists.")
else:
try:
os.makedirs(INSTALL_OGBOOT_TARGET, mode=0o750, exist_ok=True)
os.makedirs(os.path.join(INSTALL_OGBOOT_TARGET, "client"), mode=0o750, exist_ok=True)
subprocess.run(["sudo", "chown", "-R", "ogboot:ogboot", INSTALL_OGBOOT_TARGET])
logger.info(f"{INSTALL_OGBOOT_TARGET} directory created successfully.")
except OSError:
logger.error("Error while creating directory paths!")
exit(1)
if os.path.exists(INSTALL_OGBOOT_TARGET):
if not os.path.isdir(INSTALL_OGBOOT_TARGET):
raise NotADirectoryError(f"{INSTALL_OGBOOT_TARGET} exists and is not a directory.")
else:
logger.warning(f"{INSTALL_OGBOOT_TARGET} directory already exists.")
else:
try:
# Crear los directorios necesarios
os.makedirs(INSTALL_OGBOOT_TARGET, mode=0o750, exist_ok=True)
os.makedirs(os.path.join(INSTALL_OGBOOT_TARGET, "client"), mode=0o750, exist_ok=True)
os.makedirs("/opt/ogboot/tftpboot/", mode=0o750, exist_ok=True)
os.makedirs("/opt/ogboot/tftpboot/ipxe_scripts", mode=0o750, exist_ok=True)
os.makedirs("/opt/ogboot/tftpboot/ipxe_scripts/templates", mode=0o750, exist_ok=True)
# Cambiar el propietario de los directorios
subprocess.run(["sudo", "chown", "-R", "ogboot:ogboot", INSTALL_OGBOOT_TARGET])
subprocess.run(["sudo", "chown", "-R", "ogboot:ogboot", "/opt/ogboot/tftpboot/"])
logger.info(f"{INSTALL_OGBOOT_TARGET} directory created successfully.")
except OSError:
logger.error("Error while creating directory paths!")
exit(1)
def og_boot_symfony_install(path_opengnsys_base):
logger.info("Creating Symfony application skeleton...")