Remove old mongo K8s manifest file and references in the installer
[osm/devops.git] / installers / full_install_osm.sh
index 7594984..d21b6ce 100755 (executable)
@@ -143,10 +143,12 @@ function check_packages() {
     NEEDED_PACKAGES="$1"
     echo -e "Checking required packages: ${NEEDED_PACKAGES}"
     for PACKAGE in ${NEEDED_PACKAGES} ; do
-        dpkg -L ${PACKAGE} &>/dev/null
+        dpkg -L ${PACKAGE}
         if [ $? -ne 0 ]; then
-            echo -e "Package ${PACKAGE} is not installed. Updating apt"
+            echo -e "Package ${PACKAGE} is not installed."
+            echo -e "Updating apt-cache ..."
             sudo apt-get update
+            echo -e "Installing ${PACKAGE} ..."
             sudo apt-get install -y ${PACKAGE} || FATAL "failed to install ${PACKAGE}"
         fi
     done
@@ -253,10 +255,6 @@ function generate_docker_images() {
         sg docker -c "docker pull wurstmeister/kafka:${KAFKA_TAG}" || FATAL "cannot get kafka docker image"
     fi
 
-    if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q MONGO ; then
-        sg docker -c "docker pull mongo" || FATAL "cannot get mongo docker image"
-    fi
-
     if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q PROMETHEUS ; then
         sg docker -c "docker pull prom/prometheus:${PROMETHEUS_TAG}" || FATAL "cannot get prometheus docker image"
     fi
@@ -340,7 +338,6 @@ function generate_k8s_manifest_files() {
     [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
     #Kubernetes resources
     sudo cp -bR ${OSM_DEVOPS}/installers/docker/osm_pods $OSM_DOCKER_WORK_DIR
-    sudo rm -f $OSM_K8S_WORK_DIR/mongo.yaml
     [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
 }
 
@@ -627,6 +624,10 @@ EOF"
 
 function install_osm() {
     [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
+
+    trap ctrl_c INT
+    track start release $RELEASE none none docker_tag $OSM_DOCKER_TAG none none installation_type $OSM_INSTALLATION_TYPE none none
+
     track checks checkingroot_ok
     [ "$USER" == "root" ] && FATAL "You are running the installer as root. The installer is prepared to be executed as a normal user with sudo privileges."
     track checks noroot_ok
@@ -655,7 +656,6 @@ function install_osm() {
 
     # if no host is passed in, we need to install lxd/juju, unless explicilty asked not to
     if [ -z "$OSM_VCA_HOST" ] && [ -z "$INSTALL_NOLXD" ] && [ -z "$LXD_CLOUD_FILE" ]; then
-        check_packages "snapd"
         install_lxd
     fi
 
@@ -834,6 +834,8 @@ function dump_vars(){
     echo "OPENSTACK_VM_NAME"="$OPENSTACK_VM_NAME"
     echo "OSM_DEVOPS=$OSM_DEVOPS"
     echo "OSM_DOCKER_TAG=$OSM_DOCKER_TAG"
+    echo "OSM_DOCKER_WORK_DIR=$OSM_DOCKER_WORK_DIR"
+    echo "OSM_K8S_WORK_DIR=$OSM_K8S_WORK_DIR"
     echo "OSM_STACK_NAME=$OSM_STACK_NAME"
     echo "OSM_VCA_HOST=$OSM_VCA_HOST"
     echo "OSM_VCA_PUBKEY=$OSM_VCA_PUBKEY"
@@ -862,9 +864,16 @@ function parse_docker_registry_url() {
     [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
 }
 
+function ctrl_c() {
+    [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function
+    echo "** Trapped CTRL-C"
+    FATAL "User stopped the installation"
+    [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function
+}
+
 LXD_VERSION=4.0
 JUJU_VERSION=2.9
-JUJU_AGENT_VERSION=2.9.17
+JUJU_AGENT_VERSION=2.9.22
 UNINSTALL=""
 DEVELOP=""
 UPDATE=""
@@ -1143,7 +1152,7 @@ fi
 # if develop, we force master
 [ -z "$COMMIT_ID" ] && [ -n "$DEVELOP" ] && COMMIT_ID="master"
 
-check_packages "git wget curl tar"
+check_packages "git wget curl tar snapd"
 
 sudo snap install jq
 if [ -z "$OSM_DEVOPS" ]; then
@@ -1179,10 +1188,6 @@ OSM_K8S_WORK_DIR="$OSM_DOCKER_WORK_DIR/osm_pods" && OSM_NAMESPACE_VOL="${OSM_HOS
 #Installation starts here
 wget -q -O- https://osm-download.etsi.org/ftp/osm-11.0-eleven/README.txt &> /dev/null
 export OSM_TRACK_INSTALLATION_ID="$(date +%s)-$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16)"
-
-track start release $RELEASE none none docker_tag $OSM_DOCKER_TAG none none installation_type $OSM_INSTALLATION_TYPE none none
-
 install_osm
 echo -e "\nDONE"
 exit 0
-