Fix track end events in charmed installation and add OS info to the tracking
[osm/devops.git] / installers / full_install_osm.sh
index 9f0f3bb..9497fd4 100755 (executable)
@@ -461,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}')
@@ -966,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
@@ -987,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