From 853e13c6c3aa1930bc5847b72fdb6b400a328481 Mon Sep 17 00:00:00 2001 From: Yolanda Robla Date: Wed, 2 Jan 2019 11:05:00 +0100 Subject: [PATCH] Change phase to check for dracut-regenerate in iscsi-boot There is an use of get_image_element_array on the environment.d phase, for the iscsi-boot element. This function is not available on that step. So moving the check at next step, extra-data-d, where it is available. Change-Id: I89cfe565492142c2f7962109360fcbcebadfd469 --- .../iscsi-boot/environment.d/open-iscsi-config | 6 ------ .../extra-data.d/50-check-dracut-regenerate | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) create mode 100755 diskimage_builder/elements/iscsi-boot/extra-data.d/50-check-dracut-regenerate diff --git a/diskimage_builder/elements/iscsi-boot/environment.d/open-iscsi-config b/diskimage_builder/elements/iscsi-boot/environment.d/open-iscsi-config index 52b815c4..3036fd8e 100644 --- a/diskimage_builder/elements/iscsi-boot/environment.d/open-iscsi-config +++ b/diskimage_builder/elements/iscsi-boot/environment.d/open-iscsi-config @@ -1,10 +1,4 @@ if [[ $DISTRO_NAME = "centos7" ]]; then - eval declare -A image_elements=($(get_image_element_array)) - found=0 - for i in "${!image_elements[@]}"; do - [ "$i" = "dracut-regenerate" ] && found=1 - done - [ "$found" = 0 ] && echo "The dracut-regenerate element is required!" && exit 1 DIB_DRACUT_ENABLED_MODULES+=" - name: network diff --git a/diskimage_builder/elements/iscsi-boot/extra-data.d/50-check-dracut-regenerate b/diskimage_builder/elements/iscsi-boot/extra-data.d/50-check-dracut-regenerate new file mode 100755 index 00000000..a079c81e --- /dev/null +++ b/diskimage_builder/elements/iscsi-boot/extra-data.d/50-check-dracut-regenerate @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +if [[ $DISTRO_NAME = "centos7" ]]; then + eval declare -A image_elements=($(get_image_element_array)) + found=0 + for i in "${!image_elements[@]}"; do + [ "$i" = "dracut-regenerate" ] && found=1 + done + [ "$found" = 0 ] && echo "The dracut-regenerate element is required!" && exit 1 + +fi