Third-party container image labels are not processed correctly

Bug #1834456 reported by Francesco Pantano
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
High
Francesco Pantano

Bug Description

During the evaluation of a third parties image that doesn't contain the expected metadata json, the image_uploader section fails with the following stacktrace:

=====
Exception: 'NoneType' object has no attribute 'keys'
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/tripleoclient/v1/tripleo_deploy.py", line 1204, in _standalone_deploy
    parsed_args)
  File "/usr/lib/python2.7/site-packages/tripleoclient/v1/tripleo_deploy.py", line 791, in _deploy_tripleo_heat_templates
    self._prepare_container_images(env, roles_data)
  File "/usr/lib/python2.7/site-packages/tripleoclient/v1/tripleo_deploy.py", line 737, in _prepare_container_images
    env, roles_data, dry_run=True)
  File "/usr/lib/python2.7/site-packages/tripleo_common/image/kolla_builder.py", line 208, in container_images_prepare_multi
    multi_arch=multi_arch
  File "/usr/lib/python2.7/site-packages/tripleo_common/image/kolla_builder.py", line 320, in container_images_prepare
    images, tag_from_label)
  File "/usr/lib/python2.7/site-packages/tripleo_common/image/image_uploader.py", line 636, in discover_image_tags
    discover_args):
  File "/usr/lib/python2.7/site-packages/concurrent/futures/_base.py", line 605, in result_iterator
    yield future.result()
  File "/usr/lib/python2.7/site-packages/concurrent/futures/_base.py", line 429, in result
    return self.__get_result()
  File "/usr/lib/python2.7/site-packages/concurrent/futures/thread.py", line 62, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python2.7/site-packages/tripleo_common/image/image_uploader.py", line 1728, in discover_tag_from_inspect
    i, image, tag_from_label, fallback_tag)
  File "/usr/lib/python2.7/site-packages/tripleo_common/image/image_uploader.py", line 578, in _discover_tag_from_inspect
    label_keys = ', '.join(labels.keys())
AttributeError: 'NoneType' object has no attribute 'keys'
==

An example is the default official grafana-server image that contains the following metadata:

{'Layers': [u'sha256:fc7181108d403205fda45b28dbddfa1cf07e772fa41244e44f53a341b8b1893d', u'sha256:b3698e2f9d08c35a9755f938850f87f1d24ac575706e504c7183b7497ac71
bb9', u'sha256:13ca9094bc721f14f234089d3765ee7c254adb900d5d02f7d1b63353505573f0', u'sha256:8412253947edb3807f9036a9b7f4fb2a58258a131c582ef54c2be48c20c3bdf2',
u'sha256:8efa19c8dbaf01789e1d8b92a3c9775e7bd7a6873add65d8a9a2b13fa93ae7e0', u'sha256:afa031bd3fdb2c528f96ea72f2ce77e59aee53a0a7c64ff94f96d28886ed0b29'], 'Arch
itecture': u'amd64', 'Tag': 'latest', 'DockerVersion': u'18.06.0-ce', 'Name': 'docker.io/grafana/grafana', 'Created': u'2019-06-25T18:27:08.196316679Z', 'Labe
ls': None, 'Os': u'linux', 'Digest': 'sha256:a48dbcdd80f74465d98dbea58911fc450bc76cf2c89a5046b0551f7d260fe88a', 'RepoTags': [u'2.0.1', u'2.0.2', u'2.1.0', u'2
.1.1', u'2.1.3', u'2.5.0', u'2.6.0', u'3.0.0-beta1', u'3.0.0-beta3', u'3.0.0-beta5', u'3.0.0-beta7', u'3.0.1', u'3.0.2', u'3.0.3-1463994644', u'3.0.3', u'3.0.
4', u'3.1.0-beta1', u'3.1.0', u'3.1.1-1470047149', u'3.1.1', u'4.0.0-beta1', u'4.0.0-beta2', u'4.0.0', u'4.0.1-1480694114', u'4.0.1', u'4.0.2-1481203731', u'4
.0.2', u'4.1.0-beta1', u'4.1.0', u'4.1.1-1484211277', u'4.1.1', u'4.1.2', u'4.2.0-beta1', u'4.2.0', u'4.3.0-beta1', u'4.3.0', u'4.3.1', u'4.3.2', u'4.4.0', u'
4.4.1', u'4.4.2', u'4.4.3', u'4.5.0-beta1', u'4.5.0', u'4.5.1', u'4.5.2', u'4.6.0-beta1', u'4.6.0-beta2', u'4.6.0-beta3', u'4.6.0', u'4.6.1', u'4.6.2', u'4.6.
3', u'4.6.4', u'4.6.5', u'5.0.0-beta1', u'5.0.0-beta2', u'5.0.0-beta3', u'5.0.0-beta4', u'5.0.0-beta5', u'5.0.0', u'5.0.1', u'5.0.2', u'5.0.3', u'5.0.4', u'5.
1.0-beta1', u'5.1.0', u'5.1.1', u'5.1.2', u'5.1.3', u'5.1.4', u'5.1.5', u'5.2.0-beta1', u'5.2.0-beta2', u'5.2.0-beta3', u'5.2.0', u'5.2.1', u'5.2.2', u'5.2.3'
, u'5.2.4', u'5.3.0-beta1', u'5.3.0-beta2', u'5.3.0-beta3', u'5.3.0', u'5.3.1', u'5.3.2', u'5.3.3', u'5.3.4', u'5.4.0-beta1', u'5.4.0', u'5.4.1', u'5.4.2', u'
5.4.3', u'5.4.4', u'6.0.0-beta1', u'6.0.0-beta2', u'6.0.0-beta3', u'6.0.0', u'6.0.1', u'6.0.2', u'6.1.0-beta1', u'6.1.0', u'6.1.1', u'6.1.2', u'6.1.3', u'6.1.
4', u'6.1.6', u'6.2.0-beta1', u'6.2.0-beta2', u'6.2.0', u'6.2.1', u'6.2.2', u'6.2.4', u'6.2.5', u'develop', u'latest', u'master']}
docker.io/grafana/grafana

In this cases as the Labels has a value (None), we want to use the provided fallback tag, avoiding the whole flow to fail.

Changed in tripleo:
assignee: nobody → Francesco Pantano (fmount)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-common (master)

Fix proposed to branch: master
Review: https://review.opendev.org/667837

Changed in tripleo:
status: New → In Progress
Changed in tripleo:
importance: Undecided → High
milestone: none → train-2
tags: added: stein-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-common (master)

Reviewed: https://review.opendev.org/667837
Committed: https://git.openstack.org/cgit/openstack/tripleo-common/commit/?id=67440277926e73ea0f8f913170c0013b068a99e6
Submitter: Zuul
Branch: master

commit 67440277926e73ea0f8f913170c0013b068a99e6
Author: fpantano <email address hidden>
Date: Thu Jun 27 12:17:43 2019 +0200

    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

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-common (stable/stein)

Fix proposed to branch: stable/stein
Review: https://review.opendev.org/668511

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-common (stable/stein)

Reviewed: https://review.opendev.org/668511
Committed: https://git.openstack.org/cgit/openstack/tripleo-common/commit/?id=bc54316c2a68b980ce795f30b81ebb1cc044e9be
Submitter: Zuul
Branch: stable/stein

commit bc54316c2a68b980ce795f30b81ebb1cc044e9be
Author: fpantano <email address hidden>
Date: Thu Jun 27 12:17:43 2019 +0200

    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 67440277926e73ea0f8f913170c0013b068a99e6)

tags: added: in-stable-stein
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-common 11.1.0

This issue was fixed in the openstack/tripleo-common 11.1.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-common 10.8.1

This issue was fixed in the openstack/tripleo-common 10.8.1 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.