From bc681d703d8074ba77cd3277ffd5897be2bf1b22 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Fri, 24 Jan 2020 09:34:54 +0100 Subject: [PATCH] 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 --- roles/openqa/server/tasks/main.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/roles/openqa/server/tasks/main.yml b/roles/openqa/server/tasks/main.yml index 3fb3eb628b..8421ebba11 100644 --- a/roles/openqa/server/tasks/main.yml +++ b/roles/openqa/server/tasks/main.yml @@ -279,6 +279,11 @@ changed_when: "admin.rc == 0" 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 shell: "/usr/share/openqa/script/dump_templates --json > /tmp/tmpl-old.json" when: "(gittests is defined) and (gittests is changed)" @@ -286,16 +291,21 @@ # Because of the boring details of how template loading works, getting # a correct 'changed' for this step is too difficult. Instead we have -# the prior and following steps; when the templates actually changed, -# the *following* step will register as changed. -- name: Load main tests +# the dump (above) and check (later) steps; when the templates actually +# changed, the *check* step will register as changed. +- name: Load main tests (upstream format) 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" -- name: Load update tests +- name: Load update tests (upstream format) 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" - name: Check if the tests changed in previous step