Bug 1234: OSM reports successful deployment when a charm relation fails
[osm/LCM.git] / osm_lcm / ns.py
index 3e6bafc..b7df0b6 100644 (file)
@@ -2044,13 +2044,16 @@ class NsLcm(LcmBase):
             )
 
             # add relations for this VCA (wait for other peers related with this VCA)
-            await self._add_vca_relations(
+            is_relation_added = await self._add_vca_relations(
                 logging_text=logging_text,
                 nsr_id=nsr_id,
                 vca_type=vca_type,
                 vca_index=vca_index,
             )
 
+            if not is_relation_added:
+                raise LcmException("Relations could not be added to VCA.")
+
             # if SSH access is required, then get execution environment SSH public
             # if native charm we have waited already to VM be UP
             if vca_type in ("k8s_proxy_charm", "lxc_proxy_charm", "helm", "helm-v3"):
@@ -2245,7 +2248,7 @@ class NsLcm(LcmBase):
             self._write_configuration_status(
                 nsr_id=nsr_id, vca_index=vca_index, status="BROKEN"
             )
-            raise LcmException("{} {}".format(step, e)) from e
+            raise LcmException("{}. {}".format(step, e)) from e
 
     def _write_ns_status(
         self,
@@ -3213,11 +3216,14 @@ class NsLcm(LcmBase):
                 requirer_vca_id,
                 relation.requirer.endpoint,
             )
-            await self.vca_map[vca_type].add_relation(
-                provider=provider_relation_endpoint,
-                requirer=requirer_relation_endpoint,
-            )
-            # remove entry from relations list
+            try:
+                await self.vca_map[vca_type].add_relation(
+                    provider=provider_relation_endpoint,
+                    requirer=requirer_relation_endpoint,
+                )
+            except N2VCException as exception:
+                self.logger.error(exception)
+                raise LcmException(exception)
             return True
         return False