refs #1055 adds ogadmeClient template and use ogcore ip to generate ogAdmClient.cfg to the client

ogboot-log
Luis Gerardo Romero Garcia 2024-11-07 16:58:06 +01:00
parent 780d17310b
commit c7a87f96c1
3 changed files with 31 additions and 5 deletions

View File

@ -1,5 +0,0 @@
ServidorAdm=SERVERIP
PUERTO=2008
PATHINTERFACE=/opt/opengnsys/interfaceAdm
UrlMenu=OPENGNSYSURL/varios/menubrowser.php
UrlMsg=http://localhost/cgi-bin/httpd-log.sh

View File

@ -0,0 +1,5 @@
ServidorAdm=__OGCOREIP__
PUERTO=2008
PATHINTERFACE=/opt/opengnsys/interfaceAdm
UrlMenu=OGCOREURL/varios/menubrowser.php
UrlMsg=http://localhost/cgi-bin/httpd-log.sh

View File

@ -443,12 +443,38 @@ def copyClientFiles():
logger.error(f"Error while copying engine files")
errstatus = 1
# Creación del archivo ogAdmClient.cfg
try:
template_path = os.path.join(REPO_DIR, "etc/ogAdmClient.cfg.tmpl")
output_path = os.path.join(INSTALL_OGBOOT_TARGET, "client/etc/ogAdmClient.cfg")
# Construcción de la URL de la consola
console_url = f"https://{OGCORE_IP}/opengnsys"
# Leer la plantilla y realizar los reemplazos
with open(template_path, 'r') as template_file:
content = template_file.read()
content = content.replace("__OGCOREIP__", OGCORE_IP)
content = content.replace("__OGCOREURL__", console_url)
# Crear el archivo de configuración resultante
os.makedirs(os.path.dirname(output_path), mode=0o775, exist_ok=True)
with open(output_path, 'w') as config_file:
config_file.write(content)
logger.info("Configuration file ogAdmClient.cfg created successfully.")
except Exception as e:
logger.error(f"Error creating ogAdmClient.cfg: {e}")
errstatus = 1
if errstatus == 0:
logger.info(f"Client copy files success.")
else:
logger.error(f"Client copy files with errors")
return not errstatus
def get_first_network_interface_with_traffic():
with open('/proc/net/dev') as f:
for line in f: