Commit 396da0d5 authored by Matthias's avatar Matthias
Browse files

improve logging

parent 32efc562
......@@ -119,14 +119,19 @@ def write_results(job_drupal_uuid, job_log_drupal_uuid, status, report):
getUrl = current_app.config['drupal-api-url'] + \
'/jsonapi/node/log_result/' + job_log_drupal_uuid
response = requests.get(getUrl, headers=headers, auth=auth)
logResult = response.json()['data']
previous_status = logResult['attributes']['field_status']
previous_report = logResult['attributes']['field_message']
try:
logResult = response.json()['data']
previous_status = logResult['attributes']['field_status']
previous_report = logResult['attributes']['field_message']
except Exception:
msg = 'could not parse response from ' + getUrl
current_app.logger.error(msg)
except requests.exceptions.RequestException:
message = 'It was not possible to read form the Drupal API:' + getUrl +\
'\nresponse: ' + response
current_app.logger.error(message)
raise ImportApiError(message)
if previous_status == 'FAILED':
status = previous_status
if previous_report is None or previous_report == 'null':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment