X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=api%2Fresources%2Fv1%2Fenv.py;h=47ea9164324132774660575c93afb0d5418f8e60;hb=109423bc807b794dd9fe8b17d9c1fa37f471afcc;hp=8943db3d1064f9ee6a52f96c5871a299613fb78f;hpb=d184d8714e543e4f2497db682154820f7eecf1de;p=yardstick.git diff --git a/api/resources/v1/env.py b/api/resources/v1/env.py index 8943db3d1..47ea91643 100644 --- a/api/resources/v1/env.py +++ b/api/resources/v1/env.py @@ -31,7 +31,7 @@ from yardstick.common import utils from yardstick.common.utils import result_handler from yardstick.common import openstack_utils from yardstick.common.httpClient import HttpClient - +from yardstick.common.yaml_loader import yaml_load LOG = logging.getLogger(__name__) LOG.setLevel(logging.DEBUG) @@ -88,13 +88,13 @@ class V1Env(ApiResource): def _create_dashboard(self, ip): url = 'http://admin:admin@{}:{}/api/dashboards/db'.format(ip, consts.GRAFANA_PORT) - path = os.path.join(consts.REPOS_DIR, 'dashboard', '*dashboard.json') + path = os.path.join(consts.REPOS_DIR, 'dashboard', 'opnfv_yardstick_tc*.json') for i in sorted(glob.iglob(path)): with open(i) as f: data = jsonutils.load(f) try: - HttpClient().post(url, data) + HttpClient().post(url, {"dashboard": data}) except Exception: LOG.exception('Create dashboard %s failed', i) raise @@ -120,7 +120,7 @@ class V1Env(ApiResource): "basicAuth": True, "basicAuthUser": "admin", "basicAuthPassword": "admin", - "isDefault": False, + "isDefault": True, } try: HttpClient().post(url, data) @@ -393,7 +393,7 @@ class V1Env(ApiResource): return result_handler(consts.API_ERROR, 'file must be provided') LOG.info('Checking file') - data = yaml.load(pod_file.read()) + data = yaml_load(pod_file.read()) if not isinstance(data, collections.Mapping): return result_handler(consts.API_ERROR, 'invalid yaml file')