Commit 55628b4c authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Merge branch 'master' of gitlab.switch.ch:memoriav/memobase-2020/services/import-process/import-api

parents 1424b5b7 2481172d
Pipeline #26230 passed with stages
in 1 minute and 59 seconds
......@@ -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