summaryrefslogtreecommitdiffstats
path: root/dashboard
diff options
context:
space:
mode:
Diffstat (limited to 'dashboard')
-rw-r--r--dashboard/dashboard/conf/config.py6
-rw-r--r--dashboard/dashboard/elastic2kibana/main.py8
-rw-r--r--dashboard/dashboard/mongo2elastic/main.py13
-rw-r--r--dashboard/etc/config.ini1
4 files changed, 14 insertions, 14 deletions
diff --git a/dashboard/dashboard/conf/config.py b/dashboard/dashboard/conf/config.py
index 44cf797..6114e90 100644
--- a/dashboard/dashboard/conf/config.py
+++ b/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/dashboard/dashboard/elastic2kibana/main.py b/dashboard/dashboard/elastic2kibana/main.py
index 5af512e..112d222 100644
--- a/dashboard/dashboard/elastic2kibana/main.py
+++ b/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/dashboard/dashboard/mongo2elastic/main.py b/dashboard/dashboard/mongo2elastic/main.py
index c2a8d11..688f55f 100644
--- a/dashboard/dashboard/mongo2elastic/main.py
+++ b/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/dashboard/etc/config.ini b/dashboard/etc/config.ini
index d932798..77adc16 100644
--- a/dashboard/etc/config.ini
+++ b/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]