From ceb147200af186b71b5267f5ecf612e7ba5371e5 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Sat, 25 Jan 2020 16:54:39 +0100 Subject: [PATCH] fifloader: Simplify generated job templates a bit Again looking at the upstream template loader, we don't need to pass a 'machine' hash with a 'name' key (we can just pass a 'machine_name' string), or a 'test_suite' hash with a 'name' key (we can just pass 'test_suite_name' string), and we don't need to pass a 'product' hash, we can just pass the product keys directly in the job template hash. In fact the upstream loader transforms 'machine' and 'test_suite' hash 'name' keys into the strings and moves 'product' hash keys up into the top level hash before POSTing to the API anyway. Signed-off-by: Adam Williamson --- fifloader | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/fifloader b/fifloader index 2c8d0f2e..a9aa78d0 100755 --- a/fifloader +++ b/fifloader @@ -119,23 +119,21 @@ def generate_job_templates(machines, products, profiles, testsuites): print("Warning: no profiles for test suite {}".format(name)) continue for (profile, prio) in suite['profiles'].items(): - jobtemplate = {'test_suite': {'name': name}, 'prio': prio} + jobtemplate = {'test_suite_name': name, 'prio': prio} # x86_64 compose jobtemplate['group_name'] = 'fedora' - jobtemplate['machine'] = {'name': profiles[profile]['machine']} + jobtemplate['machine_name'] = profiles[profile]['machine'] product = products[profiles[profile]['product']] - jobtemplate['product'] = { - 'arch': product['arch'], - 'flavor': product['flavor'], - 'distri': product['distri'], - 'version': product['version'] - } - if jobtemplate['machine']['name'] == 'ppc64le': + jobtemplate['arch'] = product['arch'] + jobtemplate['flavor'] = product['flavor'] + jobtemplate['distri'] = product['distri'] + jobtemplate['version']= product['version'] + if jobtemplate['machine_name'] == 'ppc64le': if 'updates' in product['flavor']: jobtemplate['group_name'] = "Fedora PowerPC Updates" else: jobtemplate['group_name'] = "Fedora PowerPC" - elif jobtemplate['machine']['name'] == 'aarch64': + elif jobtemplate['machine_name'] == 'aarch64': if 'updates' in product['flavor']: jobtemplate['group_name'] = "Fedora AArch64 Updates" else: