model_name=model, total_timeout=total_timeout
)
except Exception as e:
+ self.log.error(f"Error deleting namespace {namespace} : {e}")
raise N2VCException(
message="Error deleting namespace {} : {}".format(
namespace, e
message="only ns_id is permitted to delete yet",
bad_args=["namespace"],
)
+ except Exception as e:
+ self.log.error(f"Error deleting namespace {namespace} : {e}")
+ raise e
finally:
self.delete_namespace_locks.pop(namespace)
self.log.info("Namespace {} deleted".format(namespace))
primitive_name=primitive_name,
)
+ async def upgrade_charm(
+ self,
+ ee_id: str = None,
+ path: str = None,
+ charm_id: str = None,
+ charm_type: str = None,
+ timeout: float = None,
+ ) -> str:
+ """This method upgrade charms in VNFs
+
+ Args:
+ ee_id: Execution environment id
+ path: Local path to the charm
+ charm_id: charm-id
+ charm_type: Charm type can be lxc-proxy-charm, native-charm or k8s-proxy-charm
+ timeout: (Float) Timeout for the ns update operation
+
+ Returns:
+ The output of the update operation if status equals to "completed"
+
+ """
+ self.log.info("Upgrading charm: {} on ee: {}".format(path, ee_id))
+ libjuju = await self._get_libjuju(charm_id)
+
+ # check arguments
+ if ee_id is None or len(ee_id) == 0:
+ raise N2VCBadArgumentsException(
+ message="ee_id is mandatory", bad_args=["ee_id"]
+ )
+ try:
+ (
+ model_name,
+ application_name,
+ machine_id,
+ ) = N2VCJujuConnector._get_ee_id_components(ee_id=ee_id)
+
+ except Exception:
+ raise N2VCBadArgumentsException(
+ message="ee_id={} is not a valid execution environment id".format(
+ ee_id
+ ),
+ bad_args=["ee_id"],
+ )
+
+ try:
+ await libjuju.upgrade_charm(
+ application_name=application_name,
+ path=path,
+ model_name=model_name,
+ total_timeout=timeout,
+ )
+
+ return f"Charm upgraded with application name {application_name}"
+
+ except Exception as e:
+ self.log.error("Error upgrading charm {}: {}".format(path, e))
+
+ raise N2VCException(
+ message="Error upgrading charm {} in ee={} : {}".format(path, ee_id, e)
+ )
+
async def disconnect(self, vca_id: str = None):
"""
Disconnect from VCA
)
def _write_ee_id_db(self, db_dict: dict, ee_id: str):
-
# write ee_id to database: _admin.deployed.VCA.x
try:
the_table = db_dict["collection"]