summaryrefslogtreecommitdiffstats
path: root/dashboard
diff options
context:
space:
mode:
authorzhifeng.jiang <jiang.zhifeng@zte.com.cn>2016-06-02 22:02:54 +0800
committerzhifeng.jiang <jiang.zhifeng@zte.com.cn>2016-06-02 22:02:54 +0800
commit957760c441002f7c7334171d1f9200107e03c651 (patch)
tree751ee5d0e152dd7071d26f0d1e39b797a61d287c /dashboard
parent96d4ad4d06d5e7f37057473843d5ce91a48d7778 (diff)
dos2Unix the pushtoDb.py file.
Change-Id: I507822e4ea02a4e5fecc7242482b76d9412eede4 Signed-off-by: zhifeng.jiang <jiang.zhifeng@zte.com.cn>
Diffstat (limited to 'dashboard')
-rw-r--r--dashboard/pushtoDB.py114
1 files changed, 57 insertions, 57 deletions
diff --git a/dashboard/pushtoDB.py b/dashboard/pushtoDB.py
index 750ec039..d86fbeee 100644
--- a/dashboard/pushtoDB.py
+++ b/dashboard/pushtoDB.py
@@ -1,57 +1,57 @@
-import requests
-import json
-import datetime
-import os
-TEST_DB = 'http://testresults.opnfv.org/testapi'
-
-suite_list = [('compute_result.json', 'compute_test_suite'),('network_result.json', 'network_test_suite'),('storage_result.json', 'storage_test_suite')]
-payload_list = { }
-
-def push_results_to_db(db_url, case_name, payload,logger=None, pod_name="dell-us-testing-bm-1"):
-
- url = db_url + "/results"
- creation_date= str(datetime.datetime.utcnow().isoformat())
- installer = os.environ['INSTALLER_TYPE']
- pod_name = os.environ['NODE_NAME']
-
- params = {"project_name": "qtip", "case_name": case_name,
- "pod_name": pod_name, "installer": installer, "creation_date": creation_date,
- "version": "test" , "details": payload}
-
- headers = {'Content-Type': 'application/json'}
- print pod_name
- print installer
- print creation_date
-
- try:
- r = requests.post(url, data=json.dumps(params), headers=headers)
- print r
- return True
- except:
- print "Error:", sys.exc_info()[0]
- return False
-
-def populate_payload(suite_list):
-
- global payload_list
- for k,v in suite_list:
-
- if os.path.isfile('results/'+str(k)):
- payload_list[k]=v
-
-def main():
-
- global payload_list
- populate_payload(suite_list)
- if payload_list:
- print payload_list
- for suite,case in payload_list.items():
- with open('results/'+suite,'r') as result_file:
- j=json.load(result_file)
- push_results_to_db(TEST_DB, case , j)
- elif not payload_list:
- print 'Results not found'
-
-
-if __name__ == "__main__":
- main()
+import requests
+import json
+import datetime
+import os
+TEST_DB = 'http://testresults.opnfv.org/testapi'
+
+suite_list = [('compute_result.json', 'compute_test_suite'),('network_result.json', 'network_test_suite'),('storage_result.json', 'storage_test_suite')]
+payload_list = { }
+
+def push_results_to_db(db_url, case_name, payload,logger=None, pod_name="dell-us-testing-bm-1"):
+
+ url = db_url + "/results"
+ creation_date= str(datetime.datetime.utcnow().isoformat())
+ installer = os.environ['INSTALLER_TYPE']
+ pod_name = os.environ['NODE_NAME']
+
+ params = {"project_name": "qtip", "case_name": case_name,
+ "pod_name": pod_name, "installer": installer, "creation_date": creation_date,
+ "version": "test" , "details": payload}
+
+ headers = {'Content-Type': 'application/json'}
+ print pod_name
+ print installer
+ print creation_date
+
+ try:
+ r = requests.post(url, data=json.dumps(params), headers=headers)
+ print r
+ return True
+ except:
+ print "Error:", sys.exc_info()[0]
+ return False
+
+def populate_payload(suite_list):
+
+ global payload_list
+ for k,v in suite_list:
+
+ if os.path.isfile('results/'+str(k)):
+ payload_list[k]=v
+
+def main():
+
+ global payload_list
+ populate_payload(suite_list)
+ if payload_list:
+ print payload_list
+ for suite,case in payload_list.items():
+ with open('results/'+suite,'r') as result_file:
+ j=json.load(result_file)
+ push_results_to_db(TEST_DB, case , j)
+ elif not payload_list:
+ print 'Results not found'
+
+
+if __name__ == "__main__":
+ main()