Skip to content

Commit

Permalink
[IMP] runbot: drop all db with build prefix on cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
KangOl committed Aug 19, 2015
1 parent a87710d commit 4d94f45
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions runbot/runbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,8 +1029,15 @@ def skip(self, cr, uid, ids, context=None):

def cleanup(self, cr, uid, ids, context=None):
for build in self.browse(cr, uid, ids, context=context):
self.pg_dropdb(cr, uid, "%s-base" % build.dest)
self.pg_dropdb(cr, uid, "%s-all" % build.dest)
cr.execute("""
SELECT datname
FROM pg_database
WHERE pg_get_userbyid(datdba) = current_user
AND datname LIKE %s
""", [build.dest + '%'])
for db, in cr.fetchall():
self.pg_dropdb(cr, uid, db)

if os.path.isdir(build.path()) and build.result != 'killed':
shutil.rmtree(build.path())

Expand Down

0 comments on commit 4d94f45

Please sign in to comment.