From 4cd87e987554db0c3105b4717ed07356274ba057 Mon Sep 17 00:00:00 2001 From: Javier Sanchez Parra Date: Fri, 20 Mar 2020 14:52:20 +0100 Subject: Make OG_PATH public This commit changes the OG_PATH to a public varible of the class ogConfig. This way we improve the configurability of the path. --- src/linux/ogOperations.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/linux/ogOperations.py') diff --git a/src/linux/ogOperations.py b/src/linux/ogOperations.py index cc1a278..1f2d1bb 100644 --- a/src/linux/ogOperations.py +++ b/src/linux/ogOperations.py @@ -8,8 +8,8 @@ import os import subprocess +from src.ogConfig import * -OG_PATH = '/opt/opengnsys/' OG_SHELL = '/bin/bash' def parseGetConf(out): @@ -39,16 +39,16 @@ def parseGetConf(out): def poweroff(): if os.path.exists('/scripts/oginit'): - cmd = f'source {OG_PATH}etc/preinit/loadenviron.sh; ' \ - f'{OG_PATH}scripts/poweroff' + cmd = f'source {ogConfig.OG_PATH}etc/preinit/loadenviron.sh; ' \ + f'{ogConfig.OG_PATH}scripts/poweroff' subprocess.call([cmd], shell=True, executable=OG_SHELL) else: subprocess.call(['/sbin/poweroff']) def reboot(): if os.path.exists('/scripts/oginit'): - cmd = f'source {OG_PATH}etc/preinit/loadenviron.sh; ' \ - f'{OG_PATH}scripts/reboot' + cmd = f'source {ogConfig.OG_PATH}etc/preinit/loadenviron.sh; ' \ + f'{ogConfig.OG_PATH}scripts/reboot' subprocess.call([cmd], shell=True, executable=OG_SHELL) else: subprocess.call(['/sbin/reboot']) @@ -70,7 +70,7 @@ def execCMD(request, ogRest): def session(request, ogRest): disk = request.getDisk() partition = request.getPartition() - cmd = f'{OG_PATH}interfaceAdm/IniciarSesion {disk} {partition}' + cmd = f'{ogConfig.OG_PATH}interfaceAdm/IniciarSesion {disk} {partition}' try: ogRest.proc = subprocess.Popen([cmd], @@ -88,7 +88,7 @@ def software(request, path, ogRest): partition = request.getPartition() try: - cmd = f'{OG_PATH}interfaceAdm/InventarioSoftware {disk} ' \ + cmd = f'{ogConfig.OG_PATH}interfaceAdm/InventarioSoftware {disk} ' \ f'{partition} {path}' ogRest.proc = subprocess.Popen([cmd], @@ -103,7 +103,7 @@ def software(request, path, ogRest): def hardware(path, ogRest): try: - cmd = f'{OG_PATH}interfaceAdm/InventarioHardware {path}' + cmd = f'{ogConfig.OG_PATH}interfaceAdm/InventarioHardware {path}' ogRest.proc = subprocess.Popen([cmd], stdout=subprocess.PIPE, shell=True, @@ -129,7 +129,7 @@ def setup(request, ogRest): if ogRest.terminated: break - cmd = f'{OG_PATH}interfaceAdm/Configurar {disk} {cfg}' + cmd = f'{ogConfig.OG_PATH}interfaceAdm/Configurar {disk} {cfg}' try: ogRest.proc = subprocess.Popen([cmd], stdout=subprocess.PIPE, @@ -151,7 +151,7 @@ def image_restore(request, ogRest): ctype = request.getType() profile = request.getProfile() cid = request.getId() - cmd = f'{OG_PATH}interfaceAdm/RestaurarImagen {disk} {partition} ' \ + cmd = f'{ogConfig.OG_PATH}interfaceAdm/RestaurarImagen {disk} {partition} ' \ f'{name} {repo} {ctype}' try: @@ -170,9 +170,9 @@ def image_create(path, request, ogRest): partition = request.getPartition() name = request.getName() repo = request.getRepo() - cmd_software = f'{OG_PATH}interfaceAdm/InventarioSoftware {disk} ' \ + cmd_software = f'{ogConfig.OG_PATH}interfaceAdm/InventarioSoftware {disk} ' \ f'{partition} {path}' - cmd_create_image = f'{OG_PATH}interfaceAdm/CrearImagen {disk} ' \ + cmd_create_image = f'{ogConfig.OG_PATH}interfaceAdm/CrearImagen {disk} ' \ f'{partition} {name} {repo}' try: @@ -200,7 +200,7 @@ def image_create(path, request, ogRest): def refresh(ogRest): try: - cmd = f'{OG_PATH}interfaceAdm/getConfiguration' + cmd = f'{ogConfig.OG_PATH}interfaceAdm/getConfiguration' ogRest.proc = subprocess.Popen([cmd], stdout=subprocess.PIPE, shell=True, -- cgit v1.2.3-18-g5258