From: Zack Cerza Date: Mon, 30 Dec 2013 22:20:52 +0000 (-0600) Subject: Set the content-type in report_job() X-Git-Tag: 1.1.0~1713 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=56c70e1145cd9e6f934a7aa54add4926dbe996c7;p=teuthology.git Set the content-type in report_job() --- diff --git a/teuthology/report.py b/teuthology/report.py index 8f6c6364a..24eee7f1a 100644 --- a/teuthology/report.py +++ b/teuthology/report.py @@ -236,12 +236,15 @@ class ResultsReporter(object): :param job_info: The job's info dict. Optional - if not present, we look at the archive. """ + if job_info is not None and not isinstance(job_info, dict): + raise TypeError("job_info must be a dict") run_uri = "{base}/runs/{name}/jobs/".format( base=self.base_uri, name=run_name,) if job_info is None: job_info = self.serializer.job_info(run_name, job_id) job_json = json.dumps(job_info) - response = requests.post(run_uri, job_json) + headers = {'content-type': 'application/json'} + response = requests.post(run_uri, data=job_json, headers=headers) if response.status_code == 200: return job_id @@ -249,7 +252,7 @@ class ResultsReporter(object): msg = response.json.get('message', '') if msg and msg.endswith('already exists'): job_uri = os.path.join(run_uri, job_id, '') - response = requests.put(job_uri, job_json) + response = requests.put(job_uri, data=job_json, headers=headers) elif msg: log.error( "POST to {uri} failed with status {status}: {msg}".format(