aboutsummaryrefslogtreecommitdiffstats
path: root/data/pushtoDB.py
blob: fab785206d5988395f51a0684258248dc054c96e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import requests
import json
import os
TEST_DB = 'http://213.77.62.197'



def push_results_to_db(db_url=TEST_DB, case_name, logger=None, pod_name='dell-us-testing-bm-1', payload):
    url = db_url + "/results"
    installer = get_installer_type(logger)
    params = {"project_name": "functest", "case_name": case_name,
              "pod_name": os.environ[''], "installer": installer,
              "version": git_version, "details": payload}

    headers = {'Content-Type': 'application/json'}
    try:
        r = requests.post(url, data=json.dumps(params), headers=headers)
        logger.debug(r)
        return True
    except:
        print "Error:", sys.exc_info()[0]
        return False