From 651061ea10280d1158bb225673166f8cede1acc8 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 7 Mar 2016 12:06:41 -0800 Subject: [PATCH] openqa_dispatcher: revise for fedmsg hub consumer ditch the old systemd consumer service, install the fedmsg consumer config file, add some fedmsg-hub reload notifications. --- roles/check-compose/tasks/main.yml | 1 + .../dispatcher/files/openqa_consumer.py | 3 ++ roles/openqa/dispatcher/tasks/main.yml | 28 +++++++++++++------ 3 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 roles/openqa/dispatcher/files/openqa_consumer.py diff --git a/roles/check-compose/tasks/main.yml b/roles/check-compose/tasks/main.yml index 8ebae2c487..aeabdf4b58 100644 --- a/roles/check-compose/tasks/main.yml +++ b/roles/check-compose/tasks/main.yml @@ -31,6 +31,7 @@ dnf: name={{ item }} state=present with_items: - fedfind + - python2-fedmsg-consumers - python-setuptools - python-six tags: diff --git a/roles/openqa/dispatcher/files/openqa_consumer.py b/roles/openqa/dispatcher/files/openqa_consumer.py new file mode 100644 index 0000000000..80bb6160c7 --- /dev/null +++ b/roles/openqa/dispatcher/files/openqa_consumer.py @@ -0,0 +1,3 @@ +config = { + 'fedora_openqa_schedule.consumer.enabled': True, +} diff --git a/roles/openqa/dispatcher/tasks/main.yml b/roles/openqa/dispatcher/tasks/main.yml index 75ef7834c4..37ca622ad3 100644 --- a/roles/openqa/dispatcher/tasks/main.yml +++ b/roles/openqa/dispatcher/tasks/main.yml @@ -25,6 +25,7 @@ dnf: name={{ item }} state=present with_items: - fedfind + - python2-fedmsg-consumers - python2-wikitcms - python-requests - python-setuptools @@ -71,10 +72,8 @@ args: chdir: /root/openqa_fedora_tools-dispatcher/scheduler when: "gittools|changed or not insttools.stat.exists" - -- name: Reload systemd config to pick up installed units - command: "systemctl daemon-reload" - when: "gittools|changed or not insttools.stat.exists" + notify: + - restart fedmsg-hub - name: openQA client config template: src=client.conf.j2 dest=/etc/openqa/client.conf owner=root group=fedmsg mode=0640 @@ -98,10 +97,21 @@ tags: - config -- name: Enable and start consumer - service: name=openqa-consumer.service enabled=yes state=started +- name: Disable and stop old consumer service + service: name=openqa-consumer.service enabled=no state=stopped when: "openqa_consumer is defined and openqa_consumer" -- name: Restart consumer if code changed - service: name=openqa-consumer.service state=restarted - when: "gittools|changed" +- name: Remove old service if present + file: path=/usr/lib/systemd/system/openqa-consumer.service state=absent + register: serviceremove + +- name: Reload systemd to remove old service if removed + command: "systemctl daemon-reload" + when: "serviceremove|changed" + +- name: Enable fedmsg consumer + copy: src=openqa_consumer.py dest=/etc/fedmsg.d/openqa_consumer.py openqa_consumer.py + notify: + - restart fedmsg-hub + tags: + - config