From 054523569896178e4939766bbd70b34472945441 Mon Sep 17 00:00:00 2001 From: Loys Ollivier Date: Wed, 5 Dec 2018 14:08:25 +0100 Subject: templates: callbacks: support multiple callback targets LAVA jobs can now submit multiple callbacks per job. Update the create-jobs tool and its underlying templates to support this feature. - Callback templates are now split in two file and follow LAVA specification: 'section' and 'subsection'. - create-jobs tool supports multiple arguments for the '--callback-to' option. - Default configuration for callback targets can now be a list of targets. Change-Id: I36c502c0bb5b54010ce32a53ba78a6be5e6a1642 Signed-off-by: Loys Ollivier --- utils/agljobtemplate.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'utils/agljobtemplate.py') diff --git a/utils/agljobtemplate.py b/utils/agljobtemplate.py index 8597fee..2307ffc 100644 --- a/utils/agljobtemplate.py +++ b/utils/agljobtemplate.py @@ -31,7 +31,10 @@ def parse_callback_file(template_path, lava_callback, kci_callback): cfg.read(callback_file_path) if kci_callback is None: kci_callback = cfg.get('default', 'section') - cb_data = dict(cfg.items(kci_callback)) + kci_callback = kci_callback.split(',') + cb_data = [] + for callback_target in kci_callback: + cb_data.append(dict(cfg.items(callback_target))) return cb_data except (ConfigParser.NoSectionError) as err: str_err = "'--callback-to {}': must correspond to a section [{}] in the file '{}.cfg'".format( @@ -161,7 +164,7 @@ class Agljobtemplate(object): job['kernel_version'] = kernel_version elif build_version_default: job['kernel_version'] = build_version_default - + if url_branch: vcs_branch = url_branch # if this is an 'int', then it was --changeid @@ -188,8 +191,7 @@ class Agljobtemplate(object): if lava_callback: job['do_callback'] = True - callback_data = parse_callback_file(self._template_path, lava_callback, kci_callback) - job.update(callback_data) + job['callback_to_list'] = parse_callback_file(self._template_path, lava_callback, kci_callback) env = jinja2.Environment(loader=jinja2.FileSystemLoader(self._template_path)) env.filters['get_extension'] = get_extension -- cgit 1.2.3-korg