summaryrefslogtreecommitdiffstats
path: root/src/linux/ogOperations.py
diff options
context:
space:
mode:
authorJavier Sanchez Parra <jsanchez@soleta.eu>2020-03-20 14:52:20 +0100
committerAlvaro Neira Ayuso <aneira@soleta.eu>2020-03-20 14:53:07 +0100
commit4cd87e987554db0c3105b4717ed07356274ba057 (patch)
treeec579e59dc456315e6f16b5307ddceed611aaf68 /src/linux/ogOperations.py
parentd69841ed97e9f9117dab50233555a9bf30af196b (diff)
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.
Diffstat (limited to 'src/linux/ogOperations.py')
-rw-r--r--src/linux/ogOperations.py26
1 files changed, 13 insertions, 13 deletions
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,