From 8f15dda55745484c27c3b5647a769cff1c8ae3f4 Mon Sep 17 00:00:00 2001 From: SimoneDutto Date: Mon, 16 Dec 2024 17:18:23 +0100 Subject: [PATCH] fix(failure using ipv6 in tests): fix controller addresses resolution in makefile to enable ipv6 The previuos shell command to extract the ipv6 from the show-controller was removing the '[' from the ipv6. The new command removed only the surrounding '[', making it possible to work with ipv6 fix #582 --- Makefile | 2 +- docs/index.md | 6 +++--- templates/index.md.tmpl | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index ec62cbd3..a9290d6f 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ endif JUJU=juju CONTROLLER=$(shell ${JUJU} whoami | yq .Controller) -CONTROLLER_ADDRESSES="$(shell ${JUJU} show-controller | yq '.${CONTROLLER}.details."api-endpoints"' | tr -d "[]' "|tr -d '"'|tr -d '\n')" +CONTROLLER_ADDRESSES="$(shell juju show-controller | yq .${CONTROLLER}.details.api-endpoints | yq -r '. | join(",")')" USERNAME="$(shell cat ~/.local/share/juju/accounts.yaml | yq '.controllers.${CONTROLLER}.user'|tr -d '"')" PASSWORD="$(shell cat ~/.local/share/juju/accounts.yaml | yq '.controllers.${CONTROLLER}.password'|tr -d '"')" CA_CERT="$(shell ${JUJU} show-controller $(echo ${CONTROLLER}|tr -d '"')| yq '.${CONTROLLER}.details."ca-cert"'|tr -d '"'|sed 's/\\n/\n/g')" diff --git a/docs/index.md b/docs/index.md index 7ec2656e..6fff1e37 100644 --- a/docs/index.md +++ b/docs/index.md @@ -47,7 +47,7 @@ Define the Juju controller credentials in the provider definition in your terraf ``` terraform provider "juju" { - controller_addresses = "10.225.205.241:17070,10.225.205.242:17070" + controller_addresses = "10.225.205.241:17070,10.225.205.242:17070,[fd42:791:fa5e:6834:216:3eff:fe7a:8e6a]:17070" username = "jujuuser" password = "password1" ca_certificate = file("~/ca-cert.pem") @@ -62,7 +62,7 @@ Define the client credentials in the provider definition in your terraform plan. ``` terraform provider "juju" { - controller_addresses = "10.225.205.241:17070,10.225.205.242:17070" + controller_addresses = "10.225.205.241:17070,10.225.205.242:17070,[fd42:791:fa5e:6834:216:3eff:fe7a:8e6a]:17070" client_id = "jujuclientid" client_secret = "jujuclientsecret" ca_certificate = file("~/ca-cert.pem") @@ -75,7 +75,7 @@ Define the Juju controller credentials in the provider definition via environmen ```shell export CONTROLLER=$(juju whoami | yq .Controller) -export JUJU_CONTROLLER_ADDRESSES="$(juju show-controller | yq '.[$CONTROLLER]'.details.\"api-endpoints\" | tr -d "[]' "|tr -d '"'|tr -d '\n')" +export JUJU_CONTROLLER_ADDRESSES=$(juju show-controller | yq .$CONTROLLER.details.api-endpoints | yq -r '. | join(",")') export JUJU_USERNAME="$(cat ~/.local/share/juju/accounts.yaml | yq .controllers.$CONTROLLER.user|tr -d '"')" export JUJU_PASSWORD="$(cat ~/.local/share/juju/accounts.yaml | yq .controllers.$CONTROLLER.password|tr -d '"')" export JUJU_CA_CERT="$(juju show-controller $(echo $CONTROLLER|tr -d '"') | yq '.[$CONTROLLER]'.details.\"ca-cert\"|tr -d '"'|sed 's/\\n/\n/g')" diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl index a98b9a50..dfaf5b4b 100644 --- a/templates/index.md.tmpl +++ b/templates/index.md.tmpl @@ -47,7 +47,7 @@ Define the Juju controller credentials in the provider definition in your terraf ``` terraform provider "juju" { - controller_addresses = "10.225.205.241:17070,10.225.205.242:17070" + controller_addresses = "10.225.205.241:17070,10.225.205.242:17070,[fd42:791:fa5e:6834:216:3eff:fe7a:8e6a]:17070" username = "jujuuser" password = "password1" ca_certificate = file("~/ca-cert.pem") @@ -62,7 +62,7 @@ Define the client credentials in the provider definition in your terraform plan. ``` terraform provider "juju" { - controller_addresses = "10.225.205.241:17070,10.225.205.242:17070" + controller_addresses = "10.225.205.241:17070,10.225.205.242:17070,[fd42:791:fa5e:6834:216:3eff:fe7a:8e6a]:17070" client_id = "jujuclientid" client_secret = "jujuclientsecret" ca_certificate = file("~/ca-cert.pem") @@ -75,7 +75,7 @@ Define the Juju controller credentials in the provider definition via environmen ```shell export CONTROLLER=$(juju whoami | yq .Controller) -export JUJU_CONTROLLER_ADDRESSES="$(juju show-controller | yq '.[$CONTROLLER]'.details.\"api-endpoints\" | tr -d "[]' "|tr -d '"'|tr -d '\n')" +export JUJU_CONTROLLER_ADDRESSES=$(juju show-controller | yq .$CONTROLLER.details.api-endpoints | yq -r '. | join(",")') export JUJU_USERNAME="$(cat ~/.local/share/juju/accounts.yaml | yq .controllers.$CONTROLLER.user|tr -d '"')" export JUJU_PASSWORD="$(cat ~/.local/share/juju/accounts.yaml | yq .controllers.$CONTROLLER.password|tr -d '"')" export JUJU_CA_CERT="$(juju show-controller $(echo $CONTROLLER|tr -d '"') | yq '.[$CONTROLLER]'.details.\"ca-cert\"|tr -d '"'|sed 's/\\n/\n/g')"