Fix Healing operation: additionalParams KeyError 90/13390/3
authorGulsum Atici <gulsum.atici@canonical.com>
Mon, 15 May 2023 12:45:31 +0000 (15:45 +0300)
committercubag <gcuba@whitestack.com>
Mon, 22 May 2023 18:06:06 +0000 (20:06 +0200)
If target_vnf does not have additionalParams
KeyError is raised and additionalParams become optional within this change.

Change-Id: I69cb579882b305befd2a64a60bede450e8e6c10d
Signed-off-by: Gulsum Atici <gulsum.atici@canonical.com>
osm_lcm/ns.py

index 8aa3f5a..305b70b 100644 (file)
@@ -7890,9 +7890,9 @@ class NsLcm(LcmBase):
                     for target_vdu in target_vdu_list:
                         deploy_params_vdu = target_vdu
                         # Set run-day1 vnf level value if not vdu level value exists
-                        if not deploy_params_vdu.get("run-day1") and target_vnf[
-                            "additionalParams"
-                        ].get("run-day1"):
+                        if not deploy_params_vdu.get("run-day1") and target_vnf.get(
+                            "additionalParams", {}
+                        ).get("run-day1"):
                             deploy_params_vdu["run-day1"] = target_vnf[
                                 "additionalParams"
                             ].get("run-day1")