Skip to content

Commit 79bfe2f

Browse files
committed
Switched to using a switch statement in osname parsing
1 parent f306824 commit 79bfe2f

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

test/bin/scenario.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -533,19 +533,31 @@ launch_vm() {
533533
vm_extra_args="fips=${fips_mode}"
534534
vm_initrd_inject=""
535535

536-
declare -A os_map=(
537-
["rhel94-bootc"]="rhel9.4"
538-
["rhel-9.4"]="rhel9.4"
539-
["centos9-bootc"]="centos-stream9"
540-
["centos9"]="centos-stream9")
536+
local osname
537+
538+
case "${boot_blueprint}" in
539+
rhel*9*4*)
540+
osname="rhel9.4"
541+
;;
542+
centos9*)
543+
osname="centos-stream9"
544+
;;
545+
*)
546+
record_junit "${vmname}" "osname-parse" "FAILED"
547+
exit 1
548+
;;
549+
esac
550+
551+
record_junit "${vmname}" "osname-parse" "OK"
552+
541553

542554
# Add support of bootc image directory sharing with virtual machines
543555
if [ "${bootc_mode}" -ne 0 ] ; then
544556
# The ISO files generated by bootc-image-builder is not recognized by virt-install.
545557
# Work around the problem by specifying kernel and initrd paths.
546558
if [[ "${boot_blueprint}.iso" == *-bootc.iso ]] ; then
547559
vm_loc_args+=",kernel=images/pxeboot/vmlinuz,initrd=images/pxeboot/initrd.img"
548-
vm_loc_args+=" --osinfo name=${os_map[${boot_blueprint}]}"
560+
vm_loc_args+=" --osinfo name=${osname}"
549561
fi
550562
fi
551563

0 commit comments

Comments
 (0)