From 015abee87f591b8e28f6b982ae4fb9c67e8791bb Mon Sep 17 00:00:00 2001 From: Mark Beierl Date: Fri, 19 Aug 2022 15:02:24 -0400 Subject: [PATCH] Bug 1890: Use output from action Pass the output from the action command back to the caller, regardless of the status of action completion. This allows for failure messages to be passed through to the LCM for storage in the action record. Change-Id: I268c43225b71a80e54712743e61586d57952553e Signed-off-by: Mark Beierl --- n2vc/n2vc_juju_conn.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/n2vc/n2vc_juju_conn.py b/n2vc/n2vc_juju_conn.py index f0569b1..c6d00a8 100644 --- a/n2vc/n2vc_juju_conn.py +++ b/n2vc/n2vc_juju_conn.py @@ -1061,15 +1061,17 @@ class N2VCJujuConnector(N2VCConnector): if status == "completed": return output else: - raise Exception("status is not completed: {}".format(status)) + if "output" in output: + raise Exception(f'{status}: {output["output"]}') + else: + raise Exception( + f"{status}: No further information received from action" + ) + except Exception as e: - self.log.error( - "Error executing primitive {}: {}".format(primitive_name, e) - ) + self.log.error(f"Error executing primitive {primitive_name}: {e}") raise N2VCExecutionException( - message="Error executing primitive {} into ee={} : {}".format( - primitive_name, ee_id, e - ), + message=f"Error executing primitive {primitive_name} in ee={ee_id}: {e}", primitive_name=primitive_name, ) -- 2.25.1