+ return True
+ # TODO: Remove these commented lines
+ # if not self.authenticated:
+ # self.log.debug("[uninstall] Connecting to controller")
+ # await self.login(cluster_uuid)
+
+ async def exec_primitive(
+ self,
+ cluster_uuid: str = None,
+ kdu_instance: str = None,
+ primitive_name: str = None,
+ timeout: float = 300,
+ params: dict = None,
+ db_dict: dict = None,
+ **kwargs,
+ ) -> str:
+ """Exec primitive (Juju action)
+
+ :param cluster_uuid str: The UUID of the cluster
+ :param kdu_instance str: The unique name of the KDU instance
+ :param primitive_name: Name of action that will be executed
+ :param timeout: Timeout for action execution
+ :param params: Dictionary of all the parameters needed for the action
+ :param db_dict: Dictionary for any additional data
+ :param kwargs: Additional parameters
+ vca_id (str): VCA ID
+
+ :return: Returns the output of the action
+ """
+ libjuju = await self._get_libjuju(kwargs.get("vca_id"))
+
+ if not params or "application-name" not in params:
+ raise K8sException(
+ "Missing application-name argument, \
+ argument needed for K8s actions"
+ )
+ try:
+ self.log.debug(
+ "[exec_primitive] Getting model "
+ "kdu_instance: {}".format(kdu_instance)
+ )
+ application_name = params["application-name"]
+ actions = await libjuju.get_actions(application_name, kdu_instance)
+ if primitive_name not in actions:
+ raise K8sException("Primitive {} not found".format(primitive_name))
+ output, status = await libjuju.execute_action(
+ application_name, kdu_instance, primitive_name, **params
+ )
+
+ if status != "completed":
+ raise K8sException(
+ "status is not completed: {} output: {}".format(status, output)
+ )
+ if self.on_update_db:
+ await self.on_update_db(
+ cluster_uuid, kdu_instance, filter=db_dict["filter"]
+ )