From d2aaa5529c1870eb2f823bfdffdece0ad0248bbe Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Mon, 18 Mar 2019 14:20:55 -0700 Subject: [PATCH] Handle no metadata in zuul artifact items When pulling from intermediate registries we check zuul for artifacts of a certain type. Unfortunately we do so blindly without checking that the metadata field exists for the artifact. These leads to errors like: "msg": "The conditional check 'item.metadata.type | default('') == 'container_image'' failed. The error was: error while evaluating conditional (item.metadata.type | default('') == 'container_image'): 'dict object' has no attribute 'metadata' http://logs.openstack.org/12/643712/1/gate/opendev-buildset-registry/1016e6e/job-output.txt.gz#_2019-03-18_19_28_39_060210 Address this by checking the metadata field prior to accessing it. Change-Id: I02bbeddccdda836fc313eccce09e4cb0beb6262a --- roles/pull-from-intermediate-registry/tasks/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/pull-from-intermediate-registry/tasks/main.yaml b/roles/pull-from-intermediate-registry/tasks/main.yaml index c143b1a06..2dc4334cb 100644 --- a/roles/pull-from-intermediate-registry/tasks/main.yaml +++ b/roles/pull-from-intermediate-registry/tasks/main.yaml @@ -63,7 +63,7 @@ skopeo --insecure-policy copy {{ item.url }} docker://{{ buildset_registry.host }}:{{ buildset_registry.port }}/{{ item.metadata.repository }}:{{ item.metadata.tag }} - when: "item.metadata.type | default('') == 'container_image'" + when: "metadata in item and item.metadata.type | default('') == 'container_image'" loop: "{{ zuul.artifacts | default([]) }}" always: - name: Remove docker user config