Fix issue when printing kdu status without notes 31/8631/2
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 24 Feb 2020 11:10:28 +0000 (11:10 +0000)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 5 Mar 2020 09:29:25 +0000 (09:29 +0000)
Change-Id: Icf917868945bf4aa7132963b9bca113a48a4ea80
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osmclient/scripts/osm.py

index 2e36e4b..fe5318b 100755 (executable)
@@ -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: