[PATCH] update owner-sync-pkgdb to support the docker namespace

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

 



From: Dennis Gilmore <ausil@xxxxxxxxxxxxxxxxx>

update the script to sync from pkgdb to koji and enable it via a cronjob

Signed-off-by: Dennis Gilmore <ausil@xxxxxxxxxxxxxxxxx>
---
 roles/bodhi2/backend/tasks/main.yml                |  8 ++++++++
 roles/bodhi2/backend/templates/owner-sync-pkgdb.j2 | 19 ++++++++++++-------
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/roles/bodhi2/backend/tasks/main.yml b/roles/bodhi2/backend/tasks/main.yml
index 421c16f..4fa662e 100644
--- a/roles/bodhi2/backend/tasks/main.yml
+++ b/roles/bodhi2/backend/tasks/main.yml
@@ -188,6 +188,14 @@
         cron_file=update-koji-owner-fedora
   when: inventory_hostname.startswith('bodhi-backend03') and env == "production"
   tags:
+
+  - name: sync packages from pkgdb2 to koji fedor (docker)
+    cron: name="owner-sync-fedora" minute="7,17,27,37,47,57" user="root"
+          job="/usr/local/bin/owner-sync-pkgdb f24-docker;/usr/local/bin/owner-sync-pkgdb f25-docker;/usr/local/bin/owner-sync-pkgdb f26-docker"
+          cron_file=update-koji-owner-fedora-docker
+    when: inventory_hostname.startswith('bodhi-backend03') and env == "production"
+    tags:
+    - bodhi
   - bodhi
 #
 # cron job that syncs updates to master mirror
diff --git a/roles/bodhi2/backend/templates/owner-sync-pkgdb.j2 b/roles/bodhi2/backend/templates/owner-sync-pkgdb.j2
index 38ea282..3423aca 100755
--- a/roles/bodhi2/backend/templates/owner-sync-pkgdb.j2
+++ b/roles/bodhi2/backend/templates/owner-sync-pkgdb.j2
@@ -80,12 +80,17 @@ if __name__ == '__main__':
         print "ERROR: no tag specified!\n"
         usage()
 
-    if tag.startswith('epel'):
-        version = tag.split('epel')[1]
-    elif tag.startswith('f'):
-        version = tag.split('f')[1]
+    if 'docker' in tag:
+        namespace='docker'
+        version = tag.split('-')[0].split('f')[1]
     else:
-        version = tag.split('-')[1][:-1]
+        namespace='rpms'
+        if tag.startswith('epel'):
+            version = tag.split('epel')[1]
+        elif tag.startswith('f'):
+            version = tag.split('f')[1]
+        else:
+            version = tag.split('-')[1][:-1]
 
     data = requests.get(urljoin(BASEURL, 'api/collections'), verify=VERIFY).json()
     branch_names = set()
@@ -109,7 +114,7 @@ if __name__ == '__main__':
         if version == rawhide:
             reponame = 'master'
         else:
-            reponame = tag
+            reponame = tag.split('-')[0]
 {% if env == 'staging' %}
         arches = ["primary"]
 {% else %}
@@ -120,7 +125,7 @@ if __name__ == '__main__':
         sys.exit(1)
 
     data = requests.get(urljoin(BASEURL, 'api/vcs?format=json'), verify=VERIFY).json()
-    acls = data['rpms']
+    acls = data[namespace]
     pkgs = {}
     for pkg_name in acls:
         try:
-- 
1.8.3.1
_______________________________________________
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