From: tierno Date: Thu, 29 Sep 2016 14:20:44 +0000 (+0000) Subject: fixing logs at vimconn X-Git-Tag: v1.0.0~14 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=fe78990bf0944f559acb02c69452124db66fe8a4;p=osm%2FRO.git fixing logs at vimconn Signed-off-by: tierno --- diff --git a/vimconn.py b/vimconn.py index 7d68ac45..cd529de8 100644 --- a/vimconn.py +++ b/vimconn.py @@ -82,7 +82,7 @@ class vimconnector(): These plugins must implement a vimconnector class derived from this and all these methods ''' - def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None, log_level="ERROR", config={}): + def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None, log_level=None, config={}): self.id = uuid self.name = name self.url = url @@ -93,7 +93,8 @@ class vimconnector(): self.passwd = passwd self.config = config self.logger = logging.getLogger('openmano.vim') - self.logger.setLevel( getattr(logging, log_level) ) + if log_level: + self.logger.setLevel( getattr(logging, log_level) ) if not self.url_admin: #try to use normal url self.url_admin = self.url diff --git a/vimconn_openstack.py b/vimconn_openstack.py index f44257d4..6396b77a 100644 --- a/vimconn_openstack.py +++ b/vimconn_openstack.py @@ -56,7 +56,7 @@ netStatus2manoFormat={'ACTIVE':'ACTIVE','PAUSED':'PAUSED','INACTIVE':'INACTIVE', } class vimconnector(vimconn.vimconnector): - def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None, log_level="DEBUG", config={}): + def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None, log_level=None, config={}): '''using common constructor parameters. In this case 'url' is the keystone authorization url, 'url_admin' is not use @@ -83,6 +83,8 @@ class vimconnector(vimconn.vimconnector): self.n_creds['api_key'] = passwd self.reload_client = True self.logger = logging.getLogger('openmano.vim.openstack') + if log_level: + self.logger.setLevel( getattr(logging, log_level) ) def __setitem__(self,index, value): '''Set individuals parameters diff --git a/vimconn_vmware.py b/vimconn_vmware.py index 64a1542e..069c0bc8 100644 --- a/vimconn_vmware.py +++ b/vimconn_vmware.py @@ -103,7 +103,7 @@ flavorlist = {} class vimconnector(vimconn.vimconnector): def __init__(self, uuid=None, name=None, tenant_id=None, tenant_name=None, - url=None, url_admin=None, user=None, passwd=None, log_level="ERROR", config={}): + url=None, url_admin=None, user=None, passwd=None, log_level=None, config={}): """ Constructor create vmware connector to vCloud director. @@ -151,7 +151,8 @@ class vimconnector(vimconn.vimconnector): self.admin_user = None self.logger = logging.getLogger('openmano.vim.vmware') - self.logger.setLevel(10) + if log_level: + self.logger.setLevel( getattr(logging, log_level) ) try: self.admin_user = config['admin_username'] @@ -159,7 +160,6 @@ class vimconnector(vimconn.vimconnector): except KeyError: raise vimconn.vimconnException(message="Error admin username or admin password is empty.") - self.logger = logging.getLogger('mano.vim.vmware') self.org_uuid = None self.vca = None