X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=n2vc%2Fn2vc_juju_conn.py;h=7c55af73045ceee4d43226b0bbdc37ad2b710051;hp=a9f9b764b1c419a1f89299b9bfc4dc03bef763fa;hb=ad3a05447418afef1d7b1998f9d7e351ccf9fe40;hpb=a6748412b421c7abd8eae504ae6205da2e113cba diff --git a/n2vc/n2vc_juju_conn.py b/n2vc/n2vc_juju_conn.py index a9f9b76..7c55af7 100644 --- a/n2vc/n2vc_juju_conn.py +++ b/n2vc/n2vc_juju_conn.py @@ -439,7 +439,7 @@ class N2VCJujuConnector(N2VCConnector): raise e # return public key if exists - return output + return output["pubkey"] if "pubkey" in output else output async def add_relation( self, @@ -706,18 +706,22 @@ class N2VCJujuConnector(N2VCConnector): :return: app-vnf--vdu--cnt- """ + # TODO: Enforce the Juju 50-character application limit + # split namespace components _, _, vnf_id, vdu_id, vdu_count = self._get_namespace_components(namespace=namespace) if vnf_id is None or len(vnf_id) == 0: vnf_id = '' else: - vnf_id = 'vnf-' + vnf_id + # Shorten the vnf_id to its last twelve characters + vnf_id = 'vnf-' + vnf_id[-12:] if vdu_id is None or len(vdu_id) == 0: vdu_id = '' else: - vdu_id = '-vdu-' + vdu_id + # Shorten the vdu_id to its last twelve characters + vdu_id = '-vdu-' + vdu_id[-12:] if vdu_count is None or len(vdu_count) == 0: vdu_count = '' @@ -1021,9 +1025,6 @@ class N2VCJujuConnector(N2VCConnector): total_timeout: float = None ): - # get juju model - model = await self._juju_get_model(model_name=model_name) - # get the application application = await self._juju_get_application(model_name=model_name, application_name=application_name) @@ -1042,10 +1043,11 @@ class N2VCJujuConnector(N2VCConnector): ) # check if 'verify-ssh-credentials' action exists - unit = application.units[0] + # unit = application.units[0] actions = await application.get_actions() if 'verify-ssh-credentials' not in actions: msg = 'Action verify-ssh-credentials does not exist in application {}'.format(application_name) + self.debug(msg=msg) return False # execute verify-credentials