using python-monascaclient instead of old python-monclient
Change-Id: Ica2ca038cde5020cf64e84bce049b13b0a042633
This commit is contained in:
parent
1bcf9534d7
commit
13824be8e1
@ -22,7 +22,7 @@ ADD_JS_FILES = ['monitoring/js/app.js',
|
|||||||
'monitoring/js/controllers.js',
|
'monitoring/js/controllers.js',
|
||||||
'monitoring/js/ng-tags-input.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'].
|
# A dictionary of exception classes to be added to HORIZON['exceptions'].
|
||||||
ADD_EXCEPTIONS = {
|
ADD_EXCEPTIONS = {
|
||||||
'recoverable': (exc.HTTPUnProcessable,),
|
'recoverable': (exc.HTTPUnProcessable,),
|
||||||
|
@ -29,7 +29,7 @@ from horizon import exceptions
|
|||||||
from horizon import forms
|
from horizon import forms
|
||||||
from horizon import tables
|
from horizon import tables
|
||||||
|
|
||||||
import monclient.exc as exc
|
import monascaclient.exc as exc
|
||||||
from monitoring.alarms import constants
|
from monitoring.alarms import constants
|
||||||
from monitoring.alarms import forms as alarm_forms
|
from monitoring.alarms import forms as alarm_forms
|
||||||
from monitoring.alarms import tables as alarm_tables
|
from monitoring.alarms import tables as alarm_tables
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from django.conf import settings # noqa
|
from django.conf import settings # noqa
|
||||||
from monclient import client as mon_client
|
from monascaclient import client as monasca_client
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -28,13 +28,13 @@ def format_parameters(params):
|
|||||||
return parameters
|
return parameters
|
||||||
|
|
||||||
|
|
||||||
def monclient(request, password=None):
|
def monascaclient(request, password=None):
|
||||||
api_version = "2_0"
|
api_version = "2_0"
|
||||||
insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
|
insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
|
||||||
cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None)
|
cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None)
|
||||||
endpoint = getattr(settings, 'MONITORING_ENDPOINT',
|
endpoint = getattr(settings, 'MONITORING_ENDPOINT',
|
||||||
'http://192.168.10.4:8080/v2.0')
|
'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))
|
(request.user.token.id, endpoint))
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'token': request.user.token.id,
|
'token': request.user.token.id,
|
||||||
@ -47,66 +47,66 @@ def monclient(request, password=None):
|
|||||||
# 'cert_file': args.cert_file,
|
# 'cert_file': args.cert_file,
|
||||||
# 'key_file': args.key_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
|
client.format_parameters = format_parameters
|
||||||
return client
|
return client
|
||||||
|
|
||||||
|
|
||||||
def alarm_list(request, marker=None, paginate=False):
|
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):
|
def alarm_list_by_service(request, service_name, marker=None, paginate=False):
|
||||||
service_dim = {'service': service_name}
|
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):
|
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):
|
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):
|
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):
|
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):
|
def alarm_update(request, **kwargs):
|
||||||
return monclient(request).alarms.update(**kwargs)
|
return monascaclient(request).alarms.update(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
def alarm_patch(request, **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):
|
def notification_list(request, marker=None, paginate=False):
|
||||||
return monclient(request).notifications.list()
|
return monascaclient(request).notifications.list()
|
||||||
|
|
||||||
|
|
||||||
def notification_delete(request, notification_id):
|
def notification_delete(request, notification_id):
|
||||||
return monclient(request).notifications.delete(
|
return monascaclient(request).notifications.delete(
|
||||||
notification_id=notification_id)
|
notification_id=notification_id)
|
||||||
|
|
||||||
|
|
||||||
def notification_get(request, notification_id):
|
def notification_get(request, notification_id):
|
||||||
return monclient(request).notifications. \
|
return monascaclient(request).notifications. \
|
||||||
get(notification_id=notification_id)
|
get(notification_id=notification_id)
|
||||||
|
|
||||||
|
|
||||||
def notification_create(request, **kwargs):
|
def notification_create(request, **kwargs):
|
||||||
return monclient(request).notifications.create(**kwargs)
|
return monascaclient(request).notifications.create(**kwargs)
|
||||||
|
|
||||||
|
|
||||||
def notification_update(request, notification_id, **kwargs):
|
def notification_update(request, notification_id, **kwargs):
|
||||||
return monclient(request).notifications. \
|
return monascaclient(request).notifications. \
|
||||||
update(notification_id=notification_id, **kwargs)
|
update(notification_id=notification_id, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def metrics_list(request, marker=None, paginate=False):
|
def metrics_list(request, marker=None, paginate=False):
|
||||||
return monclient(request).metrics.list()
|
return monascaclient(request).metrics.list()
|
||||||
|
@ -11,13 +11,13 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# 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
|
from openstack_dashboard.test.test_data import exceptions
|
||||||
|
|
||||||
|
|
||||||
def data(TEST):
|
def data(TEST):
|
||||||
TEST.exceptions = exceptions.data
|
TEST.exceptions = exceptions.data
|
||||||
|
|
||||||
monitoring_exception = monclient.ClientException
|
monitoring_exception = monascacli.ClientException
|
||||||
TEST.exceptions.monitoring = exceptions.create_stubbed_exception(
|
TEST.exceptions.monitoring = exceptions.create_stubbed_exception(
|
||||||
monitoring_exception)
|
monitoring_exception)
|
||||||
|
@ -12,4 +12,4 @@ pytz>=2010h
|
|||||||
# for SECURE_KEY generation
|
# for SECURE_KEY generation
|
||||||
lockfile>=0.8
|
lockfile>=0.8
|
||||||
|
|
||||||
python-monclient
|
python-monascaclient
|
||||||
|
Loading…
x
Reference in New Issue
Block a user