Skip to content

Commit

Permalink
Fix upload octavia script
Browse files Browse the repository at this point in the history
The current version fails with the following error:

```console
$ ./tools/upload_octavia_amphora_image.sh
Running operation 5 with 1 task
  - task 6 on unit-octavia-diskimage-retrofit-0

Waiting for task 6...
Action id 6 failed: unable to find suitable source image
```

Signed-off-by: Nicolas Bock <[email protected]>
  • Loading branch information
nicolasbock committed Dec 11, 2024
1 parent 510a665 commit e874020
Showing 1 changed file with 46 additions and 2 deletions.
48 changes: 46 additions & 2 deletions openstack/tools/upload_octavia_amphora_image.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,46 @@
#!/bin/bash -eu
juju run octavia-diskimage-retrofit/0 retrofit-image
#!/bin/bash

set -e -u

declare amphora_series=jammy

while (( $# > 0 )); do
case $1 in
-h|--help)
cat <<EOF
Usage:
-h | --help This help
--series SERIES The series (also the image name) to use as the amphora base
EOF
exit
;;
--series)
shift
amphora_series=$1
;;
*)
echo "unknown option"
exit 1
;;
esac
shift
done

basedir=$(realpath $(dirname $0))
source ${basedir}/../novarc

ID=$(openstack image show --format value --column id ${amphora_series})

TASK=$(juju run octavia-diskimage-retrofit/0 retrofit-image source-image=${ID} --background 2>&1 | grep show-task | sed --regexp-extended 's/^.*task ([0-9]+).*/\1/')

echo -n "Running retrofit"
while [[ $(juju show-task ${TASK}) =~ running ]]; do
echo -n .
sleep 5
done
echo

ID=$(openstack image list --format json | jq --raw-output '.[] | select(.Name | match("amphora")) | .ID')

openstack image set --tag octavia-amphora ${ID}

0 comments on commit e874020

Please sign in to comment.