aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Fontaine <julien.fontaine@bell.ca>2020-06-25 17:10:02 -0400
committerKAPIL SINGAL <ks220y@att.com>2020-06-26 04:33:25 +0000
commit829b8c5f758ce9979cdf193bb0cb0d64b31a7f9f (patch)
tree753c28f3529a03140193a1bd0c1977603aaf2003
parenta0ba60caf5ceb5312fdee01d7868bb218950cef7 (diff)
Explicit error message in command-executor when script is failing
Changed error message to print the last execution log (if possible) when the executed script fails. Issue-ID: CCSDK-2481 Signed-off-by: Julien Fontaine <julien.fontaine@bell.ca> Change-Id: I9df9dfeeaf95d98049c4f80f827deb85a29137da
-rw-r--r--ms/command-executor/src/main/python/command_executor_handler.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/ms/command-executor/src/main/python/command_executor_handler.py b/ms/command-executor/src/main/python/command_executor_handler.py
index 0c476b23e..7c9ef84c1 100644
--- a/ms/command-executor/src/main/python/command_executor_handler.py
+++ b/ms/command-executor/src/main/python/command_executor_handler.py
@@ -151,7 +151,12 @@ class CommandExecutorHandler():
if rc == 0:
return utils.build_ret_data(True, results=result, results_log=results_log)
else:
- err_msg = "{} - Something wrong happened during command execution. See execute command logs for more information.".format(self.blueprint_id)
+ err_msg = ""
+ if len(results_log) > 0:
+ # get exception message
+ err_msg = "{} - {}".format(self.blueprint_id, results_log[-1:][0])
+ else:
+ err_msg = "{} - Process exited with return code {}".format(self.blueprint_id, rc)
return utils.build_ret_data(False, results=result, results_log=results_log, error=err_msg)
def install_packages(self, request, type, f, results):