diff options
author | Jose Lausuch <jose.lausuch@ericsson.com> | 2016-10-18 14:14:02 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2016-10-18 14:14:02 +0000 |
commit | 2e33555126ca31778fd1d5df6fa1b10052692d89 (patch) | |
tree | 1489aea7067cb6412898ca4a67d89828f5c992ea /utils/test/dashboard | |
parent | d30f7afdd2d39302174a788e9e008feb61b25596 (diff) | |
parent | ea4bc2d21e08d678eba855f1d3f516d2fa58f299 (diff) |
Merge "make elastic index configurable rather than settled in code"
Diffstat (limited to 'utils/test/dashboard')
-rw-r--r-- | utils/test/dashboard/dashboard/conf/config.py | 6 | ||||
-rw-r--r-- | utils/test/dashboard/dashboard/elastic2kibana/main.py | 8 | ||||
-rw-r--r-- | utils/test/dashboard/dashboard/mongo2elastic/main.py | 13 | ||||
-rw-r--r-- | utils/test/dashboard/etc/config.ini | 1 |
4 files changed, 14 insertions, 14 deletions
diff --git a/utils/test/dashboard/dashboard/conf/config.py b/utils/test/dashboard/dashboard/conf/config.py index 44cf7970f..6114e90a9 100644 --- a/utils/test/dashboard/dashboard/conf/config.py +++ b/utils/test/dashboard/dashboard/conf/config.py @@ -1,5 +1,6 @@ #! /usr/bin/env python +import urlparse from ConfigParser import SafeConfigParser, NoOptionError @@ -27,6 +28,7 @@ class APIConfig: self.es_creds = None self.kibana_url = None self.js_path = None + self.index_url = None def _get_str_parameter(self, section, param): try: @@ -67,6 +69,8 @@ class APIConfig: obj.es_creds = obj._get_str_parameter("elastic", "creds") obj.kibana_url = obj._get_str_parameter("kibana", "url") obj.js_path = obj._get_str_parameter("kibana", "js_path") + index = obj._get_str_parameter("elastic", "index") + obj.index_url = urlparse.urljoin(obj.es_url, index) return obj @@ -74,7 +78,9 @@ class APIConfig: return "elastic_url = %s \n" \ "elastic_creds = %s \n" \ "kibana_url = %s \n" \ + "index_url = %s \n" \ "js_path = %s \n" % (self.es_url, self.es_creds, self.kibana_url, + self.index_url, self.js_path) diff --git a/utils/test/dashboard/dashboard/elastic2kibana/main.py b/utils/test/dashboard/dashboard/elastic2kibana/main.py index 5af512e2f..112d2226e 100644 --- a/utils/test/dashboard/dashboard/elastic2kibana/main.py +++ b/utils/test/dashboard/dashboard/elastic2kibana/main.py @@ -1,6 +1,5 @@ #! /usr/bin/env python import json -import urlparse import argparse @@ -131,10 +130,9 @@ class KibanaConstructor(object): } }) - elastic_data = elastic_access.get_docs( - urlparse.urljoin(CONF.es_url, '/testapi/results'), - CONF.es_creds, - query) + elastic_data = elastic_access.get_docs(CONF.index_url, + CONF.es_creds, + query) pods_and_scenarios = {} diff --git a/utils/test/dashboard/dashboard/mongo2elastic/main.py b/utils/test/dashboard/dashboard/mongo2elastic/main.py index c2a8d1149..688f55f7d 100644 --- a/utils/test/dashboard/dashboard/mongo2elastic/main.py +++ b/utils/test/dashboard/dashboard/mongo2elastic/main.py @@ -5,7 +5,6 @@ import json import os import subprocess import traceback -import urlparse import uuid import argparse @@ -188,7 +187,7 @@ class DocumentsPublisher(object): self._remove() exit(-1) - def get_existed_docs(self): + def get_exists(self): if self.days == 0: body = '''{{ "query": {{ @@ -242,10 +241,6 @@ class DocumentsPublisher(object): def main(): - base_elastic_url = urlparse.urljoin(CONF.es_url, '/testapi/results') - days = args.latest_days - es_creds = CONF.es_creds - for project, case_dicts in testcases.testcases_yaml.items(): for case_dict in case_dicts: case = case_dict.get('name') @@ -253,6 +248,6 @@ def main(): DocumentsPublisher(project, case, fmt, - days, - base_elastic_url, - es_creds).export().get_existed_docs().publish() + args.latest_days, + CONF.index_url, + CONF.es_creds).export().get_exists().publish() diff --git a/utils/test/dashboard/etc/config.ini b/utils/test/dashboard/etc/config.ini index d9327981e..77adc1687 100644 --- a/utils/test/dashboard/etc/config.ini +++ b/utils/test/dashboard/etc/config.ini @@ -2,6 +2,7 @@ # the CONF object in config.ini must be updated [elastic] url = http://localhost:9200 +index = testapi/results creds = [kibana] |