Improve tracking of failure events in install_juju.sh 94/13494/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 2 Jun 2023 08:29:23 +0000 (10:29 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 2 Jun 2023 08:30:30 +0000 (10:30 +0200)
Change-Id: Ib2394be66bee50abbff4200ca230cb20413e91e7
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
installers/install_juju.sh

index 23fd1ee..90632c3 100755 (executable)
@@ -54,7 +54,7 @@ function install_juju() {
 function juju_createcontroller_k8s(){
     [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
     cat $HOME/.kube/config | juju add-k8s $OSM_VCA_K8S_CLOUDNAME --client \
-    || FATAL "Failed to add K8s endpoint and credential for client in cloud $OSM_VCA_K8S_CLOUDNAME"
+    || FATAL_TRACK juju "Failed to add K8s endpoint and credential for client in cloud $OSM_VCA_K8S_CLOUDNAME"
 
     JUJU_BOOTSTRAP_OPTS=""
     if [ -n "${OSM_BEHIND_PROXY}" ] ; then
@@ -77,7 +77,7 @@ EOF
             --config controller-service-type=loadbalancer \
             --agent-version=$JUJU_AGENT_VERSION \
             ${JUJU_BOOTSTRAP_OPTS} \
-    || FATAL "Failed to bootstrap controller $OSM_NAMESPACE in cloud $OSM_VCA_K8S_CLOUDNAME"
+    || FATAL_TRACK juju "Failed to bootstrap controller $OSM_NAMESPACE in cloud $OSM_VCA_K8S_CLOUDNAME"
     [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
 }
 
@@ -234,7 +234,7 @@ if [ -z "$OSM_VCA_HOST" ]; then
         juju_createcontroller_k8s
         juju_addlxd_cloud
         if [ -n "$LXD_CLOUD_FILE" ]; then
-            [ -z "$LXD_CRED_FILE" ] && FATAL "The installer needs the LXD credential yaml if the LXD is external"
+            [ -z "$LXD_CRED_FILE" ] && FATAL_TRACK juju "The installer needs the LXD credential yaml if the LXD is external"
             OSM_VCA_CLOUDNAME="lxd-cloud"
             juju add-cloud $OSM_VCA_CLOUDNAME $LXD_CLOUD_FILE --force || juju update-cloud $OSM_VCA_CLOUDNAME --client -f $LXD_CLOUD_FILE
             juju add-credential $OSM_VCA_CLOUDNAME -f $LXD_CRED_FILE || juju update-credential $OSM_VCA_CLOUDNAME lxd-cloud-creds -f $LXD_CRED_FILE
@@ -243,7 +243,7 @@ if [ -z "$OSM_VCA_HOST" ]; then
     else
         OSM_VCA_CLOUDNAME="lxd-cloud"
         if [ -n "$LXD_CLOUD_FILE" ]; then
-            [ -z "$LXD_CRED_FILE" ] && FATAL "The installer needs the LXD credential yaml if the LXD is external"
+            [ -z "$LXD_CRED_FILE" ] && FATAL_TRACK juju "The installer needs the LXD credential yaml if the LXD is external"
             juju add-cloud -c $CONTROLLER_NAME $OSM_VCA_CLOUDNAME $LXD_CLOUD_FILE --force || juju update-cloud lxd-cloud -c $CONTROLLER_NAME -f $LXD_CLOUD_FILE
             juju add-credential -c $CONTROLLER_NAME $OSM_VCA_CLOUDNAME -f $LXD_CRED_FILE || juju update-credential lxd-cloud -c $CONTROLLER_NAME -f $LXD_CRED_FILE
         else
@@ -280,8 +280,6 @@ EOF
     fi
     [ -z "$CONTROLLER_NAME" ] && OSM_VCA_HOST=`sg lxd -c "juju show-controller $OSM_NAMESPACE"|grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'`
     [ -n "$CONTROLLER_NAME" ] && OSM_VCA_HOST=`juju show-controller $CONTROLLER_NAME |grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'`
-    [ -z "$OSM_VCA_HOST" ] && FATAL "Cannot obtain juju controller IP address"
+    [ -z "$OSM_VCA_HOST" ] && FATAL_TRACK juju "Cannot obtain juju controller IP address"
 fi
 track juju juju_controller_ok
-
-