<commit_before># assume there are no conflicts
echo "pulling source from git repository"
git pull
if [ "$?" -ne "0" ]; then       # we need to consider using hard reset here instead of specifying there's a problem: git reset --hard
    echo "problems with git pull, run git status to see the problem"
    exit 1
fi

git log --oneline --abbrev=30 ORIG_HEAD.. >> automatic_changelog

# note: this script does not need an update. it is edited on production and never committed to CVS.
. /etc/sysconfig/play


# I know we can commit the files with the correct mode, cannot rely on this in production.
echo "changing mode for sh files"
chmod 755 $WIDGET_HOME/*.sh
chmod 755 $WIDGET_HOME/bin/*.sh

if [ $CLOUDIFY_UPGRADE == "MANUAL" ]; then
  echo "Upgrade can be performed only manually"
  exit 1
fi

echo "Upgrading of cloudify is not backward compatible, are you sure you want to continue( y/n )?"
read ANSWER

if [ $ANSWER != "y" ]; then
  exit 1
fi

# http://repository.cloudifysource.org/org/cloudifysource/2.7.0-5985-M3/gigaspaces-cloudify-2.7.0-M3-b5985.zip

CLOUDIFY_VERSION=2.7.0
BUILD_NUMBER=5985
MILESTONE=m3
BUILD_TYPE=SNAPSHOT

MILESTONE_UPPERCASE=`echo $MILESTONE | tr '[:lower:]' '[:upper:]'`
BUILD_VERSION=${CLOUDIFY_VERSION}-${BUILD_NUMBER}-${MILESTONE_UPPERCASE}
CLOUDIFY_MILESTONE=${CLOUDIFY_VERSION}-${BUILD_NUMBER}-${MILESTONE}
CLOUDIFY_BUILD=${CLOUDIFY_VERSION}-${MILESTONE}-b${BUILD_NUMBER}
echo "upgrading cloudify to version $CLOUDIFY_VERSION $CLOUDIFY_BUILD"
CLOUDIFY_FOLDER=gigaspaces-cloudify-${CLOUDIFY_VERSION}-${MILESTONE}
CLOUDIFY_ZIP_NAME=${CLOUDIFY_FOLDER}-b${BUILD_NUMBER}
CLOUDIFY_FILE=${CLOUDIFY_ZIP_NAME}.zip
echo searching if file [${CLOUDIFY_FILE}] already exists
if [ -f /root/$CLOUDIFY_FILE ]; then
    echo "cloudify already installed, nothing to go"
else
    echo "executing wget on [http://repository.cloudifysource.org/org/cloudifysource/${BUILD_VERSION}/${CLOUDIFY_FILE}]"
    wget "http://repository.cloudifysource.org/org/cloudifysource/${BUILD_VERSION}/${CLOUDIFY_FILE}" -O /root/$CLOUDIFY_FILE
    if [ $? -ne 0 ]; then
        echo "wget failed. deleting the file"
        rm -f  /root/$CLOUDIFY_FILE
    else
        unzip /root/$CLOUDIFY_FILE -d /root/
        ln -Tfs /root/${CLOUDIFY_FOLDER} cloudify-folder
    fi
fi


echo "overriding webui-context.xml in cloudify installation"
\cp -f conf/cloudify/webui-context.xml cloudify-folder/config/cloudify-webui-context-override.xml

echo "injecting variables to cloudify.conf, and generating cloudify-prod.conf - extend this file in production instead of cloudify.conf"
cat conf/cloudify.conf | sed 's,__CLOUDIFY_SECURITY_GROUP__,'"$CLOUDIFY_SECURITY_GROUP"','  > conf/cloudify-prod.conf



TMP_SITE_CONF=conf/nginx/output.nginx
SITE_CONF_TARGET=/etc/nginx/sites-available/$SITE_DOMAIN
NGINX_CONF_SRC=conf/nginx/nginx.conf
NGINX_CONF_TARGET=/etc/nginx/nginx.conf
echo "copying nginx configurations"

cmp  -s ${NGINX_CONF_SRC} ${NGINX_CONF_TARGET}
if [ $? -ne 0 ]; then
    \cp -f ${NGINX_CONF_SRC} ${NGINX_CONF_TARGET}<commit_msg>CW-57 added option to run upgrade server manually<commit_after># assume there are no conflicts
echo "pulling source from git repository"
git pull
if [ "$?" -ne "0" ]; then       # we need to consider using hard reset here instead of specifying there's a problem: git reset --hard
    echo "problems with git pull, run git status to see the problem"
    exit 1
fi

git log --oneline --abbrev=30 ORIG_HEAD.. >> automatic_changelog

# note: this script does not need an update. it is edited on production and never committed to CVS.
. /etc/sysconfig/play


# I know we can commit the files with the correct mode, cannot rely on this in production.
echo "changing mode for sh files"
chmod 755 $WIDGET_HOME/*.sh
chmod 755 $WIDGET_HOME/bin/*.sh

# http://repository.cloudifysource.org/org/cloudifysource/2.7.0-5985-M3/gigaspaces-cloudify-2.7.0-M3-b5985.zip

echo "CLOUDIFY_UPGRADE="$CLOUDIFY_UPGRADE

if [ $CLOUDIFY_UPGRADE != "MANUAL" ]; then

CLOUDIFY_VERSION=2.7.0
BUILD_NUMBER=5985
MILESTONE=m3
BUILD_TYPE=SNAPSHOT

MILESTONE_UPPERCASE=`echo $MILESTONE | tr '[:lower:]' '[:upper:]'`
BUILD_VERSION=${CLOUDIFY_VERSION}-${BUILD_NUMBER}-${MILESTONE_UPPERCASE}
CLOUDIFY_MILESTONE=${CLOUDIFY_VERSION}-${BUILD_NUMBER}-${MILESTONE}
CLOUDIFY_BUILD=${CLOUDIFY_VERSION}-${MILESTONE}-b${BUILD_NUMBER}
echo "upgrading cloudify to version $CLOUDIFY_VERSION $CLOUDIFY_BUILD"
CLOUDIFY_FOLDER=gigaspaces-cloudify-${CLOUDIFY_VERSION}-${MILESTONE}
CLOUDIFY_ZIP_NAME=${CLOUDIFY_FOLDER}-b${BUILD_NUMBER}
CLOUDIFY_FILE=${CLOUDIFY_ZIP_NAME}.zip
echo searching if file [${CLOUDIFY_FILE}] already exists
if [ -f /root/$CLOUDIFY_FILE ]; then
    echo "cloudify already installed, nothing to go"
else
    echo "executing wget on [http://repository.cloudifysource.org/org/cloudifysource/${BUILD_VERSION}/${CLOUDIFY_FILE}]"
    wget "http://repository.cloudifysource.org/org/cloudifysource/${BUILD_VERSION}/${CLOUDIFY_FILE}" -O /root/$CLOUDIFY_FILE
    if [ $? -ne 0 ]; then
        echo "wget failed. deleting the file"
        rm -f  /root/$CLOUDIFY_FILE
    else
        unzip /root/$CLOUDIFY_FILE -d /root/
        ln -Tfs /root/${CLOUDIFY_FOLDER} cloudify-folder
    fi
fi
else
  echo "Cloudify upgrade can be performed only manually"
fi

echo "overriding webui-context.xml in cloudify installation"
\cp -f conf/cloudify/webui-context.xml cloudify-folder/config/cloudify-webui-context-override.xml

echo "injecting variables to cloudify.conf, and generating cloudify-prod.conf - extend this file in production instead of cloudify.conf"
cat conf/cloudify.conf | sed 's,__CLOUDIFY_SECURITY_GROUP__,'"$CLOUDIFY_SECURITY_GROUP"','  > conf/cloudify-prod.conf



TMP_SITE_CONF=conf/nginx/output.nginx
SITE_CONF_TARGET=/etc/nginx/sites-available/$SITE_DOMAIN
NGINX_CONF_SRC=conf/nginx/nginx.conf
NGINX_CONF_TARGET=/etc/nginx/nginx.conf
echo "copying nginx configurations"

cmp  -s ${NGINX_CONF_SRC} ${NGINX_CONF_TARGET}
if [ $? -ne 0 ]; then
    \cp -f ${NGINX_CONF_SRC} ${NGINX_CONF_TARGET}
{'fraction_non_alphanumeric': 0.11627129969929836, 'fraction_numerical': 0.01269629134647511, 'mean_word_length': 4.7845410628019325, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1602512', 'n_tokens_mistral': 2296, 'n_tokens_neox': 2189, 'n_words': 523}