mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[IMP] runbot: drop all db with build prefix on cleanup
This commit is contained in:
parent
b15a66dd16
commit
bab6221882
@ -1029,8 +1029,15 @@ class runbot_build(osv.osv):
|
|||||||
|
|
||||||
def cleanup(self, cr, uid, ids, context=None):
|
def cleanup(self, cr, uid, ids, context=None):
|
||||||
for build in self.browse(cr, uid, ids, context=context):
|
for build in self.browse(cr, uid, ids, context=context):
|
||||||
self.pg_dropdb(cr, uid, "%s-base" % build.dest)
|
cr.execute("""
|
||||||
self.pg_dropdb(cr, uid, "%s-all" % build.dest)
|
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':
|
if os.path.isdir(build.path()) and build.result != 'killed':
|
||||||
shutil.rmtree(build.path())
|
shutil.rmtree(build.path())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user