From 683afa64657bf661f719e4e646457353199f38ec Mon Sep 17 00:00:00 2001 From: Alvaro Neira Ayuso Date: Mon, 13 Jan 2020 19:01:34 +0100 Subject: Improve software command response behavior During our tests, we found some limitation during the execution of the software command. We don't manage errors during the execution of this command. Moreover, the server needs some information in case that everything is OK. This patch modified the code for controlling the errors during the execution, returning an "Internal Error" http message (500). Moreover, in case that everything is OK, ogClient sends a message with this json body: { "disk" : "0", "partition" : "1", "software" : "xyz" } "xyz" will be the output saved during the execution of InventarioSoftware in a specific path. --- 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 e3dea5a..0034fd7 100644 --- a/src/linux/ogOperations.py +++ b/src/linux/ogOperations.py @@ -40,7 +40,11 @@ def procsoftware(httpparser, path): disk = httpparser.getDisk() partition = httpparser.getPartition() - result = subprocess.check_output([OG_PATH + 'interfaceAdm/InventarioSoftware', disk, partition, path], shell=True) + try: + result = subprocess.check_output([OG_PATH + 'interfaceAdm/InventarioSoftware', disk, partition, path], shell=True) + except: + raise ValueError('Error: Incorrect command value') + return result.decode('utf-8') def prochardware(path): -- cgit v1.2.3-18-g5258