From 75d42259851a886f6889a057e5ef586474f701e1 Mon Sep 17 00:00:00 2001 From: Marton Kiss Date: Mon, 17 Mar 2014 16:30:32 +0100 Subject: [PATCH] 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 --- modules/openstackid/files/functions | 24 ++++++++++++++++++- .../templates/openstackid.conf.erb | 4 +++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/modules/openstackid/files/functions b/modules/openstackid/files/functions index 6fcfaf2e51..4a5b22a3a2 100644 --- a/modules/openstackid/files/functions +++ b/modules/openstackid/files/functions @@ -31,6 +31,10 @@ function site_init() { chown $FILE_OWNER:$FILE_GROUP $SITE_ROOT/$dir done target_dir="$SITE_ROOT/slot0" + # fetch catalog and write actual version + fetch_catalog + RELEASE_VERSION=`catalog_get_version` + echo $RELEASE_VERSION > $SITE_ROOT/slot0/release # fetch and extract release tarball umask 0027 if [[ $SOURCE_TARBALL == http* ]]; then @@ -86,10 +90,28 @@ function site_status() { exit 1 fi else - echo "INSTALLED" + fetch_catalog + REMOTE_VERSION=`catalog_get_version` + RELEASE_VERSION=$(head -n 1 $SITE_ROOT/w/release) + if [ "$REMOTE_VERSION" == "$RELEASE_VERSION" ]; then + echo "INSTALLED [$RELEASE_VERSION]" + else + echo "UPDATE AVAILABLE [$RELEASE_VERSION-$REMOTE_VERSION]" + fi fi } +function fetch_catalog() { + curl --silent $SOURCE_ROOT > $SITE_ROOT/releases.lst + grep -q "^]\+>//g" | sed -r "s/^$RELEASE_NAME//"` + RELEASE_DATE=`echo $RAW_LINE | awk '{ print $1 " " $2}'` + echo $RELEASE_DATE +} + function site_update() { if [ ! $1 ]; then echo "ERROR: missing site parameter" diff --git a/modules/openstackid/templates/openstackid.conf.erb b/modules/openstackid/templates/openstackid.conf.erb index 30e81c2f7d..9d11831986 100644 --- a/modules/openstackid/templates/openstackid.conf.erb +++ b/modules/openstackid/templates/openstackid.conf.erb @@ -1,3 +1,5 @@ SITE_ROOT=/srv/openstackid SOURCE_TARBALL=http://tarballs.openstack.org/openstackid/openstackid-latest.tar.gz -LARAVEL_ENV=dev \ No newline at end of file +LARAVEL_ENV=dev +RELEASE_NAME=openstackid-latest.tar.gz +SOURCE_ROOT=http://tarballs.openstack.org/openstackid/ \ No newline at end of file