oginstaller launch installer
oginstaller/pipeline/head There was a failure building this commit
Details
oginstaller/pipeline/head There was a failure building this commit
Details
parent
520b2861fc
commit
12ca1e75fd
|
@ -1,10 +1,39 @@
|
|||
import curses
|
||||
import json
|
||||
import os
|
||||
from git import Repo
|
||||
|
||||
|
||||
CONFIGS_DIR = "/tmp/oginstall"
|
||||
os.makedirs(CONFIGS_DIR, exist_ok=True)
|
||||
|
||||
REPO_URL = "https://ognproject.evlt.uma.es/gitea/opengnsys/ogcore.git"
|
||||
|
||||
def get_git_tags():
|
||||
try:
|
||||
repo_path = os.path.join(CONFIGS_DIR, "opengnsys_repo")
|
||||
if not os.path.exists(repo_path):
|
||||
print("Clonando el repositorio...")
|
||||
Repo.clone_from(REPO_URL, repo_path) # Clona el repositorio si no existe
|
||||
else:
|
||||
print("Usando repositorio existente en", repo_path)
|
||||
|
||||
repo = Repo(repo_path)
|
||||
# pattern = "opengnsys"
|
||||
# tags = [tag.name for tag in repo.tags if tag.name.startswith(pattern)]
|
||||
tags = [tag.name for tag in repo.tags]
|
||||
# Comprobar si se han obtenido tags correctamente
|
||||
if tags:
|
||||
print("Tags encontrados:", tags)
|
||||
else:
|
||||
print("No se encontraron tags con el patrón especificado.")
|
||||
|
||||
return tags
|
||||
except Exception as e:
|
||||
print("Error al obtener los tags:", str(e))
|
||||
return []
|
||||
|
||||
|
||||
def main(stdscr):
|
||||
# Inicializar colores
|
||||
curses.start_color()
|
||||
|
@ -22,6 +51,7 @@ def main(stdscr):
|
|||
# Mostrar instrucciones y opciones de componentes
|
||||
stdscr.addstr(1, 2, "Selecciona los componentes (usa Flechas para navegar, Espacio para seleccionar, Enter para continuar):", curses.color_pair(1) | curses.A_BOLD)
|
||||
|
||||
|
||||
while True:
|
||||
# Mostrar el estado actual de selección de cada componente
|
||||
for idx, comp in enumerate(components):
|
||||
|
@ -50,6 +80,32 @@ def main(stdscr):
|
|||
|
||||
stdscr.refresh()
|
||||
|
||||
# Menu de selección de releases
|
||||
tags = get_git_tags()
|
||||
tag_index = 0
|
||||
|
||||
stdscr.clear()
|
||||
|
||||
while True:
|
||||
for idx, tag in enumerate(tags):
|
||||
if idx == tag_index:
|
||||
stdscr.addstr(idx + 3, 4, f"> {tag}", curses.color_pair(1))
|
||||
else:
|
||||
stdscr.addstr(idx + 3, 4, f" {tag}", curses.color_pair(1))
|
||||
|
||||
key = stdscr.getch()
|
||||
|
||||
if key == curses.KEY_UP and tag_index > 0: # Navegar hacia arriba
|
||||
tag_index -= 1
|
||||
elif key == curses.KEY_DOWN and tag_index < len(tags) - 1: # Navegar hacia abajo
|
||||
tag_index += 1
|
||||
elif key == ord("\n"): # Confirma la selección con Enter
|
||||
break
|
||||
|
||||
stdscr.refresh()
|
||||
|
||||
|
||||
|
||||
# Ahora pasamos a la configuración específica de cada componente seleccionado
|
||||
curses.echo() # Activar eco para mostrar la entrada
|
||||
for component in selected_components:
|
||||
|
@ -63,18 +119,12 @@ def main(stdscr):
|
|||
user = stdscr.getstr(3, 26, 20).decode("utf-8")
|
||||
stdscr.addstr(4, 4, "Contraseña:", curses.color_pair(1))
|
||||
password = stdscr.getstr(4, 26, 20).decode("utf-8")
|
||||
stdscr.addstr(5, 4, "Tag del contenedor:", curses.color_pair(1))
|
||||
container_tag = stdscr.getstr(5, 26, 20).decode("utf-8")
|
||||
|
||||
config_data = {"username": user, "password": password, "container_version": container_tag}
|
||||
config_data = {"username": user, "password": password, "container_version": tags[tag_index]}
|
||||
|
||||
elif component == "ogGui":
|
||||
stdscr.addstr(3, 4, "IP del servidor de ogCore:", curses.color_pair(1))
|
||||
ogcore_ip = stdscr.getstr(3, 32, 20).decode("utf-8")
|
||||
stdscr.addstr(4, 4, "Tag del contenedor:", curses.color_pair(1))
|
||||
container_version = stdscr.getstr(4, 32, 20).decode("utf-8")
|
||||
|
||||
config_data = {"ogcore_ip": ogcore_ip, "container_version": container_version}
|
||||
config_data = {"ogcore_ip": ogcore_ip, "container_version": tags[tag_index]}
|
||||
|
||||
elif component == "ogDhcp":
|
||||
stdscr.addstr(3, 4, "Configuración IP servidor de Boot:", curses.color_pair(1))
|
||||
|
@ -82,8 +132,7 @@ def main(stdscr):
|
|||
stdscr.addstr(4, 4, "Interfaces Boot (separadas por coma):", curses.color_pair(1))
|
||||
interfaces = stdscr.getstr(4, 40, 20).decode("utf-8")
|
||||
json_array_interfaces = interfaces.split(",")
|
||||
|
||||
config_data = {"ogbootIP": ogbootIP, "interfaces": json_array_interfaces}
|
||||
config_data = {"ogbootIP": ogbootIP, "interfaces": json_array_interfaces , "relase": tags[tag_index]}
|
||||
|
||||
elif component == "ogBoot":
|
||||
stdscr.addstr(3, 4, "ogCore Ip Server:", curses.color_pair(1))
|
||||
|
@ -106,6 +155,7 @@ def main(stdscr):
|
|||
"ogboot_gitrepo": ogboot_gitrepo,
|
||||
"ogboot_samba_user": ogboot_samba_user,
|
||||
"ogboot_samba_pass": ogboot_samba_pass,
|
||||
"release": tags[tag_index]
|
||||
}
|
||||
elif component == "ogRepository":
|
||||
stdscr.addstr(3, 4, "ogRepository IP Server: ", curses.color_pair(1))
|
||||
|
@ -119,6 +169,7 @@ def main(stdscr):
|
|||
"ogrepository_ip": ogrepository_ip,
|
||||
"ogrepository_samba_user": ogrepository_samba_user,
|
||||
"ogrepository_samba_pass": ogrepository_samba_pass,
|
||||
"release": tags[tag_index]
|
||||
}
|
||||
# Guardar en archivo JSON
|
||||
config_file = os.path.join(CONFIGS_DIR, f"config_{component}.json")
|
||||
|
|
|
@ -45,4 +45,5 @@ install_packages
|
|||
download_installer
|
||||
extract_installer
|
||||
create_questions
|
||||
launch_component_installer
|
||||
|
||||
|
|
Loading…
Reference in New Issue