From a27638161f4e163b794de965c599c0b7254152b8 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Fri, 17 Feb 2017 15:26:43 +0000 Subject: [PATCH] Fix image creation when dib_os_release not defined If using Bifrost to build images via diskimage-builder, the dib_os_release variable can be used to specify the DIB_RELEASE environment variable. However, if the dib_os_release variable is unset, image creation will fail. This change sets the dib_env_vars_final variable unconditionally to ensure that it is always defined when accessed. Change-Id: If32b2ebc13fe521e986ed6593fd3a8b99ec90567 Closes-Bug: #1665671 --- playbooks/roles/bifrost-create-dib-image/tasks/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/playbooks/roles/bifrost-create-dib-image/tasks/main.yml b/playbooks/roles/bifrost-create-dib-image/tasks/main.yml index 2e21cfc5f..699701592 100644 --- a/playbooks/roles/bifrost-create-dib-image/tasks/main.yml +++ b/playbooks/roles/bifrost-create-dib-image/tasks/main.yml @@ -108,9 +108,12 @@ set_fact: dib_os_release: "jessie" when: dib_os_element == "debian" and dib_os_release is undefined +- name: "Initialize the DIB environment variables fact" + set_fact: + dib_env_vars_final: "{{dib_env_vars}}" - name: "Set the DIB_RELEASE environment variable if set" set_fact: - dib_env_vars_final: "{{dib_env_vars | combine({'DIB_RELEASE':dib_os_release}) }}" + dib_env_vars_final: "{{dib_env_vars_final | combine({'DIB_RELEASE':dib_os_release}) }}" when: dib_os_release is defined - name: "Build argument list" set_fact: