Fix flake8
[osm/N2VC.git] / n2vc / n2vc_juju_conn.py
index aba88ee..6ada220 100644 (file)
@@ -266,11 +266,11 @@ class N2VCJujuConnector(N2VCConnector):
 
         if credentials is None:
             raise N2VCBadArgumentsException(message='credentials are mandatory', bad_args=['credentials'])
 
         if credentials is None:
             raise N2VCBadArgumentsException(message='credentials are mandatory', bad_args=['credentials'])
-        if 'hostname' in credentials:
+        if credentials.get('hostname'):
             hostname = credentials['hostname']
         else:
             raise N2VCBadArgumentsException(message='hostname is mandatory', bad_args=['credentials.hostname'])
             hostname = credentials['hostname']
         else:
             raise N2VCBadArgumentsException(message='hostname is mandatory', bad_args=['credentials.hostname'])
-        if 'username' in credentials:
+        if credentials.get('username'):
             username = credentials['username']
         else:
             raise N2VCBadArgumentsException(message='username is mandatory', bad_args=['credentials.username'])
             username = credentials['username']
         else:
             raise N2VCBadArgumentsException(message='username is mandatory', bad_args=['credentials.username'])
@@ -1021,9 +1021,6 @@ class N2VCJujuConnector(N2VCConnector):
             total_timeout: float = None
     ):
 
             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)
 
         # 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
                 )
 
         # 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)
         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
             return False
 
         # execute verify-credentials