diff options
author | Loys Ollivier <lollivier@baylibre.com> | 2017-11-08 10:59:53 +0100 |
---|---|---|
committer | Loys Ollivier <lollivier@baylibre.com> | 2017-11-08 14:46:36 +0100 |
commit | 798580a53aa3537f0c1127ed258dab21a92f5665 (patch) | |
tree | 7910473ac2e67f30ed03ee7d0037d91c00093e32 /utils | |
parent | 94e09df869c8e6a6ed739a94fbca54348b51705f (diff) |
Callback procedure update
New callback procedure. Now the arguments are:
- '--callback-from' LAVA lab
- '--callback-to' kCI instance
This new procedure helps differentiating the lab and the kCI target.
Callback config files updated accordingly.
Documentation on callback updated.
Change-Id: I41b9dc86e33783f1d6a8164fc783557c81678c7f
Signed-off-by: Loys Ollivier <lollivier@baylibre.com>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/agljobtemplate.py | 29 | ||||
-rwxr-xr-x | utils/create-jobs.py | 11 |
2 files changed, 25 insertions, 15 deletions
diff --git a/utils/agljobtemplate.py b/utils/agljobtemplate.py index be46e92..381f7f4 100644 --- a/utils/agljobtemplate.py +++ b/utils/agljobtemplate.py @@ -20,15 +20,21 @@ def parse_url_file(template_path, url_file, url_type): except IOError: raise IOError, "Unable to read from file {}".format(url_file_path) -def parse_callback_file(template_path, callback_file, job): - callback_file_path = template_path + '/callback/' + callback_file + '.cfg' +def parse_callback_file(template_path, lava_callback, kci_callback): + callback_file_path = template_path + '/callback/' + lava_callback + '.cfg' try: with open(callback_file_path): cfg = ConfigParser.ConfigParser() cfg.read(callback_file_path) - job['backend_fqdn'] = cfg.get('default', 'backend_fqdn') - job['lab_name'] = cfg.get('default', 'lab_name') - job['lab_token'] = cfg.get('default', 'lab_token') + if kci_callback is None: + kci_callback = cfg.get('default', 'section') + cb_data = dict(cfg.items(kci_callback)) + return cb_data + except ConfigParser.NoSectionError: + str_err = "Please make sure: --callback-to " + kci_callback + str_err += " is correct and corresponds to a section in: " + str_err += lava_callback + ".cfg" + raise ConfigParser.NoSectionError, str_err except IOError: raise IOError, "Unable to read from file {}".format(callback_file_path) @@ -71,7 +77,8 @@ class Agljobtemplate(object): def render_job(self, url, machine, url_branch=None, url_version=None, job_name="AGL-short-smoke", priority="medium", tests=[], rfs_type=None, - kci_callback=None, rfs_image=None, kernel_image=None, dtb_image=None, modules_image=None, + lava_callback=None, kci_callback=None, + rfs_image=None, kernel_image=None, dtb_image=None, modules_image=None, build_version=None): test_templates = [] @@ -134,12 +141,10 @@ class Agljobtemplate(object): if modules_image is not None: job['modules'] = modules_image - if kci_callback: - if test_templates: - job['callback_name'] = 'lava/test' - else: - job['callback_name'] = 'lava/boot' - parse_callback_file(self._template_path, kci_callback, job) + if lava_callback: + job['do_callback'] = True + callback_data = parse_callback_file(self._template_path, lava_callback, kci_callback) + job.update(callback_data) 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 67afe4c..5a146c4 100755 --- a/utils/create-jobs.py +++ b/utils/create-jobs.py @@ -24,8 +24,12 @@ def parse_cmdline(machines, tests, rfs_types): help='The version (or patchset) to generate the job for.') parser.add_argument('--boot', action='store', dest='rfs_type', choices=rfs_types, help='select boot type') - parser.add_argument('--callback', action='store', dest='callback', - help='url to notify when job is done. Please read: ./templates/callback/callback_readme.txt') + 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', + 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'], help="add these test to the job", nargs='*', default=[]) parser.add_argument('-o', '--output', dest='job_file', action='store', @@ -72,7 +76,8 @@ def main(): job = ajt.render_job(url=args.url, url_branch=args.url_branch, url_version=args.url_version, machine=args.machine, tests=args.tests, priority=args.priority, - rfs_type=args.rfs_type, job_name=args.job_name, kci_callback=args.callback, + rfs_type=args.rfs_type, job_name=args.job_name, + lava_callback=args.callback_from, kci_callback=args.callback_to, rfs_image=args.rootfs_img, kernel_image=args.kernel_img, dtb_image=args.dtb_img, |