From 534a8dbf08457954fe13bf585dc5f415f736a9b3 Mon Sep 17 00:00:00 2001 From: Nicolas Bock Date: Thu, 26 Oct 2023 16:58:39 -0600 Subject: [PATCH] Remove hard-coded unit reference When keystone unit 0 is missing or another unit is the current leader, the hard-coded reference to `keystone/0` will yield a null or incorrect result. Signed-off-by: Nicolas Bock --- openstack/novarc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openstack/novarc b/openstack/novarc index 70e9d457..697c975a 100644 --- a/openstack/novarc +++ b/openstack/novarc @@ -16,7 +16,7 @@ done keystone_addr=`juju config keystone vip` if [ -z "$keystone_addr" ]; then - keystone_addr=`jq -r '.applications.keystone.units."keystone/0"."public-address"' $juju_status_json_cache` + keystone_addr=$(jq --raw-output '.applications.keystone.units[] | select (.leader == true) | .["public-address"]' $juju_status_json_cache) fi # check config-based ssl first