From: Olivier Larchevêque Date: Mon, 23 Sep 2013 18:01:33 +0000 (-0400) Subject: test media X-Git-Url: http://git.auf.org/?p=auf_skeleton_django.git;a=commitdiff_plain;h=89f40ab4979d82b904f1819d6fcc14fb4ee7c0f6 test media --- diff --git a/bin/deploy b/bin/deploy index 72064fc..24b7d9b 100755 --- a/bin/deploy +++ b/bin/deploy @@ -8,7 +8,7 @@ PRODUCTION="production" # Prerequis pour le fonctionnement du script ################################################################################ if [ ! -e "$ROOT_PATH/README.rst" ]; then - echo "Placez vous a la racine du projet." + echo "KO: Placez vous a la racine du projet." exit -1 fi @@ -33,7 +33,7 @@ if [ "$BUILD" = "$PRODUCTION" ]; then nothing to commit (working directory clean)" GIT_STATUS=`git status` if [ "$GIT_STATUS" != "$GIT_CLEAN" ]; then - echo "Le depot local n'est pas dans un etat acceptable pour deployer" + echo "KO: Le depot a des modifications locales" exit -1 fi fi @@ -43,13 +43,13 @@ fi # Tests concerant la configuration ################################################################################ if [ ! -e "$ROOT_PATH/conf.py" ]; then - echo "Il n'y a pas le fichier conf.py a la racine du projet." + echo "KO: Il n'y a pas le fichier conf.py a la racine du projet." exit -1 fi DIFF=`diff -y conf.py.edit conf.py | grep '<' | colordiff` if [ "$DIFF" != "" ]; then - echo 'Ajuster le conf.py' + echo 'KO: Ajuster le conf.py' diff -y conf.py.edit conf.py | grep '<' | colordiff exit -1 fi @@ -70,10 +70,26 @@ echo "Installation des dependances." echo $VENV_PATH/bin/pip $VENV_PATH/bin/pip install -r $REQUIREMENTS +################################################################################ +# Mise en production +################################################################################ if [ "$BUILD" != "$PRODUCTION" ]; then exit -1 fi +echo "test des permissions" +MEDIA_PATH=$ROOT_PATH/media +$MEDIA_PERMS=`stat -c %a $MEDIA_PATH` +if [ "$MEDIA_PERMS" != "2775" ]; then + echo "KO: les permissions sur $MEDIA_PATH ne sont pas bonnes (attendu 2775)" + exit -1 +fi +$MEDIA_GRP=`stat -c %G $MEDIA_PATH` +if [ "$MEDIA_GRP" != "www-data" ]; then + echo "KO: le groupe sur $MEDIA_PATH n'est pas bon (attendu www-data)" + exit -1 +fi + ################################################################################ # Preparation du projet (en production uniquement) ################################################################################ @@ -82,5 +98,3 @@ echo "settings: " $SETTINGS $ROOT_PATH/bin/django syncdb --settings=$SETTINGS --noinput $ROOT_PATH/bin/django migrate --settings=$SETTINGS --noinput $ROOT_PATH/bin/django collectstatic --settings=$SETTINGS --noinput - -