Skip to content

Commit

Permalink
tests/lib: forgot to commit nested.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Meulengracht committed Oct 3, 2024
1 parent dc4ff80 commit ee361ee
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/lib/nested.sh
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,8 @@ nested_get_image_name_base() {
}

nested_get_image_name() {
local BASE_NAME="$(nested_get_image_name_base $1)"
local BASE_NAME
BASE_NAME="$(nested_get_image_name_base "$1")"
echo "${BASE_NAME}.img"
}

Expand Down Expand Up @@ -919,7 +920,8 @@ nested_create_core_vm() {
# ubuntu-image dropped the --output parameter, so we have to rename
# the image ourselves, the images are named after volumes listed in
# gadget.yaml
local IMAGE_BASE_NAME="$(nested_get_image_name_base core)"
local IMAGE_BASE_NAME
IMAGE_BASE_NAME="$(nested_get_image_name_base core)"
find "$NESTED_IMAGES_DIR/" -maxdepth 1 -name '*.img' | while read -r imgname; do
volname=$(basename "$imgname" .img)
mv "$imgname" "$NESTED_IMAGES_DIR/$IMAGE_BASE_NAME-$volname.img"
Expand All @@ -928,9 +930,10 @@ nested_create_core_vm() {
# get the name of the boot-volume, and then create a symlink
# between the regular image name and the main volume, additional
# volumes must be manually added to the VM creation by the tests
local BOOTVOLUME
BOOTVOLUME=pc
if [ -e pc-gadget/meta/gadget.yaml ]; then
BOOTVOLUME="$(yq eval '.volumes[] | .structure.[] | select(.name == \"ubuntu-boot\") | parent(2) | key' pc-gadget/meta/gadget.yaml)"
BOOTVOLUME="$(yq eval '.volumes[] | .structure.[] | select(.name == "ubuntu-boot") | parent(2) | key' pc-gadget/meta/gadget.yaml)"
fi
ln -s "$NESTED_IMAGES_DIR/$IMAGE_BASE_NAME-$BOOTVOLUME.img" "$NESTED_IMAGES_DIR/$IMAGE_NAME"

Expand Down

0 comments on commit ee361ee

Please sign in to comment.