From d4b2c8ac057270b2a690ab8e996718cd4e345635 Mon Sep 17 00:00:00 2001 From: Nicolas Bock Date: Fri, 6 Dec 2024 15:23:22 -0700 Subject: [PATCH] Fix upload octavia script Signed-off-by: Nicolas Bock --- .../tools/upload_octavia_amphora_image.sh | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) 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}