Update pip packages
[osm/N2VC.git] / n2vc / n2vc_juju_conn.py
index 5dc394c..c6d00a8 100644 (file)
@@ -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,
                 )
 
@@ -1338,7 +1340,18 @@ class N2VCJujuConnector(N2VCConnector):
         elif charm_level == "vdu-level":
             if len(vca_records) < 1:
                 raise N2VCException(message="One or more VCA record is expected.")
-            vdu_profile_id = vnfrs["vdur"][int(vdu_count)]["vdu-id-ref"]
+
+            # Charms are also used for deployments with Helm charts.
+            # If deployment unit is a Helm chart/KDU,
+            # vdu_profile_id and vdu_count will be empty string.
+            vdu_profile_id = ""
+
+            if vdu_count is None:
+                vdu_count = ""
+
+            elif vdu_count:
+                vdu_profile_id = vnfrs["vdur"][int(vdu_count)]["vdu-id-ref"]
+
             # If vnf/vdu is scaled, more than one VCA record may be included in vca_records
             # but ee_descriptor_id is same.
             # Shorten the ee_descriptor_id, member-vnf-index-ref and vdu_profile_id