diff --git a/openstack/tools/upload_octavia_amphora_image.sh b/openstack/tools/upload_octavia_amphora_image.sh index af6b0bfa..34a0fac6 100755 --- a/openstack/tools/upload_octavia_amphora_image.sh +++ b/openstack/tools/upload_octavia_amphora_image.sh @@ -1,2 +1,39 @@ -#!/bin/bash -eu -juju run octavia-diskimage-retrofit/0 retrofit-image +#!/bin/bash + +set -e -u + +basedir=$(realpath $(dirname $0)) +source ${basedir}/../novarc + +: ${series:=jammy} + +while (( $# > 0 )); do + case $1 in + --series) + shift + series=$1 + ;; + *) + echo "unknown option" + exit 1 + ;; + esac + shift +done + +set -x + +ID=$(openstack image show --format value --column id ${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}