Skip to content

Commit

Permalink
When hard_cleanup do images as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chmouel Boudjnah committed May 10, 2011
1 parent 83e2367 commit cef3799
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions guestbook/cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ def do_restore(self, delete_image_after=True):
return

for image in images_list:
sname = image.name.replace("backup-", "")
if image.name.startswith("backup-") and \
sname = image.name.replace(BACKUP_PREFIX + '-', "")
if image.name.startswith(BACKUP_PREFIX + '-') and \
sname in SERVER_NAMES:
fId = self.mclient.get("demo-cron-backupFlavorId%s" % \
(str(sname)))
Expand Down Expand Up @@ -416,7 +416,6 @@ def main(self):
elif options.hard_cleanup:
self.hard_cleanup()
return
#self.hard_cleanup()
elif options.daemon:
#TODO: Not a proper daemon yet!
self.run_daemon()
Expand All @@ -441,6 +440,13 @@ def hard_cleanup(self):
if x.name in SERVER_NAMES:
print "Deleting: %s" % (x.name)
x.delete()
for x in self.cnx.images.list():
if 'created' in x._info:
if x.name.startswith(BACKUP_PREFIX + "-"):
sname = x.name.replace(BACKUP_PREFIX + '-', "")
if sname in SERVER_NAMES:
print "Deleting: %s" % (x.name)
x.delete()

def ssprint(self, s):
if self.options.verbose:
Expand Down

0 comments on commit cef3799

Please sign in to comment.