From 2934773d88c0ced60dafa365370871b29c5ba3a1 Mon Sep 17 00:00:00 2001 From: Roberto Hueso Gómez Date: Fri, 31 Jan 2020 13:19:41 +0100 Subject: Fix /setup execution and response --- src/linux/ogOperations.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'src/linux') 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() -- cgit v1.2.3-18-g5258