summaryrefslogtreecommitdiffstats
path: root/src/linux/ogOperations.py
diff options
context:
space:
mode:
authorRoberto Hueso Gómez <rhueso@soleta.eu>2020-01-31 13:19:41 +0100
committerAlvaro Neira Ayuso <aneira@soleta.eu>2020-02-03 10:15:54 +0100
commit2934773d88c0ced60dafa365370871b29c5ba3a1 (patch)
tree61083b6cbeb641d8f9124203014ac49518ab53eb /src/linux/ogOperations.py
parente96e187825ad4e03904b23697215a1bb58bfe3f0 (diff)
Fix /setup execution and response
Diffstat (limited to 'src/linux/ogOperations.py')
-rw-r--r--src/linux/ogOperations.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/linux/ogOperations.py b/src/linux/ogOperations.py
index 73eb5e1..5459768 100644
--- a/src/linux/ogOperations.py
+++ b/src/linux/ogOperations.py
@@ -107,20 +107,27 @@ def setup(request, ogRest):
cachesize = request.getCacheSize()
partlist = request.getPartitionSetup()
listConfigs = []
+ cfg = 'dis=' + disk + '*che=' + cache + '*tch=' + cachesize + '!'
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'] + '%'
+ cfg += 'par=' + part["partition"] + '*cpt='+part["code"] + \
+ '*sfi=' + part['filesystem'] + '*tam=' + \
+ part['size'] + '*ope=' + part['format'] + '%'
if ogRest.terminated:
break
- try:
- ogRest.proc = subprocess.Popen([OG_PATH + 'interfaceAdm/Configurar', disk, cfg], stdout=subprocess.PIPE, shell=True)
- (output, error) = ogRest.proc.communicate()
- except:
- continue
+ cmd = OG_PATH + 'interfaceAdm/Configurar' + " " + disk + " " + cfg
+ try:
+ ogRest.proc = subprocess.Popen([cmd],
+ stdout=subprocess.PIPE,
+ shell=True)
+ (output, error) = ogRest.proc.communicate()
+ except:
+ raise ValueError('Error: Incorrect command value')
- result = subprocess.check_output([OG_PATH + 'interfaceAdm/getConfiguration'], shell=True)
- return parseGetConf(result.decode('utf-8'))[1]
+ cmd_get_conf = OG_PATH + 'interfaceAdm/getConfiguration'
+ result = subprocess.check_output([cmd_get_conf], shell=True)
+ return parseGetConf(result.decode('utf-8'))
def image_restore(request, ogRest):
disk = request.getDisk()