[sysadmin-bin] add untested code for usage with bugzilla 4.4 + GNOME extension



commit 34062955e22916c6ce9b29d30376b3a3a9f2f170
Author: Olav Vitters <olav vitters nl>
Date:   Mon Jan 19 10:55:02 2015 +0100

    add untested code for usage with bugzilla 4.4 + GNOME extension

 ftpadmin |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/ftpadmin b/ftpadmin
index 05b7343..2eb9920 100755
--- a/ftpadmin
+++ b/ftpadmin
@@ -25,6 +25,7 @@ from email.mime.text import MIMEText
 from email.header import Header
 from email.utils import formataddr
 import json
+import xmlrpclib
 try:
     from cStringIO import StringIO
 except ImportError:
@@ -41,6 +42,10 @@ sys.path.insert(0, script_dir)
 import semi_rdf
 
 DEBUG=True
+
+# CHANGE THIS TO TRUE AFTER BUGZILLA UPGRADE!!!
+BUGZILARPC=False
+
 # Protection, only ovitters should be using debug mode:
 if os.environ['USER'] != 'ovitters':
     DEBUG=False
@@ -1121,8 +1126,19 @@ Install %s? [Y/n]""" % self.module,
             products = [self.module]
         for product in products:
             sys.stdout.write(" - Adding new version to GNOME Bugzilla")
-            cmd = ['/usr/bin/curl', '-q', '-L', 'https://bugzilla.gnome.org/add-version.cgi?%s|%s' % 
(product, self.version)]
-            self._call_cmd(cmd)
+            if BUGZILLARPC:
+                server = xmlrpclib.ServerProxy('https://bugzilla.gnome.org/xmlrpc.cgi')
+                try:
+                    result = server.GNOME.addversionx({'product': product, 'version': self.version})
+                except xmlrpclib.Fault, e:
+                    print "FAILED (%s)" % e.faultString
+                except Exception, e:
+                    print "FAILED (%s)" % e.strerror
+                else:
+                    print result
+            else:
+                cmd = ['/usr/bin/curl', '-q', '-L', 'https://bugzilla.gnome.org/add-version.cgi?%s|%s' % 
(product, self.version)]
+                self._call_cmd(cmd)
 
         sys.stdout.write(" - Triggering ftp.gnome.org update")
         cmd = ['/usr/local/bin/signal-ftp-sync']


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