From a306b8b9d8cc3248f05dd4b5971a6ddd97ab1cde Mon Sep 17 00:00:00 2001 From: Alvaro Neira Ayuso Date: Mon, 13 Jan 2020 19:31:51 +0100 Subject: Catch execution errors during restore image command This patch allows us to send feedback to the server in case of error during the execution of the command. In case of error, ogClient will send an "Internal Error" 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 447f188..1aa454f 100644 --- a/src/linux/ogOperations.py +++ b/src/linux/ogOperations.py @@ -74,5 +74,9 @@ def procirestore(httpparser): profile = httpparser.getProfile() cid = httpparser.getId() - result = subprocess.check_output([OG_PATH + 'interfaceAdm/RestaurarImagen', disk, partition, name, repo, ctype], shell=True) + try: + result = subprocess.check_output([OG_PATH + 'interfaceAdm/RestaurarImagen', disk, partition, name, repo, ctype], shell=True) + except: + raise ValueError('Error: Incorrect command value') + return result.decode('utf-8') -- cgit v1.2.3-18-g5258