Skip to content

Commit 34ad1fe

Browse files
author
Milan Topuzov
committed
jobrunner: get_db_names supports list-valued config["db_name"]\n\n- Handle upstream config refactor where db_name can be a list\n- Backward compatible with comma-separated string values
1 parent 038c334 commit 34ad1fe

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

queue_job/jobrunner/runner.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,8 +472,19 @@ def from_environ_or_config(cls):
472472
return runner
473473

474474
def get_db_names(self):
475-
if config["db_name"]:
476-
db_names = config["db_name"].split(",")
475+
"""Return the list of database names to manage.
476+
477+
In recent Odoo versions, ``config["db_name"]`` may already be a list
478+
(upstream config refactor). Older setups provide a comma-separated
479+
string. Support both without breaking behavior when unset.
480+
"""
481+
db_name_opt = config["db_name"]
482+
if db_name_opt:
483+
if isinstance(db_name_opt, (list, tuple, set)):
484+
db_names = list(db_name_opt)
485+
else:
486+
# Accept legacy comma-separated string
487+
db_names = [n for n in str(db_name_opt).split(",") if n]
477488
else:
478489
db_names = odoo.service.db.list_dbs(True)
479490
return db_names

0 commit comments

Comments
 (0)