# -*- coding: utf-8 -*-
from .. import mgr
-from ..exceptions import DashboardException
from ..grafana import GrafanaRestClient, push_local_dashboards
from ..security import Scope
+from ..services.exception import handle_error
from ..settings import Settings
from . import APIDoc, APIRouter, BaseController, Endpoint, EndpointDoc, \
ReadPermission, UpdatePermission
@Endpoint()
@ReadPermission
+ @handle_error('grafana')
def validation(self, params):
grafana = GrafanaRestClient()
method = 'GET'
@Endpoint(method='POST')
@UpdatePermission
+ @handle_error('grafana', 500)
def dashboards(self):
response = dict()
- try:
- response['success'] = push_local_dashboards()
- except Exception as e: # pylint: disable=broad-except
- raise DashboardException(
- msg=str(e),
- component='grafana',
- http_status_code=500,
- )
+ response['success'] = push_local_dashboards()
return response