summaryrefslogtreecommitdiffstats
path: root/src/linux/ogOperations.py
diff options
context:
space:
mode:
authorAlvaro Neira Ayuso <aneira@soleta.eu>2020-01-13 11:37:14 +0100
committerAlvaro Neira Ayuso <alvaroneay@gmail.com>2020-01-19 19:50:44 +0100
commit2e342b50c88722fb5d9511a180486bc0fe231519 (patch)
tree8ee300bb676781c3bde3a32b355ccb650765658d /src/linux/ogOperations.py
parentcc11d8f38f6a2f9dd46904272808bb25dac042b8 (diff)
Modify methods to use less arguments
Now, all the arguments are received from httpparser. Those arguments convert the function in long lines of codes. Passing directly the httpparser, all the function will have less arguments and will be more clear the code.
Diffstat (limited to 'src/linux/ogOperations.py')
-rw-r--r--src/linux/ogOperations.py30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/linux/ogOperations.py b/src/linux/ogOperations.py
index bbdfa3d..5c136fa 100644
--- a/src/linux/ogOperations.py
+++ b/src/linux/ogOperations.py
@@ -15,7 +15,8 @@ def reboot():
else:
subprocess.call(['/sbin/reboot'])
-def execCMD(cmd):
+def execCMD(httpparser):
+ cmd = httpparser.getCMD()
cmds = cmd.split(" ")
try:
result = subprocess.check_output(cmds)
@@ -24,11 +25,17 @@ def execCMD(cmd):
return result.decode('utf-8')
-def procsession(disk, partition):
+def procsession(httpparser):
+ disk = httpparser.getDisk()
+ partition = httpparser.getPartition()
+
result = subprocess.check_output([OG_PATH + 'interfaceAdm/IniciarSesion', disk, partition], shell=True)
return result.decode('utf-8')
-def procsoftware(disk, partition, path):
+def procsoftware(httpparser, path):
+ disk = httpparser.getDisk()
+ partition = httpparser.getPartition()
+
result = subprocess.check_output([OG_PATH + 'interfaceAdm/InventarioSoftware', disk, partition, path], shell=True)
return result.decode('utf-8')
@@ -36,11 +43,24 @@ def prochardware(path):
result = subprocess.check_output([OG_PATH + 'interfaceAdm/InventarioHardware', path], shell=True)
return result.decode('utf-8')
-def procsetup(disk, cache, cachesize, partlist):
+def procsetup(httpparser):
+ disk = httpparser.getDisk()
+ cache = httpparser.getCache()
+ cachesize = httpparser.getCacheSize()
+ partlist = httpparser.getPartitionSetup()
+
for part in partlist:
cfg = 'dis=' + disk + '*che=' + cache + '*tch=' + cachesize + '!par=' + part["partition"] + '*cpt='+part["code"] + '*sfi=' + part['filesystem'] + '*tam=' + part['size'] + '*ope=' + part['format'] + '%'
subprocess.check_output([OG_PATH + 'interfaceAdm/Configurar', disk, cfg], shell=True)
-def procirestore(disk, partition, name, repo, ctype, profile, cid):
+def procirestore(httpparser):
+ disk = httpparser.getDisk()
+ partition = httpparser.getPartition()
+ name = httpparser.getName()
+ repo = httpparser.getRepo()
+ ctype = httpparser.getType()
+ profile = httpparser.getProfile()
+ cid = httpparser.getId()
+
result = subprocess.check_output([OG_PATH + 'interfaceAdm/RestaurarImagen', disk, partition, name, repo, ctype], shell=True)
return result.decode('utf-8')