From 48eac8b89967ddde5c389cf57355304f84d1a7de Mon Sep 17 00:00:00 2001 From: Noam Angel Date: Wed, 12 Feb 2020 09:00:44 +0000 Subject: [PATCH] fix iscsi-boot element exiting build even if dracut-regenerate used in CentOS build case building an image with "iscsi-boot" and "dracut-regenerate" will exit building because of statement "[ "$found" = 0 ]" Change-Id: I1a6d60e9ec5f5cb508866c8376465c3e73551a30 --- .../iscsi-boot/extra-data.d/50-check-dracut-regenerate | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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 index a079c81e7..4b7c76452 100755 --- 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 @@ -8,10 +8,8 @@ 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 - + if [[ ! "${image_elements[@]}" =~ "dracut-regenerate" ]]; then + echo "The dracut-regenerate element is required!" + exit 1 + fi fi