From bc224f58c127174308bc686c7282ac8c7c4650dc Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Thu, 15 Nov 2012 13:15:43 +0100 Subject: [PATCH] fixup: actual delete liveboot images in db and filesystem --- cleanup_liveboot.py | 6 +++--- liveboot_build.sh | 2 +- liveboot_garbage_collection.sh | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) 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 -- 2.39.5