diff options
Diffstat (limited to 'api/resources/v1/env.py')
-rw-r--r-- | api/resources/v1/env.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/api/resources/v1/env.py b/api/resources/v1/env.py index 47ea91643..7c831fd74 100644 --- a/api/resources/v1/env.py +++ b/api/resources/v1/env.py @@ -101,21 +101,15 @@ class V1Env(ApiResource): def _create_data_source(self, ip): url = 'http://admin:admin@{}:{}/api/datasources'.format(ip, consts.GRAFANA_PORT) - influx_conf = utils.parse_ini_file(consts.CONF_FILE) - - try: - influx_url = influx_conf['dispatcher_influxdb']['target'] - except KeyError: - LOG.exception('influxdb url not set in yardstick.conf') - raise + influx_conf = utils.parse_ini_file(consts.CONF_FILE).get('dispatcher_influxdb', {}) data = { "name": "yardstick", "type": "influxdb", "access": "proxy", - "url": influx_url, - "password": "root", - "user": "root", + "url": influx_conf.get('target', ''), + "password": influx_conf.get('password', ''), + "user": influx_conf.get('username', ''), "database": "yardstick", "basicAuth": True, "basicAuthUser": "admin", @@ -123,7 +117,7 @@ class V1Env(ApiResource): "isDefault": True, } try: - HttpClient().post(url, data) + HttpClient().post(url, data, timeout=10) except Exception: LOG.exception('Create datasources failed') raise |