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 <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2020-01-25 16:54:39 +01:00
parent 07e57c638f
commit ceb147200a

View File

@ -119,23 +119,21 @@ def generate_job_templates(machines, products, profiles, testsuites):
print("Warning: no profiles for test suite {}".format(name)) print("Warning: no profiles for test suite {}".format(name))
continue continue
for (profile, prio) in suite['profiles'].items(): for (profile, prio) in suite['profiles'].items():
jobtemplate = {'test_suite': {'name': name}, 'prio': prio} jobtemplate = {'test_suite_name': name, 'prio': prio}
# x86_64 compose # x86_64 compose
jobtemplate['group_name'] = 'fedora' jobtemplate['group_name'] = 'fedora'
jobtemplate['machine'] = {'name': profiles[profile]['machine']} jobtemplate['machine_name'] = profiles[profile]['machine']
product = products[profiles[profile]['product']] product = products[profiles[profile]['product']]
jobtemplate['product'] = { jobtemplate['arch'] = product['arch']
'arch': product['arch'], jobtemplate['flavor'] = product['flavor']
'flavor': product['flavor'], jobtemplate['distri'] = product['distri']
'distri': product['distri'], jobtemplate['version']= product['version']
'version': product['version'] if jobtemplate['machine_name'] == 'ppc64le':
}
if jobtemplate['machine']['name'] == 'ppc64le':
if 'updates' in product['flavor']: if 'updates' in product['flavor']:
jobtemplate['group_name'] = "Fedora PowerPC Updates" jobtemplate['group_name'] = "Fedora PowerPC Updates"
else: else:
jobtemplate['group_name'] = "Fedora PowerPC" jobtemplate['group_name'] = "Fedora PowerPC"
elif jobtemplate['machine']['name'] == 'aarch64': elif jobtemplate['machine_name'] == 'aarch64':
if 'updates' in product['flavor']: if 'updates' in product['flavor']:
jobtemplate['group_name'] = "Fedora AArch64 Updates" jobtemplate['group_name'] = "Fedora AArch64 Updates"
else: else: