Check third-party container image metadata.
During the evaluation of a third parties image that doesn't
contain the expected metadata json, the image_uploader section
fails.
This commit adds the check on the returned dict and adds the
ability to use the fallback_tag.
Change-Id: I1809400d798d4350f9642a348ecbe81714e6af47
Closes-Bug: #1834456
(cherry picked from commit 6744027792
)
This commit is contained in:
parent
783a692477
commit
bc54316c2a
|
@ -566,7 +566,10 @@ class BaseImageUploader(object):
|
|||
fallback_tag=None):
|
||||
labels = i.get('Labels', {})
|
||||
|
||||
label_keys = ', '.join(labels.keys())
|
||||
if(hasattr(labels, 'keys')):
|
||||
label_keys = ', '.join(labels.keys())
|
||||
else:
|
||||
label_keys = ""
|
||||
|
||||
if not tag_from_label:
|
||||
raise ImageUploaderException(
|
||||
|
@ -587,7 +590,9 @@ class BaseImageUploader(object):
|
|||
(image, e, label_keys)
|
||||
)
|
||||
else:
|
||||
tag_label = labels.get(tag_from_label)
|
||||
tag_label = None
|
||||
if(isinstance(labels, dict)):
|
||||
tag_label = labels.get(tag_from_label)
|
||||
if tag_label is None:
|
||||
if fallback_tag:
|
||||
tag_label = fallback_tag
|
||||
|
|
Loading…
Reference in New Issue