diff options
-rw-r--r-- | templates/base/agl-base.jinja2 | 2 | ||||
-rw-r--r-- | templates/base/agl-callback-section.jinja2 | 9 | ||||
-rw-r--r-- | templates/base/agl-callback-subsection.jinja2 | 5 | ||||
-rw-r--r-- | templates/base/agl-callback.jinja2 | 11 | ||||
-rw-r--r-- | utils/agljobtemplate.py | 10 | ||||
-rwxr-xr-x | utils/create-jobs.py | 2 |
6 files changed, 22 insertions, 17 deletions
diff --git a/templates/base/agl-base.jinja2 b/templates/base/agl-base.jinja2 index 07bf168..fddda12 100644 --- a/templates/base/agl-base.jinja2 +++ b/templates/base/agl-base.jinja2 @@ -4,7 +4,7 @@ {% include 'base/agl-metadata.jinja2' %} {% endblock %} {% if do_callback %} -{% include 'base/agl-callback.jinja2' %} +{% include 'base/agl-callback-section.jinja2' %} {% endif %} {%- block main %} device_type: {{ device_type }} diff --git a/templates/base/agl-callback-section.jinja2 b/templates/base/agl-callback-section.jinja2 new file mode 100644 index 0000000..44987b2 --- /dev/null +++ b/templates/base/agl-callback-section.jinja2 @@ -0,0 +1,9 @@ +{%- block notify -%} +notify: + criteria: + status: finished + callbacks: +{%-for callback_to in callback_to_list %} +{% include 'base/agl-callback-subsection.jinja2' %} +{%- endfor %} +{%- endblock %} diff --git a/templates/base/agl-callback-subsection.jinja2 b/templates/base/agl-callback-subsection.jinja2 new file mode 100644 index 0000000..c8c7db9 --- /dev/null +++ b/templates/base/agl-callback-subsection.jinja2 @@ -0,0 +1,5 @@ + - url: {{ callback_to.backend_fqdn }}/callback/lava/test?lab_name={{ callback_to.lab_name }}&status={STATUS}&status_string={STATUS_STRING} + method: POST + dataset: all + token: {{ callback_to.lab_token }} + content-type: json diff --git a/templates/base/agl-callback.jinja2 b/templates/base/agl-callback.jinja2 deleted file mode 100644 index b5d3e5e..0000000 --- a/templates/base/agl-callback.jinja2 +++ /dev/null @@ -1,11 +0,0 @@ -{%- block notify -%} -notify: - criteria: - status: finished - callbacks: - - url: {{ backend_fqdn }}/callback/lava/test?lab_name={{ lab_name }}&status={STATUS}&status_string={STATUS_STRING} - method: POST - dataset: all - token: {{ lab_token }} - content-type: json -{%- endblock %} 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 diff --git a/utils/create-jobs.py b/utils/create-jobs.py index 384d935..10a26b6 100755 --- a/utils/create-jobs.py +++ b/utils/create-jobs.py @@ -30,7 +30,7 @@ def parse_cmdline(machines, tests, rfs_types): parser.add_argument('--callback-from', action='store', dest='callback_from', help='The LAVA lab (name) that will be responsible of doing the callback. ' 'Please read: ./templates/callback/callback_readme.txt') - parser.add_argument('--callback-to', action='store', dest='callback_to', + parser.add_argument('--callback-to', nargs='+', action='store', dest='callback_to', help='The KernelCI instance (name) that will receive the callback from LAVA. ' 'Please read: ./templates/callback/callback_readme.txt') parser.add_argument('--test', dest='tests', action='store', choices=tests + ['all'], |