Fix flake8
[osm/N2VC.git] / n2vc / n2vc_conn.py
index 97b6188..8f6c3ef 100644 (file)
@@ -64,7 +64,7 @@ class N2VCConnector(abc.ABC, Loggable):
             url: str,
             username: str,
             vca_config: dict,
             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
 
     ):
         """Initialize N2VC abstract connector. It defines de API for VCA connectors
 
@@ -106,6 +106,8 @@ class N2VCConnector(abc.ABC, Loggable):
         self.on_update_db = on_update_db
 
         # generate private/public key-pair
         self.on_update_db = on_update_db
 
         # generate private/public key-pair
+        self.private_key_path = None
+        self.public_key_path = None
         self.get_public_key()
 
     @abc.abstractmethod
         self.get_public_key()
 
     @abc.abstractmethod
@@ -116,7 +118,7 @@ class N2VCConnector(abc.ABC, Loggable):
         """
 
     # TODO: review which public key
         """
 
     # TODO: review which public key
-    async def get_public_key(self) -> str:
+    def get_public_key(self) -> str:
         """Get the VCA ssh-public-key
 
         Returns the SSH public key from local mahine, to be injected into virtual machines to
         """Get the VCA ssh-public-key
 
         Returns the SSH public key from local mahine, to be injected into virtual machines to
@@ -438,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 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']:
         elif status in ['active']:
             return N2VCDeploymentStatus.COMPLETED
         elif status in ['blocked']: