From 33fae65883ace5f5b343ffd86bec78a0aea4bb28 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Wed, 19 Oct 2016 11:17:58 -0700 Subject: [PATCH] openqa: adjust to new 'fixed' asset stuff on staging The capability to handle a variance between prod and staging here is just temporary while I'm testing the new fixed asset handling stuff by deploying it on staging. Once it's tested and merged we'll just have prod and staging do the same thing. But for now we need to cleanly handle them having the static disk images in different places. --- inventory/group_vars/openqa-stg | 4 ++++ roles/openqa/server/defaults/main.yml | 1 + roles/openqa/server/tasks/main.yml | 10 ++++++++-- .../{files/createhdds => templates/createhdds.j2} | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 roles/openqa/server/defaults/main.yml rename roles/openqa/server/{files/createhdds => templates/createhdds.j2} (77%) diff --git a/inventory/group_vars/openqa-stg b/inventory/group_vars/openqa-stg index 4f62527782..1cd973d9c7 100644 --- a/inventory/group_vars/openqa-stg +++ b/inventory/group_vars/openqa-stg @@ -28,6 +28,10 @@ openqa_dbuser: openqastg openqa_dbpassword: "{{ stg_openqa_dbpassword }}" openqa_assetsize: 300 +# this is a temporary variance between staging and prod while +# testing https://github.com/os-autoinst/openQA/pull/945 +openqa_fixed: /var/lib/openqa/share/factory/hdd/fixed + openqa_key: "{{ stg_openqa_apikey }}" openqa_secret: "{{ stg_openqa_apisecret }}" diff --git a/roles/openqa/server/defaults/main.yml b/roles/openqa/server/defaults/main.yml new file mode 100644 index 0000000000..8003a1d58a --- /dev/null +++ b/roles/openqa/server/defaults/main.yml @@ -0,0 +1 @@ +openqa_fixed: /var/lib/openqa/share/factory/hdd diff --git a/roles/openqa/server/tasks/main.yml b/roles/openqa/server/tasks/main.yml index d3961b1cf5..109c4c18ed 100644 --- a/roles/openqa/server/tasks/main.yml +++ b/roles/openqa/server/tasks/main.yml @@ -16,6 +16,11 @@ # - external_hostname ## string - The public hostname for the server (will be used as ServerName) ## default - ansible_nodename +# - openqa_fixed +## string - location for fixed hdd assets; this varies depending on +## what openQA version is in use. This is a temporary thing +## while we're testing PR #945 on staging +## default - /var/lib/openqa/share/factory/hdd # Optional vars # - openqa_static_uid @@ -128,16 +133,17 @@ with_items: - /var/lib/openqa/share/factory/iso - /var/lib/openqa/share/factory/hdd + - /var/lib/openqa/share/factory/hdd/fixed - /var/lib/openqa/share/factory/repo - /var/lib/openqa/share/factory/other - name: Set up createhdds cron job - copy: src=createhdds dest=/etc/cron.daily/createhdds owner=root group=root mode=0755 + template: src=createhdds.j2 dest=/etc/cron.daily/createhdds owner=root group=root mode=0755 - name: Check if any hard disk images need (re)building command: "/root/openqa_fedora_tools/tools/createhdds.py check" args: - chdir: /var/lib/openqa/share/factory/hdd/ + chdir: "{{ openqa_fixed }}" register: diskcheck failed_when: "1 != 1" changed_when: "1 != 1" diff --git a/roles/openqa/server/files/createhdds b/roles/openqa/server/templates/createhdds.j2 similarity index 77% rename from roles/openqa/server/files/createhdds rename to roles/openqa/server/templates/createhdds.j2 index 1ba6bd8334..39724acbf6 100644 --- a/roles/openqa/server/files/createhdds +++ b/roles/openqa/server/templates/createhdds.j2 @@ -1,4 +1,4 @@ #!/bin/sh -cd /var/lib/openqa/share/factory/hdd +cd {{ openqa_fixed }} LIBGUESTFS_BACKEND=direct withlock /var/lock/createhdds.lock /root/openqa_fedora_tools/tools/createhdds.py all --clean