diff --git a/roles/bodhi2/backend/files/bodhi-automated-pushes.py b/roles/bodhi2/backend/files/bodhi-automated-pushes.py new file mode 100644 index 0000000000..aacc81cfb1 --- /dev/null +++ b/roles/bodhi2/backend/files/bodhi-automated-pushes.py @@ -0,0 +1,12 @@ +import requests +import json +import subprocess +import logging + +req = requests.get('https://bodhi.fedoraproject.org/composes/') +bodhi_composes = req.json() + +if len(bodhi_composes['composes']) == 0: + bodhi_push_cmd = ["bodhi-push", "--username", "releng"] + push = subprocess.Popen(bodhi_push_cmd, stdout=PIPE, stderr=PIPE, stdin=PIPE) + push.stdin.write('y') diff --git a/roles/bodhi2/backend/tasks/main.yml b/roles/bodhi2/backend/tasks/main.yml index c1cf4f5f8a..9dda7b25a3 100644 --- a/roles/bodhi2/backend/tasks/main.yml +++ b/roles/bodhi2/backend/tasks/main.yml @@ -264,6 +264,14 @@ - bodhi - cron +- name: put bodhi-automated-pushes.py in place + copy: src=bodhi-automated-pushes.py dest=/usr/local/bin/bodhi-automated-pushes.py mode=0755 + when: inventory_hostname.startswith('bodhi-backend01') and env == "production" + tags: + - config + - bodhi + - cron + - name: put update-fullfiletimelist in place copy: src="{{ files }}/scripts/update-fullfiletimelist" dest=/usr/local/bin/update-fullfiletimelist mode=0755 when: inventory_hostname.startswith('bodhi-backend01') and env == "production" @@ -288,6 +296,14 @@ - bodhi - cron +- name: Set the bodhi-automated-pushes cron job + template: src=bodhi-automated-pushes.cron.j2 dest=/etc/cron.d/bodhi-automated-pushes + when: inventory_hostname.startswith('bodhi-backend01') and env == "production" + tags: + - config + - bodhi + - cron + - name: directory sizes update cron job. cron: name="directory-sizes-update" minute="30" hour="19" user="ftpsync" job="/usr/bin/find /pub/alt/ /pub/archive/ /pub/fedora-secondary/ /pub/fedora/ /pub/epel/ -type d ! -path '/pub/alt/screenshots/f21/source' | grep -v snapshot | /usr/bin/xargs -n 1 /usr/bin/du --exclude=.snapshot -sh > /tmp/DIRECTORY_SIZES.txt 2> /dev/null; cp /tmp/DIRECTORY_SIZES.txt /pub/" diff --git a/roles/bodhi2/backend/templates/bodhi-automated-pushes.cron.j2 b/roles/bodhi2/backend/templates/bodhi-automated-pushes.cron.j2 new file mode 100644 index 0000000000..fd83ee60ae --- /dev/null +++ b/roles/bodhi2/backend/templates/bodhi-automated-pushes.cron.j2 @@ -0,0 +1,5 @@ +{% if RelEngFrozen %} +{{ '#' }}00 00 * * * apache /usr/local/bin/bodhi-automated-pushes.py +{% else %} +00 00 * * * apache /usr/local/bin/bodhi-automated-pushes.py +{% endif %} diff --git a/vars/all/RelEngFrozen.yaml b/vars/all/RelEngFrozen.yaml new file mode 100644 index 0000000000..5836689199 --- /dev/null +++ b/vars/all/RelEngFrozen.yaml @@ -0,0 +1 @@ +RelEngFrozen: False