[FIX] runbot: improve the way a database name is choosen for running

When a build is reaching the run_run_odoo step, a database has to be
set. If none are found in the build params, the one from the last step
is choosen. Historically, the last one in the `Split` config was `all`
but now, the last one is `base`.

With this commit, if none are found in build params, `all` is choosen if
found in any install config steps. As a default, the one from the first
step is choosen.
This commit is contained in:
Christophe Monniez 2020-12-04 14:49:40 +01:00 committed by xdo
parent 8c625278c3
commit e769a9d2af

View File

@ -322,7 +322,8 @@ class ConfigStep(models.Model):
# not sure, to avoid old server to check other dbs
cmd += ["--max-cron-threads", "0"]
db_name = build.params_id.config_data.get('db_name') or [step.db_name for step in build.params_id.config_id.step_ids() if step.job_type == 'install_odoo'][-1]
install_steps = [step.db_name for step in build.params_id.config_id.step_ids() if step.job_type == 'install_odoo']
db_name = build.params_id.config_data.get('db_name') or 'all' in install_steps and 'all' or install_steps[0]
# we need to have at least one job of type install_odoo to run odoo, take the last one for db_name.
cmd += ['-d', '%s-%s' % (build.dest, db_name)]