From: quilesj Date: Fri, 29 Nov 2019 11:19:14 +0000 (+0000) Subject: Fix flake8 X-Git-Tag: v7.0.0rc1~2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F09%2F8309%2F1;p=osm%2FN2VC.git Fix flake8 Change-Id: Ia81b37958ab03630cf9f3c65ab1ec59a95f82d68 Signed-off-by: quilesj --- diff --git a/n2vc/juju_observer.py b/n2vc/juju_observer.py index f4102a4..25c1c1f 100644 --- a/n2vc/juju_observer.py +++ b/n2vc/juju_observer.py @@ -54,7 +54,7 @@ class JujuModelObserver(ModelObserver): def register_machine(self, machine: Machine, db_dict: dict): try: entity_id = machine.entity_id - except: + except Exception as e: # no entity_id aatribute, try machine attribute entity_id = machine.machine self.n2vc.debug(msg='Registering machine for changes notifications: {}'.format(entity_id)) diff --git a/n2vc/n2vc_conn.py b/n2vc/n2vc_conn.py index d3aaf35..8f6c3ef 100644 --- a/n2vc/n2vc_conn.py +++ b/n2vc/n2vc_conn.py @@ -64,7 +64,7 @@ class N2VCConnector(abc.ABC, Loggable): url: str, username: str, vca_config: dict, - on_update_db = None + on_update_db=None ): """Initialize N2VC abstract connector. It defines de API for VCA connectors @@ -440,6 +440,8 @@ def juju_status_2_osm_status(type: str, status: str) -> N2VCDeploymentStatus: if type == 'application' or type == 'unit': if status in ['waiting', 'maintenance']: return N2VCDeploymentStatus.RUNNING + if status in ['error']: + return N2VCDeploymentStatus.FAILED elif status in ['active']: return N2VCDeploymentStatus.COMPLETED elif status in ['blocked']: diff --git a/n2vc/n2vc_juju_conn.py b/n2vc/n2vc_juju_conn.py index a9f9b76..6ada220 100644 --- a/n2vc/n2vc_juju_conn.py +++ b/n2vc/n2vc_juju_conn.py @@ -1021,9 +1021,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 +1039,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