Change access to ceilometerclient

This patch use ceilometerclient more common way: it creates versioned
ceilometerclient instead of importing it directly

blueprint common-client-library-2

Change-Id: Id1d3fd88ff8d1da332f85340377c6d756d5c749c
This commit is contained in:
ekudryashova 2014-02-10 13:06:18 +02:00
parent 139206d177
commit ad316199f6
2 changed files with 5 additions and 5 deletions

View File

@ -34,7 +34,7 @@ except ImportError:
swiftclient = None swiftclient = None
logger.info(_('swiftclient not available')) logger.info(_('swiftclient not available'))
try: try:
from ceilometerclient.v2 import client as ceilometerclient from ceilometerclient import client as ceilometerclient
except ImportError: except ImportError:
ceilometerclient = None ceilometerclient = None
logger.info(_('ceilometerclient not available')) logger.info(_('ceilometerclient not available'))

View File

@ -50,7 +50,7 @@ except ImportError:
logger.info(_('troveclient not available')) logger.info(_('troveclient not available'))
try: try:
from ceilometerclient.v2 import client as ceilometerclient from ceilometerclient import client as ceilometerclient
except ImportError: except ImportError:
ceilometerclient = None ceilometerclient = None
logger.info(_('ceilometerclient not available')) logger.info(_('ceilometerclient not available'))
@ -260,13 +260,13 @@ class OpenStackClients(object):
con = self.context con = self.context
endpoint_type = self._get_client_option('ceilometer', 'endpoint_type') endpoint_type = self._get_client_option('ceilometer', 'endpoint_type')
endpoint = self.url_for(service_type='metering',
endpoint_type=endpoint_type)
args = { args = {
'auth_url': con.auth_url, 'auth_url': con.auth_url,
'service_type': 'metering', 'service_type': 'metering',
'project_id': con.tenant, 'project_id': con.tenant,
'token': lambda: self.auth_token, 'token': lambda: self.auth_token,
'endpoint': self.url_for(service_type='metering',
endpoint_type=endpoint_type),
'endpoint_type': endpoint_type, 'endpoint_type': endpoint_type,
'ca_file': self._get_client_option('ceilometer', 'ca_file'), 'ca_file': self._get_client_option('ceilometer', 'ca_file'),
'cert_file': self._get_client_option('ceilometer', 'cert_file'), 'cert_file': self._get_client_option('ceilometer', 'cert_file'),
@ -274,7 +274,7 @@ class OpenStackClients(object):
'insecure': self._get_client_option('ceilometer', 'insecure') 'insecure': self._get_client_option('ceilometer', 'insecure')
} }
client = ceilometerclient.Client(**args) client = ceilometerclient.Client('2', endpoint, **args)
self._ceilometer = client self._ceilometer = client
return self._ceilometer return self._ceilometer