Update installer for Ubuntu22 and K8s 1.26.5
[osm/devops.git] / installers / full_install_osm.sh
index 8d862f6..8f092fb 100755 (executable)
@@ -180,16 +180,16 @@ function install_osmclient(){
     key_location=$CLIENT_REPOSITORY_BASE/$CLIENT_RELEASE/$CLIENT_REPOSITORY_KEY
     curl $key_location | sudo APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add -
     sudo add-apt-repository -y "deb [arch=amd64] $CLIENT_REPOSITORY_BASE/$CLIENT_RELEASE $CLIENT_REPOSITORY osmclient IM"
-    sudo apt-get update
-    sudo apt-get install -y python3-pip
+    sudo apt-get -y update
+    sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3-pip
     sudo -H LC_ALL=C python3 -m pip install -U pip
     sudo -H LC_ALL=C python3 -m pip install -U python-magic pyangbind verboselogs
-    sudo apt-get install -y python3-osm-im python3-osmclient
+    sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3-osm-im python3-osmclient
     if [ -f /usr/lib/python3/dist-packages/osm_im/requirements.txt ]; then
         python3 -m pip install -r /usr/lib/python3/dist-packages/osm_im/requirements.txt
     fi
     if [ -f /usr/lib/python3/dist-packages/osmclient/requirements.txt ]; then
-        sudo apt-get install -y libcurl4-openssl-dev libssl-dev libmagic1
+        sudo DEBIAN_FRONTEND=noninteractive apt-get install -y libcurl4-openssl-dev libssl-dev libmagic1
         python3 -m pip install -r /usr/lib/python3/dist-packages/osmclient/requirements.txt
     fi
     [ -z "$INSTALL_LIGHTWEIGHT" ] && export OSM_HOSTNAME=`lxc list | awk '($2=="SO-ub"){print $6}'`
@@ -316,7 +316,6 @@ EOF"
     # OSM_HELM_OPTS="${OSM_HELM_OPTS} --set nbi.useOsmSecret=false"
     OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.image.repositoryBase=${DOCKER_REGISTRY_URL}${DOCKER_USER}"
     OSM_HELM_OPTS="${OSM_HELM_OPTS} --set mysql.dbHostPath=${OSM_NAMESPACE_VOL}"
-    OSM_HELM_OPTS="${OSM_HELM_OPTS} --set mon.config.OS_NOTIFIER_URI=http://${OSM_DEFAULT_IP}:8662"
     OSM_HELM_OPTS="${OSM_HELM_OPTS} --set vca.host=${OSM_VCA_HOST}"
     OSM_HELM_OPTS="${OSM_HELM_OPTS} --set vca.secret=${OSM_VCA_SECRET}"
     OSM_HELM_OPTS="${OSM_HELM_OPTS} --set vca.cacert=${OSM_VCA_CACERT}"
@@ -462,28 +461,24 @@ function install_osm() {
 
     trap ctrl_c INT
 
-    # TODO: move this under start
-    [ -n "$DOCKER_REGISTRY_URL" ] && parse_docker_registry_url
 
     check_osm_behind_proxy
-
     check_packages "git wget curl tar snapd"
-
     sudo snap install jq || FATAL "Could not install jq (snap package). Make sure that snap works"
-
     find_devops_folder
 
-    track start release $RELEASE none none docker_tag $OSM_DOCKER_TAG none none installation_type $OSM_INSTALLATION_TYPE none none
+    track start release $RELEASE none none docker_tag $OSM_DOCKER_TAG none none installation_type $OSM_INSTALLATION_TYPE none none os_info $os_info 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
-
     ask_proceed
     track checks proceed_ok
 
     echo "Installing OSM"
 
+    [ -n "$DOCKER_REGISTRY_URL" ] && parse_docker_registry_url
+
     echo "Determining IP address of the interface with the default route"
     [ -z "$OSM_DEFAULT_IF" ] && OSM_DEFAULT_IF=$(ip route list|awk '$1=="default" {print $5; exit}')
     [ -z "$OSM_DEFAULT_IF" ] && OSM_DEFAULT_IF=$(route -n |awk '$1~/^0.0.0.0/ {print $8; exit}')
@@ -967,15 +962,26 @@ if [ -n "$UNINSTALL" ]; then
     exit 0
 fi
 
+# Installation starts here
+
+# Get README and create OSM_TRACK_INSTALLATION_ID
+wget -q -O- https://osm-download.etsi.org/ftp/osm-13.0-thirteen/README.txt &> /dev/null
+export OSM_TRACK_INSTALLATION_ID="$(date +%s)-$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16)"
+
+# Get OS info to be tracked
+os_distro=$(lsb_release -i 2>/dev/null | awk '{print $3}')
+echo $os_distro
+os_release=$(lsb_release -r 2>/dev/null | awk '{print $2}')
+echo $os_release
+os_info="${os_distro}_${os_release}"
+os_info="${os_info// /_}"
+
 # Charmed installation
 if [ -n "$CHARMED" ]; then
     sudo snap install jq || FATAL "Could not install jq (snap package). Make sure that snap works"
-    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
     ${OSM_DEVOPS}/installers/charmed_install.sh --tag $OSM_DOCKER_TAG "$@" || \
     FATAL_TRACK charmed_install "charmed_install.sh failed"
     wget -q -O- https://osm-download.etsi.org/ftp/osm-13.0-thirteen/README2.txt &> /dev/null
-    track end installation_type $OSM_INSTALLATION_TYPE
     echo -e "\nDONE"
     exit 0
 fi
@@ -988,19 +994,16 @@ if [ -n "$INSTALL_TO_OPENSTACK" ]; then
 fi
 
 # Community_installer
-
+# Check incompatible options
 [ -n "$TO_REBUILD" ] && [ "$TO_REBUILD" != " NONE" ] && echo $TO_REBUILD | grep -q NONE && FATAL "Incompatible option: -m NONE cannot be used with other -m options"
 [ -n "$TO_REBUILD" ] && [ "$TO_REBUILD" == " PLA" ] && [ -z "$INSTALL_PLA" ] && FATAL "Incompatible option: -m PLA cannot be used without --pla option"
+# Special cases go first
 # if develop, we force master
 [ -z "$COMMIT_ID" ] && [ -n "$DEVELOP" ] && COMMIT_ID="master"
-OSM_NAMESPACE_VOL="${OSM_HOST_VOL}/${OSM_NAMESPACE}"
 [ -n "$INSTALL_ONLY" ] && [ -n "$INSTALL_K8S_MONITOR" ] && install_k8s_monitoring
 [ -n "$INSTALL_ONLY" ] && [ -n "$INSTALL_NGSA" ] && install_osm_ngsa_service
 [ -n "$INSTALL_ONLY" ] && echo -e "\nDONE" && exit 0
-
-#Installation starts here
-wget -q -O- https://osm-download.etsi.org/ftp/osm-13.0-thirteen/README.txt &> /dev/null
-export OSM_TRACK_INSTALLATION_ID="$(date +%s)-$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16)"
+# This is where installation starts
 install_osm
 echo -e "\nDONE"
 exit 0