From 0f32b9ca88d0870e717549ffe14d9717a1b034e4 Mon Sep 17 00:00:00 2001 From: Alvaro Neira Ayuso Date: Mon, 13 Jan 2020 18:38:34 +0100 Subject: Catch execution errors during init session command This patch allows us to catch an exception when something wrong is happening executing the init session command. In error cases, ogClient sends an internal error http message to the server. Otherwise, an OK http message. --- src/linux/ogOperations.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/linux') diff --git a/src/linux/ogOperations.py b/src/linux/ogOperations.py index 5c136fa..e3dea5a 100644 --- a/src/linux/ogOperations.py +++ b/src/linux/ogOperations.py @@ -29,7 +29,11 @@ def procsession(httpparser): disk = httpparser.getDisk() partition = httpparser.getPartition() - result = subprocess.check_output([OG_PATH + 'interfaceAdm/IniciarSesion', disk, partition], shell=True) + try: + result = subprocess.check_output([OG_PATH + 'interfaceAdm/IniciarSesion', disk, partition], shell=True) + except: + raise ValueError('Error: Incorrect command value') + return result.decode('utf-8') def procsoftware(httpparser, path): -- cgit v1.2.3-18-g5258