Skip to content

Commit 74635c6

Browse files
authored
Merge pull request #368 from xtrusia/fix/jq-null-applications-iterate
Fix jq null iteration error in construct_novarc.sh
2 parents 24b3652 + c0f3661 commit 74635c6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

openstack/tools/construct_novarc.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ fi
2424
# check config-based ssl first
2525
if [[ -n "$(juju config keystone ssl_cert)" ]]; then
2626
export OS_AUTH_PROTOCOL=https
27-
elif (($(jq -r '.applications[]| select(."charm-name"=="vault")' "$juju_status_json_cache" | wc -l))); then
27+
elif (($(jq -r '(.applications // {})[]| select(."charm-name"=="vault")' "$juju_status_json_cache" | wc -l))); then
2828
# Vault-based ssl
29-
if jq -r '.applications.vault.relations.certificates[]' "$juju_status_json_cache" | grep -q keystone; then
29+
if jq -r '(.applications.vault.relations.certificates // [])[]' "$juju_status_json_cache" | grep -q keystone; then
3030
readarray -t VAULT_STATUS < <(juju status vault --format=json | jq -r '.applications.vault.units."vault/0"."workload-status" | .current,.message')
3131
if [[ "${VAULT_STATUS[0]}" == "blocked" && "${VAULT_STATUS[1]}" == "Vault needs to be initialized" ]]; then
3232
read -p "$(

0 commit comments

Comments
 (0)