[FIX] runbot: forbid wake-up on dead builds

When a build is completely dead, with directory and db deleted, the
wake-up system fails.

With this commit, a wake-up is not allowed on such dead builds.
This commit is contained in:
Christophe Monniez 2019-07-19 13:56:19 +02:00
parent c3e23532be
commit dcf3297bff

View File

@ -543,6 +543,9 @@ class runbot_build(models.Model):
if docker_is_running(build._get_docker_name()):
build.write({'requested_action': False, 'local_state': 'running'})
build._log('wake_up', 'Waking up failed, docker is already running', level='SEPARATOR')
elif not os.path.exists(build._path()):
build.write({'requested_action': False, 'local_state': 'done'})
build._log('wake_up', 'Impossible to wake-up, build dir does not exists anymore', level='SEPARATOR')
else:
log_path = build._path('logs', 'wake_up.txt')
build.write({'job_start': now(), 'job_end': False, 'active_step': False, 'requested_action': False, 'local_state': 'running'})