From: Holger Levsen Date: Thu, 15 Nov 2012 12:15:43 +0000 (+0100) Subject: fixup: actual delete liveboot images in db and filesystem X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=bc224f58c127174308bc686c7282ac8c7c4650dc;p=profitbricks%2Fjenkins-build-scripts.git fixup: actual delete liveboot images in db and filesystem --- diff --git a/cleanup_liveboot.py b/cleanup_liveboot.py index 79573cb..4fff2ef 100755 --- a/cleanup_liveboot.py +++ b/cleanup_liveboot.py @@ -38,7 +38,7 @@ def set_liveboot_to_delete(name): return False if __name__ == '__main__': - if len(sys.argv) != 2 or sys.argv[1] not in ('keep', 'delete'): + if len(sys.argv) != 3 or sys.argv[1] not in ('keep', 'delete'): print("usage: %s keep $liveboot_name") print(" will return true or false, depending if 'keep_image' is set for this image") print("usage: %s delete $liveboot_name") @@ -46,8 +46,8 @@ if __name__ == '__main__': sys.exit(1) action = sys.argv[1] name = sys.argv[2] - if action = "keep" and not liveboot_to_keep(name): + if action == "keep" and not liveboot_to_keep(name): sys.exit(1) - if action = "delete": + if action == "delete": set_liveboot_to_delete(name) diff --git a/liveboot_build.sh b/liveboot_build.sh index cd98720..f827634 100755 --- a/liveboot_build.sh +++ b/liveboot_build.sh @@ -69,7 +69,7 @@ BUILD_END=$(date +%s) $SCRIPTSDIR/liveboot2db.py $JOB_NAME $BUILD_NUMBER $REQUEST_ID $BUILD_START $BUILD_END "successful" if [ "$GIT_BRANCH" = "master" ] ; then - # FIXME: too much sudo here... + # FIXME: too much sudo here... when this is fixed, also remove sudo call from liveboot_garbage_collection cd /srv/build/liveboot/builds sudo chgrp www-data *-* sudo chmod g+w *-* diff --git a/liveboot_garbage_collection.sh b/liveboot_garbage_collection.sh index f817473..50f87d5 100755 --- a/liveboot_garbage_collection.sh +++ b/liveboot_garbage_collection.sh @@ -38,7 +38,8 @@ for DIRECTORY in $SECOND_PASS ; do else echo "deleted." $SCRIPT_PATH/cleanup_liveboot.py "delete" "$DIRECTORY" - rm -rf "$LIVEBOOT_IMAGE_PATH/$DIRECTORY" + # FIXME: this sudo is kinda ugly. cause is liveboot_build.sh actually + sudo rm -rf "$LIVEBOOT_IMAGE_PATH/$DIRECTORY" fi done echo