Fix 1391: New version of yq snap makes charmed installer to fail 57/10157/2
authorcalvinosanc1 <guillermo.calvino@canonical.com>
Mon, 4 Jan 2021 10:42:18 +0000 (11:42 +0100)
committerbeierlm <mark.beierl@canonical.com>
Fri, 15 Jan 2021 15:54:59 +0000 (16:54 +0100)
Change-Id: I111fe3e213002d428c21bb18f81f7d1abe8a6c7c
Signed-off-by: calvinosanc1 <guillermo.calvino@canonical.com>
installers/charmed_install.sh

index 4d04a91..7f05e04 100755 (executable)
@@ -310,14 +310,14 @@ function create_overlay() {
     sudo snap install jq
     sudo snap install yq
     local HOME=/home/$USER
-    local vca_user=$(cat $HOME/.local/share/juju/accounts.yaml | yq r - controllers.$CONTROLLER_NAME.user)
-    local vca_password=$(cat $HOME/.local/share/juju/accounts.yaml | yq r - controllers.$CONTROLLER_NAME.password)
-    local vca_host=$(cat $HOME/.local/share/juju/controllers.yaml | yq r - controllers.$CONTROLLER_NAME.api-endpoints[0] | cut -d ":" -f 1)
-    local vca_port=$(cat $HOME/.local/share/juju/controllers.yaml | yq r - controllers.$CONTROLLER_NAME.api-endpoints[0] | cut -d ":" -f 2)
+    local vca_user=$(cat $HOME/.local/share/juju/accounts.yaml | yq e .controllers.$CONTROLLER_NAME.user - )
+    local vca_password=$(cat $HOME/.local/share/juju/accounts.yaml | yq e .controllers.$CONTROLLER_NAME.password - )
+    local vca_host=$(cat $HOME/.local/share/juju/controllers.yaml | yq e .controllers.$CONTROLLER_NAME.api-endpoints[0] - | cut -d ":" -f 1)
+    local vca_port=$(cat $HOME/.local/share/juju/controllers.yaml | yq e .controllers.$CONTROLLER_NAME.api-endpoints[0] - | cut -d ":" -f 2)
     local vca_pubkey=\"$(cat $HOME/.local/share/juju/ssh/juju_id_rsa.pub)\"
     local vca_cloud="lxd-cloud"
     # Get the VCA Certificate
-    local vca_cacert=$(cat $HOME/.local/share/juju/controllers.yaml | yq r - controllers.$CONTROLLER_NAME.ca-cert | base64 | tr -d \\n)
+    local vca_cacert=$(cat $HOME/.local/share/juju/controllers.yaml | yq e .controllers.$CONTROLLER_NAME.ca-cert - | base64 | tr -d \\n)
 
     # Calculate the default route of this machine
     local DEFAULT_IF=`ip route list match 0.0.0.0 | awk '{print $5}'`