X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_mon%2Fcore%2Fauth.py;h=71a817e22efc15eb2179bf52d8952b510314f82e;hb=refs%2Fchanges%2F41%2F7141%2F3;hp=3a88a50eb1c0446b8772ce3b0f9a9f1f47aa05f4;hpb=75512477988ae5e287433c6c859c61de1bc82318;p=osm%2FMON.git diff --git a/osm_mon/core/auth.py b/osm_mon/core/auth.py index 3a88a50..71a817e 100644 --- a/osm_mon/core/auth.py +++ b/osm_mon/core/auth.py @@ -23,15 +23,19 @@ ## import json +import logging from osm_mon.core.database import VimCredentials, DatabaseManager +log = logging.getLogger(__name__) + class AuthManager: def __init__(self): self.database_manager = DatabaseManager() def store_auth_credentials(self, creds_dict): + log.info(creds_dict) credentials = VimCredentials() credentials.uuid = creds_dict['_id'] credentials.name = creds_dict['name'] @@ -47,11 +51,16 @@ class AuthManager: def get_credentials(self, vim_uuid): creds = self.database_manager.get_credentials(vim_uuid) - if creds.config is None: - creds.config = {} return creds def delete_auth_credentials(self, creds_dict): credentials = self.get_credentials(creds_dict['_id']) if credentials: credentials.delete_instance() + + def get_config(self, vim_uuid): + return json.loads(self.get_credentials(vim_uuid).config) + + def is_verify_ssl(self, vim_uuid): + vim_config = self.get_config(vim_uuid) + return 'insecure' not in vim_config or vim_config['insecure'] is False