FBR: Make new-updates-sync print what it did and email to releng-cron

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

 



Any +1s?


>From a4b55b290d475769c6cdb076d56fca762a0ed289 Mon Sep 17 00:00:00 2001
From: Patrick Uiterwijk <puiterwijk@xxxxxxxxxx>
Date: Wed, 25 Apr 2018 21:53:17 +0200
Subject: [PATCH] Make new-updates-sync always print status and email to
 releng-cron

Signed-off-by: Patrick Uiterwijk <puiterwijk@xxxxxxxxxx>
---
 roles/bodhi2/backend/files/new-updates-sync      | 7 +++++++
 roles/bodhi2/backend/files/new-updates-sync.cron | 3 +++
 roles/bodhi2/backend/tasks/main.yml              | 6 ++----
 3 files changed, 12 insertions(+), 4 deletions(-)
 create mode 100644 roles/bodhi2/backend/files/new-updates-sync.cron

diff --git a/roles/bodhi2/backend/files/new-updates-sync
b/roles/bodhi2/backend/files/new-updates-sync
index de6dca78c..b90c89384 100755
--- a/roles/bodhi2/backend/files/new-updates-sync
+++ b/roles/bodhi2/backend/files/new-updates-sync
@@ -170,6 +170,7 @@ def sync_ostree(dst, ref):
     if src_commit == dst_commit:
         logger.info('OSTree at %s, ref %s in sync', dst, ref)
     else:
+        print('Syncing ostree ref %s -> %s' % (ref, src_commit, dst_commit))
         logger.info('Syncing OSTree to %s, ref %s: %s -> %s',
                     dst, ref, src_commit, dst_commit)
         cmd = ['ostree', 'pull-local', '--verbose', '--repo',
@@ -177,6 +178,7 @@ def sync_ostree(dst, ref):
         out = run_command(cmd)
         cmd = ['ostree', 'summary', '--verbose', '--repo', dst, '--update']
         run_command(cmd)
+        print('Ostree ref %s now at %s' % (ref, dst_commit))


 def update_fullfilelist(modules):
@@ -324,10 +326,15 @@ def sync_single_release(release):
             if curstate and curstate == target:
                 logger.info('This repo has already been synced')
             else:
+                print('Syncing %s %s from %s -> %s' % (release,
+                                                       repo,
+                                                       curstate,
+                                                       target))
                 sync_single_repo(release, repo)
                 with open(curstatefile, 'w') as f:
                     f.write(target)
                 needssync = True
+                print('Synced %s %s to %s' % (release, repo, target))

         for ostree in RELEASES[release]['repos'][repo].get('ostrees', []):
             pairs = []
diff --git a/roles/bodhi2/backend/files/new-updates-sync.cron
b/roles/bodhi2/backend/files/new-updates-sync.cron
new file mode 100644
index 000000000..ec7955827
--- /dev/null
+++ b/roles/bodhi2/backend/files/new-updates-sync.cron
@@ -0,0 +1,3 @@
+MAILTO=releng-cron@xxxxxxxxxxxxxxxxxxxxxxx
+*/5 * * * * ftpsync /usr/local/bin/lock-wrapper updates-push
'/usr/local/bin/new-updates-sync'
+
diff --git a/roles/bodhi2/backend/tasks/main.yml
b/roles/bodhi2/backend/tasks/main.yml
index e33f710ff..ff5117710 100644
--- a/roles/bodhi2/backend/tasks/main.yml
+++ b/roles/bodhi2/backend/tasks/main.yml
@@ -268,10 +268,8 @@
   - bodhi
   - cron

-- name: Updates sync cron job.
-  cron: name="updates-sync" minute="*/5" user="ftpsync"
-        job="/usr/local/bin/lock-wrapper updates-push
'/usr/local/bin/new-updates-sync'"
-        cron_file=updates-sync
+- name: Set the updates sync cron job
+  copy: src=new-updates-sync.cron dest=/etc/cron.d/updates-sync
   when: inventory_hostname.startswith('bodhi-backend01') and env ==
"production"
   tags:
   - config
-- 
2.17.0
_______________________________________________
infrastructure mailing list -- infrastructure@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to infrastructure-leave@xxxxxxxxxxxxxxxxxxxxxxx




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

  Powered by Linux