openqa/server: handle FIF format template loading

We just invented a new format for openQA templates. This makes
the openqa/server role handle loading templates in either format.
I'll remove old-format loading when we're done tweaking the new
setup and it's deployed to prod.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2020-01-24 09:34:54 +01:00 committed by Pierre-Yves Chibon
parent 180b084491
commit bc681d703d

View file

@ -279,6 +279,11 @@
changed_when: "admin.rc == 0" changed_when: "admin.rc == 0"
failed_when: "(admin.rc > 0) and (admin.stderr is not defined or admin.stderr.find('already exists') == -1)" failed_when: "(admin.rc > 0) and (admin.stderr is not defined or admin.stderr.find('already exists') == -1)"
- name: Check if we're on upstream template format or FIF
stat:
path: /var/lib/openqa/share/tests/fedora/templates.fif.json
register: templatesfif
- name: Dump existing config for checking changes - name: Dump existing config for checking changes
shell: "/usr/share/openqa/script/dump_templates --json > /tmp/tmpl-old.json" shell: "/usr/share/openqa/script/dump_templates --json > /tmp/tmpl-old.json"
when: "(gittests is defined) and (gittests is changed)" when: "(gittests is defined) and (gittests is changed)"
@ -286,16 +291,21 @@
# Because of the boring details of how template loading works, getting # Because of the boring details of how template loading works, getting
# a correct 'changed' for this step is too difficult. Instead we have # a correct 'changed' for this step is too difficult. Instead we have
# the prior and following steps; when the templates actually changed, # the dump (above) and check (later) steps; when the templates actually
# the *following* step will register as changed. # changed, the *check* step will register as changed.
- name: Load main tests - name: Load main tests (upstream format)
command: "/var/lib/openqa/share/tests/fedora/templates --clean" command: "/var/lib/openqa/share/tests/fedora/templates --clean"
when: "(gittests is defined) and (gittests is changed)" when: "(gittests is defined) and (gittests is changed) and (templatesfif.stat.exists == false)"
changed_when: "1 != 1" changed_when: "1 != 1"
- name: Load update tests - name: Load update tests (upstream format)
command: "/var/lib/openqa/share/tests/fedora/templates-updates --update" command: "/var/lib/openqa/share/tests/fedora/templates-updates --update"
when: "(gittests is defined) and (gittests is changed)" when: "(gittests is defined) and (gittests is changed) and (templatesfif.stat.exists == false)"
changed_when: "1 != 1"
- name: Load all tests (FIF format)
command: "/var/lib/openqa/share/tests/fedora/fifloader -l --clean templates.fif.json templates-updates.fif.json"
when: "(gittests is defined) and (gittests is changed) and (templatesfif.stat.exists == true)"
changed_when: "1 != 1" changed_when: "1 != 1"
- name: Check if the tests changed in previous step - name: Check if the tests changed in previous step