X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2Flcm_helm_conn.py;h=831190bb6499e1234286b8d6f1465fde586d11a8;hb=a7cb70b362dd95528deb64ab21ebad953009add6;hp=9608b6394b344e655ea36f69339a2cc25c92d5a4;hpb=18ebc3ad0e546dfa7ce649d336bd1c838b38d94c;p=osm%2FLCM.git diff --git a/osm_lcm/lcm_helm_conn.py b/osm_lcm/lcm_helm_conn.py index 9608b63..831190b 100644 --- a/osm_lcm/lcm_helm_conn.py +++ b/osm_lcm/lcm_helm_conn.py @@ -29,6 +29,9 @@ from osm_lcm.frontend_pb2 import SshKeyRequest, SshKeyReply from osm_lcm.frontend_grpc import FrontendExecutorStub from osm_lcm.lcm_utils import LcmBase +from osm_lcm.data_utils.database.database import Database +from osm_lcm.data_utils.filesystem.filesystem import Filesystem + from n2vc.n2vc_conn import N2VCConnector from n2vc.k8s_helm_conn import K8sHelmConnector from n2vc.k8s_helm3_conn import K8sHelm3Connector @@ -72,8 +75,6 @@ class LCMHelmConn(N2VCConnector, LcmBase): _MAX_RETRY_TIME = 30 def __init__(self, - db: object, - fs: object, log: object = None, loop: object = None, url: str = None, @@ -84,17 +85,20 @@ class LCMHelmConn(N2VCConnector, LcmBase): Initialize EE helm connector. """ + self.db = Database().instance.db + self.fs = Filesystem().instance.fs + # parent class constructor N2VCConnector.__init__( self, - db=db, - fs=fs, log=log, loop=loop, url=url, username=username, vca_config=vca_config, on_update_db=on_update_db, + db=self.db, + fs=self.fs ) self.log.debug("Initialize helm N2VC connector") @@ -111,8 +115,8 @@ class LCMHelmConn(N2VCConnector, LcmBase): kubectl_command=self.vca_config.get("kubectlpath"), helm_command=self.vca_config.get("helmpath"), fs=self.fs, - log=self.log, db=self.db, + log=self.log, on_update_db=None, ) @@ -137,7 +141,8 @@ class LCMHelmConn(N2VCConnector, LcmBase): total_timeout: float = None, config: dict = None, artifact_path: str = None, - vca_type: str = None) -> (str, dict): + vca_type: str = None, + *kargs, **kwargs) -> (str, dict): """ Creates a new helm execution environment deploying the helm-chat indicated in the attifact_path @@ -189,6 +194,9 @@ class LCMHelmConn(N2VCConnector, LcmBase): else: full_path = self.fs.path + "/" + helm_chart_path + while full_path.find("//") >= 0: + full_path = full_path.replace("//", "/") + try: # Call helm conn install # Obtain system cluster id from database @@ -222,7 +230,8 @@ class LCMHelmConn(N2VCConnector, LcmBase): raise N2VCException("Error deploying chart ee: {}".format(e)) async def register_execution_environment(self, namespace: str, credentials: dict, db_dict: dict, - progress_timeout: float = None, total_timeout: float = None) -> str: + progress_timeout: float = None, total_timeout: float = None, + *kargs, **kwargs) -> str: # nothing to do pass @@ -422,7 +431,7 @@ class LCMHelmConn(N2VCConnector, LcmBase): # Uninstall chart, for backward compatibility we must assume that if there is no # version it is helm-v2 if version == "helm-v3": - await self._k8sclusterhelm3.uninstall(system_cluster_uuid, helm_id) + await self._k8sclusterhelm3.uninstall(system_cluster_uuid, helm_id) else: await self._k8sclusterhelm2.uninstall(system_cluster_uuid, helm_id) self.log.info("ee_id: {} deleted".format(ee_id)) @@ -445,6 +454,7 @@ class LCMHelmConn(N2VCConnector, LcmBase): progress_timeout: float = None, total_timeout: float = None, config: dict = None, + *kargs, **kwargs ) -> str: pass @@ -465,7 +475,7 @@ class LCMHelmConn(N2VCConnector, LcmBase): @retryer(max_wait_time=_MAX_RETRY_TIME, delay_time=_EE_RETRY_DELAY) async def _execute_primitive(self, ip_addr, primitive_name, params, db_dict=None): - return await self._execute_primitive_internal(ip_addr, primitive_name, params, db_dict=db_dict) + return await self._execute_primitive_internal(ip_addr, primitive_name, params, db_dict=db_dict) async def _execute_primitive_internal(self, ip_addr, primitive_name, params, db_dict=None):