Use jinja for image build conditionals

This change converts a bash if/elif/else to jinja, since the variable
used in the expression comes from ansible.

The rendered bash should be as clean and understandable as possible,
inserting jinja variables into bash expressions doesn't help in this
case.

Change-Id: Iccd58eea9fa2d5538b6ac45a9dc92d82d725edd1
Blueprint: whole-disk-default
This commit is contained in:
Steve Baker 2021-08-24 14:00:50 +12:00
parent 9d1f1faabc
commit 1bf01e4e0d
1 changed files with 13 additions and 13 deletions

View File

@ -20,19 +20,19 @@ export ELEMENTS_PATH=$ELEMENTS
{% endif %}
# the tripleo_image_type is set and passed from the ci job definition
if [ "{{ tripleo_image_type }}" == "overcloud-hardened-uefi-full" ]; then
CONFIG_FILES="--config-file \
{{ tripleo_common_path }}/image-yaml/overcloud-hardened-images-uefi-python3.yaml \
--config-file {{ tripleo_common_path }}/image-yaml/overcloud-hardened-images-uefi-{{ tripleo_image_os }}.yaml"
elif [ "{{ tripleo_image_type }}" == "overcloud-hardened-full" ]; then
CONFIG_FILES="--config-file \
{{ tripleo_common_path }}/image-yaml/{{ hardened_image_config[python_v] }} \
--config-file {{ tripleo_common_path }}/image-yaml/overcloud-hardened-images-{{ tripleo_image_os }}.yaml"
else
CONFIG_FILES="--config-file \
{{ tripleo_common_path }}/image-yaml/{{ base_image_config[python_v] }} \
--config-file {{ tripleo_common_path }}/image-yaml/overcloud-images-{{ tripleo_image_os }}.yaml"
fi
{% if tripleo_image_type == "overcloud-hardened-uefi-full" %}
CONFIG_FILES="--config-file \
{{ tripleo_common_path }}/image-yaml/overcloud-hardened-images-uefi-python3.yaml \
--config-file {{ tripleo_common_path }}/image-yaml/overcloud-hardened-images-uefi-{{ tripleo_image_os }}.yaml"
{% elif tripleo_image_type == "overcloud-hardened-full" %}
CONFIG_FILES="--config-file \
{{ tripleo_common_path }}/image-yaml/{{ hardened_image_config[python_v] }} \
--config-file {{ tripleo_common_path }}/image-yaml/overcloud-hardened-images-{{ tripleo_image_os }}.yaml"
{% else %}
CONFIG_FILES="--config-file \
{{ tripleo_common_path }}/image-yaml/{{ base_image_config[python_v] }} \
--config-file {{ tripleo_common_path }}/image-yaml/overcloud-images-{{ tripleo_image_os }}.yaml"
{% endif %}
{% if dib_local_image is defined %}