[FIX] runbot: only kill builds on same host

This commit is contained in:
Christophe Simonis 2017-03-10 11:51:27 +01:00
parent 12691bdbcd
commit f242db17b3
2 changed files with 4 additions and 5 deletions

View File

@ -436,10 +436,7 @@ class runbot_repo(osv.osv):
_logger.debug('failed to start nginx - failed to kill orphan worker - oh well')
def killall(self, cr, uid, ids=None, context=None):
# kill switch
Build = self.pool['runbot.build']
build_ids = Build.search(cr, uid, [('state', 'not in', ['done', 'pending'])])
Build.kill(cr, uid, build_ids)
return
def cron(self, cr, uid, ids=None, context=None):
ids = self.search(cr, uid, [('mode', '!=', 'disabled')], context=context)
@ -1220,7 +1217,10 @@ class runbot_build(osv.osv):
self._local_pg_dropdb(cr, uid, db)
def kill(self, cr, uid, ids, result=None, context=None):
host = fqdn()
for build in self.browse(cr, uid, ids, context=context):
if build.host != host:
continue
build._log('kill', 'Kill build %s' % build.dest)
build.logger('killing %s', build.pid)
try:

View File

@ -15,7 +15,6 @@
<h1><field name="name" class="oe_inline"/></h1>
<button name="update" type="object" string="Update" groups="runbot.group_runbot_admin"/>
<button name="cron" type="object" string="Cron" groups="runbot.group_runbot_admin"/>
<button name="killall" type="object" string="Killall" groups="runbot.group_runbot_admin"/>
</div>
<group string="Params">
<field name="sequence"/>