using python-monascaclient instead of old python-monclient

Change-Id: Ica2ca038cde5020cf64e84bce049b13b0a042633
This commit is contained in:
cindy oneill 2014-07-25 10:49:12 -06:00
parent 1bcf9534d7
commit 13824be8e1
5 changed files with 23 additions and 23 deletions

View File

@ -22,7 +22,7 @@ ADD_JS_FILES = ['monitoring/js/app.js',
'monitoring/js/controllers.js',
'monitoring/js/ng-tags-input.js']
from monclient import exc
from monascaclient import exc
# A dictionary of exception classes to be added to HORIZON['exceptions'].
ADD_EXCEPTIONS = {
'recoverable': (exc.HTTPUnProcessable,),

View File

@ -29,7 +29,7 @@ from horizon import exceptions
from horizon import forms
from horizon import tables
import monclient.exc as exc
import monascaclient.exc as exc
from monitoring.alarms import constants
from monitoring.alarms import forms as alarm_forms
from monitoring.alarms import tables as alarm_tables

View File

@ -15,7 +15,7 @@
import logging
from django.conf import settings # noqa
from monclient import client as mon_client
from monascaclient import client as monasca_client
LOG = logging.getLogger(__name__)
@ -28,13 +28,13 @@ def format_parameters(params):
return parameters
def monclient(request, password=None):
def monascaclient(request, password=None):
api_version = "2_0"
insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None)
endpoint = getattr(settings, 'MONITORING_ENDPOINT',
'http://192.168.10.4:8080/v2.0')
LOG.debug('monclient connection created using token "%s" and url "%s"' %
LOG.debug('monascaclient connection created using token "%s" , url "%s"' %
(request.user.token.id, endpoint))
kwargs = {
'token': request.user.token.id,
@ -47,66 +47,66 @@ def monclient(request, password=None):
# 'cert_file': args.cert_file,
# 'key_file': args.key_file,
}
client = mon_client.Client(api_version, endpoint, **kwargs)
client = monasca_client.Client(api_version, endpoint, **kwargs)
client.format_parameters = format_parameters
return client
def alarm_list(request, marker=None, paginate=False):
return monclient(request).alarms.list()
return monascaclient(request).alarms.list()
def alarm_list_by_service(request, service_name, marker=None, paginate=False):
service_dim = {'service': service_name}
return monclient(request).alarms.list(dimensions=service_dim)
return monascaclient(request).alarms.list(dimensions=service_dim)
def alarm_delete(request, alarm_id):
return monclient(request).alarms.delete(alarm_id=alarm_id)
return monascaclient(request).alarms.delete(alarm_id=alarm_id)
def alarm_history(request, alarm_id):
return monclient(request).alarms.history(alarm_id=alarm_id)
return monascaclient(request).alarms.history(alarm_id=alarm_id)
def alarm_get(request, alarm_id):
return monclient(request).alarms.get(alarm_id=alarm_id)
return monascaclient(request).alarms.get(alarm_id=alarm_id)
def alarm_create(request, password=None, **kwargs):
return monclient(request, password).alarms.create(**kwargs)
return monascaclient(request, password).alarms.create(**kwargs)
def alarm_update(request, **kwargs):
return monclient(request).alarms.update(**kwargs)
return monascaclient(request).alarms.update(**kwargs)
def alarm_patch(request, **kwargs):
return monclient(request).alarms.patch(**kwargs)
return monascaclient(request).alarms.patch(**kwargs)
def notification_list(request, marker=None, paginate=False):
return monclient(request).notifications.list()
return monascaclient(request).notifications.list()
def notification_delete(request, notification_id):
return monclient(request).notifications.delete(
return monascaclient(request).notifications.delete(
notification_id=notification_id)
def notification_get(request, notification_id):
return monclient(request).notifications. \
return monascaclient(request).notifications. \
get(notification_id=notification_id)
def notification_create(request, **kwargs):
return monclient(request).notifications.create(**kwargs)
return monascaclient(request).notifications.create(**kwargs)
def notification_update(request, notification_id, **kwargs):
return monclient(request).notifications. \
return monascaclient(request).notifications. \
update(notification_id=notification_id, **kwargs)
def metrics_list(request, marker=None, paginate=False):
return monclient(request).metrics.list()
return monascaclient(request).metrics.list()

View File

@ -11,13 +11,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from monclient.openstack.common.apiclient import exceptions as monclient
from monascaclient.openstack.common.apiclient import exceptions as monascacli
from openstack_dashboard.test.test_data import exceptions
def data(TEST):
TEST.exceptions = exceptions.data
monitoring_exception = monclient.ClientException
monitoring_exception = monascacli.ClientException
TEST.exceptions.monitoring = exceptions.create_stubbed_exception(
monitoring_exception)

View File

@ -12,4 +12,4 @@ pytz>=2010h
# for SECURE_KEY generation
lockfile>=0.8
python-monclient
python-monascaclient