Fix py37 test error
Change-Id: I134d1365a93b1a281583e2b04b5d65ec9dd0d463
This commit is contained in:
parent
219e07f520
commit
a705874124
|
@ -13,6 +13,7 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import requests
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
import httplib2
|
import httplib2
|
||||||
|
@ -74,18 +75,12 @@ def send_status(test_result, status_url, repo_token, pending=False):
|
||||||
'description': 'Solum says: Tests failed',
|
'description': 'Solum says: Tests failed',
|
||||||
'target_url': log_url}
|
'target_url': log_url}
|
||||||
|
|
||||||
try:
|
resp = requests.post(status_url, headers=headers,
|
||||||
conn = get_http_connection()
|
data=json.dumps(data))
|
||||||
resp, _ = conn.request(status_url, 'POST', headers=headers,
|
if resp.status_code != '201':
|
||||||
body=json.dumps(data))
|
LOG.debug("Failed to send back status. Error code %s,"
|
||||||
if resp['status'] != '201':
|
"status_url %s, repo_token %s" %
|
||||||
LOG.debug("Failed to send back status. Error code %s,"
|
(resp.status_code, status_url, repo_token))
|
||||||
"status_url %s, repo_token %s" %
|
|
||||||
(resp['status'], status_url, repo_token))
|
|
||||||
except (httplib2.HttpLib2Error, socket.error) as ex:
|
|
||||||
LOG.warning(
|
|
||||||
"Error in sending status, status url: %s, repo token: %s,"
|
|
||||||
" error: %s" % (status_url, repo_token, ex))
|
|
||||||
else:
|
else:
|
||||||
LOG.debug("No url or token available to send back status")
|
LOG.debug("No url or token available to send back status")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue