Re: Automating bodhi daily pushes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Okay, fixed.

And as Randy mentioned, we can use this without fixing @2579.

diff --git a/roles/bodhi2/backend/files/bodhi-automated-pushes.py b/roles/bodhi2/backend/files/bodhi-auto
new file mode 100644
index 0000000..aacc81c
--- /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 f76d944..7e37d24 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="" 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 mo
  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="" 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  
diff --git a/roles/bodhi2/backend/templates/bodhi-automated-pushes.cron.j2 b/roles/bodhi2/backend/templat
new file mode 100644
index 0000000..7d440af
--- /dev/null
+++ b/roles/bodhi2/backend/templates/bodhi-automated-pushes.cron.j2
@@ -0,0 +1,5 @@
+{% if Frozen %}
+{{ '#' }}00 00 * * * apache /usr/local/bin/bodhi-automated-pushes.py
+{% else %}
+00 00 * * * apache /usr/local/bin/bodhi-automated-pushes.py
+{% endif %}

On Fri, Oct 5, 2018 at 9:49 AM Randy Barlow <bowlofeggs@xxxxxxxxxxxxxxxxx> wrote:
On Thu, 2018-10-04 at 17:09 -0700, Kevin Fenzi wrote:
> And secondly:
>
> https://github.com/fedora-infra/bodhi/issues/2579
>
> we probibly need at least that bug fixed, although we could put a
> lock
> wrapper around it so it only runs one at a time ever.

Mohan's code did ensure that the len() on the composes was 0, which is
the same thing I would do if I fixed #2579, so I think his code will
work without fixing #2579 (though of course, we should still fix #2579
because that's the right place to fix it ultimately).

+1 to the suggestion of using the Frozen variable.
_______________________________________________
infrastructure mailing list -- infrastructure@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to infrastructure-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/infrastructure@xxxxxxxxxxxxxxxxxxxxxxx
_______________________________________________
infrastructure mailing list -- infrastructure@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to infrastructure-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/infrastructure@xxxxxxxxxxxxxxxxxxxxxxx

[Index of Archives]     [Fedora Development]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux