Browse Source

Openstackid track site version

Openstackid deploy tool now tracks the deployed site version
from tarballs.openstack.org and deploy.sh status command display
UPDATE AVAILABLE when a new release is available.

Change-Id: I8bbc3bfceca37d00c3bba78995e3aff01b671aa4
Marton Kiss 5 years ago
parent
commit
2893d81266
2 changed files with 26 additions and 2 deletions
  1. 23
    1
      files/functions
  2. 3
    1
      templates/openstackid.conf.erb

+ 23
- 1
files/functions View File

@@ -31,6 +31,10 @@ function site_init() {
31 31
     chown $FILE_OWNER:$FILE_GROUP $SITE_ROOT/$dir
32 32
   done
33 33
   target_dir="$SITE_ROOT/slot0"
34
+  # fetch catalog and write actual version
35
+  fetch_catalog
36
+  RELEASE_VERSION=`catalog_get_version`
37
+  echo $RELEASE_VERSION > $SITE_ROOT/slot0/release
34 38
   # fetch and extract release tarball
35 39
   umask 0027
36 40
   if [[ $SOURCE_TARBALL == http* ]]; then
@@ -86,10 +90,28 @@ function site_status() {
86 90
       exit 1
87 91
     fi
88 92
   else
89
-    echo "INSTALLED"
93
+    fetch_catalog
94
+    REMOTE_VERSION=`catalog_get_version`
95
+    RELEASE_VERSION=$(head -n 1 $SITE_ROOT/w/release)
96
+    if [ "$REMOTE_VERSION" == "$RELEASE_VERSION" ]; then
97
+      echo "INSTALLED [$RELEASE_VERSION]"
98
+    else
99
+      echo "UPDATE AVAILABLE [$RELEASE_VERSION-$REMOTE_VERSION]"
100
+    fi
90 101
   fi
91 102
 }
92 103
 
104
+function fetch_catalog() {
105
+  curl --silent $SOURCE_ROOT > $SITE_ROOT/releases.lst
106
+  grep -q "^<!DOCTYPE HTML PUBLIC" $SITE_ROOT/releases.lst
107
+}
108
+
109
+function catalog_get_version() {
110
+  RAW_LINE=`cat $SITE_ROOT/releases.lst | grep "$RELEASE_NAME" | sed "s/<[^>]\+>//g" | sed -r "s/^$RELEASE_NAME//"`
111
+  RELEASE_DATE=`echo $RAW_LINE | awk '{ print $1 " " $2}'`
112
+  echo $RELEASE_DATE
113
+}
114
+
93 115
 function site_update() {
94 116
   if [ ! $1 ]; then
95 117
     echo "ERROR: missing site parameter"

+ 3
- 1
templates/openstackid.conf.erb View File

@@ -1,3 +1,5 @@
1 1
 SITE_ROOT=/srv/openstackid
2 2
 SOURCE_TARBALL=http://tarballs.openstack.org/openstackid/openstackid-latest.tar.gz
3
-LARAVEL_ENV=dev
3
+LARAVEL_ENV=dev
4
+RELEASE_NAME=openstackid-latest.tar.gz
5
+SOURCE_ROOT=http://tarballs.openstack.org/openstackid/

Loading…
Cancel
Save