]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
fixup: actual delete liveboot images in db and filesystem
authorHolger Levsen <holger@layer-acht.org>
Thu, 15 Nov 2012 12:15:43 +0000 (13:15 +0100)
committerHolger Levsen <holger@layer-acht.org>
Thu, 15 Nov 2012 12:15:43 +0000 (13:15 +0100)
cleanup_liveboot.py
liveboot_build.sh
liveboot_garbage_collection.sh

index 79573cb2ae8c2875968567ea7d7f4e647dfaaca3..4fff2effaf62b7fedf40d1c5abb54315f479331f 100755 (executable)
@@ -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)
 
index cd987207243b239ac4a35326623a59006d276ffa..f8276344a61fe535b00dd89078f88750a6a6bd6d 100755 (executable)
@@ -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 *-*
index f8174731c11cbb70c9dc1a46ba64fb142241c631..50f87d569a01f30e4bf56eb636813f85eeb39426 100755 (executable)
@@ -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