summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny L <el247k@att.com>2018-10-31 14:39:47 -0700
committerEvgeny L <el247k@att.com>2018-11-01 13:45:04 +0000
commitec8bad3bf4f6e34c703ad429fb6b670b80ac02fb (patch)
treefde8cbd0fb4c7f3231e1d8469665884bc03d0a26
parent265a5bf18fee52c0ae25bf70cea3049114ef3505 (diff)
Fix logging when "Duplicate document exists" error occurs
Currently validation fails with "KeyError: 'schema'", which makes it hard to determine a root cause of error. Change-Id: Ifd40faf485578cc0a133e17650f8df6758a6c8ae
Notes
Notes (review): Code-Review+2: Felipe Monteiro <felipe.monteiro@att.com> Code-Review+1: Andrey Volkov <av903u@att.com> Code-Review+1: Vladyslav Drok <vdrok@mirantis.com> Code-Review+2: Bryan Strassner <bryan.strassner@gmail.com> Workflow+1: Bryan Strassner <bryan.strassner@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 06 Nov 2018 15:51:50 +0000 Reviewed-on: https://review.openstack.org/614641 Project: openstack/airship-deckhand Branch: refs/heads/master
-rw-r--r--deckhand/engine/layering.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/deckhand/engine/layering.py b/deckhand/engine/layering.py
index d2719cb..d2d199a 100644
--- a/deckhand/engine/layering.py
+++ b/deckhand/engine/layering.py
@@ -329,17 +329,18 @@ class DocumentLayering(object):
329 error_list = [] 329 error_list = []
330 for result in results: 330 for result in results:
331 for e in result['errors']: 331 for e in result['errors']:
332 LOG.error('Document [%s, %s] %s failed with pre-validation ' 332 for d in e['documents']:
333 'error: %s.', e['schema'], e['layer'], e['name'], 333 LOG.error('Document [%s, %s] %s failed with '
334 e['message']) 334 'pre-validation error: "%s". Diagnostic: "%s".',
335 error_list.append( 335 d['schema'], d['layer'], d['name'],
336 ValidationMessage( 336 e['message'], e['diagnostic'])
337 message=e['message'], 337
338 doc_schema=e['schema'], 338 error_list.append(
339 doc_name=e['name'], 339 ValidationMessage(
340 doc_layer=e['layer'] 340 message=e['message'],
341 ) 341 doc_schema=d['schema'],
342 ) 342 doc_name=d['name'],
343 doc_layer=d['layer']))
343 344
344 if error_list: 345 if error_list:
345 raise errors.InvalidDocumentFormat(error_list=error_list) 346 raise errors.InvalidDocumentFormat(error_list=error_list)