From e769a9d2af988524632e7d67594ebf65957bda2e Mon Sep 17 00:00:00 2001 From: Christophe Monniez Date: Fri, 4 Dec 2020 14:49:40 +0100 Subject: [PATCH] [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. --- runbot/models/build_config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runbot/models/build_config.py b/runbot/models/build_config.py index d42afe4f..925ca516 100644 --- a/runbot/models/build_config.py +++ b/runbot/models/build_config.py @@ -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)]