From 023c84a4286cdb8e9b5f1e9c998935701e5116aa Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Mon, 24 Feb 2020 11:10:28 +0000 Subject: [PATCH] Fix issue when printing kdu status without notes Change-Id: Icf917868945bf4aa7132963b9bca113a48a4ea80 Signed-off-by: garciadeblas --- osmclient/scripts/osm.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index 2e36e4b..fe5318b 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -1075,7 +1075,7 @@ def vnf_show(ctx, name, literal, filter, kdu): if "namespace" in op_status and "info" in op_status and \ "last_deployed" in op_status["info"] and "status" in op_status["info"] and \ "code" in op_status["info"]["status"] and "resources" in op_status["info"]["status"] and \ - "notes" in op_status["info"]["status"] and "seconds" in op_status["info"]["last_deployed"]: + "seconds" in op_status["info"]["last_deployed"]: last_deployed_time = datetime.fromtimestamp(op_status["info"]["last_deployed"]["seconds"]).strftime("%a %b %d %I:%M:%S %Y") print("LAST DEPLOYED: {}".format(last_deployed_time)) print("NAMESPACE: {}".format(op_status["namespace"])) @@ -1086,8 +1086,9 @@ def vnf_show(ctx, name, literal, filter, kdu): print() print("RESOURCES:") print(op_status["info"]["status"]["resources"]) - print("NOTES:") - print(op_status["info"]["status"]["notes"]) + if "notes" in op_status["info"]["status"]: + print("NOTES:") + print(op_status["info"]["status"]["notes"]) else: print(op_info_status) except Exception: -- 2.25.1