manager_PYTHON = \
src/manager/__init__.py \
src/manager/base.py \
- src/manager/bugs.py \
src/manager/builds.py \
src/manager/repositories.py \
src/manager/sources.py
self.call("update", ids=[self.id,], **kwargs)
-
class Bugzilla(base.Object):
def __init__(self, pakfire):
def get_bug(self, bug_id):
try:
bug = BugzillaBug(self, bug_id)
- s = bug.status
except xmlrpclib.Fault:
return None
bugs.append(bug)
return bugs
+
+ def send_all(self, limit=100):
+ # Get up to ten updates.
+ query = self.db.query("SELECT * FROM builds_bugs_updates \
+ WHERE error IS FALSE ORDER BY time LIMIT %s", limit)
+
+ # XXX CHECK IF BZ IS ACTUALLY REACHABLE AND WORKING
+
+ for update in query:
+ try:
+ bug = self.backend.bugzilla.get_bug(update.bug_id)
+ if not bug:
+ logging.error("Bug #%s does not exist." % update.bug_id)
+ continue
+
+ # Set the changes.
+ bug.set_status(update.status, update.resolution, update.comment)
+
+ except Exception, e:
+ # If there was an error, we save that and go on.
+ self.db.execute("UPDATE builds_bugs_updates SET error = 'Y', error_msg = %s \
+ WHERE id = %s", "%s" % e, update.id)
+
+ else:
+ # Remove the update when it has been done successfully.
+ self.db.execute("DELETE FROM builds_bugs_updates WHERE id = %s", update.id)
# Send queued emails once a minute
* * * * * nobody pakfire-build-service process-message-queue &>/dev/null
+# Send updates to Bugzilla
+*/5 * * * * nobody pakfire-build-service send-bug-updates &>/dev/null
+
# Cleanup timed-out uploads
0 */6 * * * nobody pakfire-build-service cleanup-uploads &>/dev/null
from . import base
-from .bugs import BugsUpdateEvent
from .builds import BuildsFailedRestartEvent, CheckBuildDependenciesEvent
from .builds import CreateTestBuildsEvent, DistEvent
from .repositories import RepositoriesUpdateEvent
+++ /dev/null
-#!/usr/bin/python
-
-import logging
-
-from . import base
-
-class BugsUpdateEvent(base.Event):
- # User feedback gets a high priority.
- priority = 1
-
- @property
- def interval(self):
- return self.pakfire.settings.get_int("bugzilla_update_interval", 60)
-
- def run(self):
- # Get up to ten updates.
- query = self.db.query("SELECT * FROM builds_bugs_updates \
- WHERE error = 'N' ORDER BY time")
-
- # XXX CHECK IF BZ IS ACTUALLY REACHABLE AND WORKING
-
- for update in query:
- try:
- bug = self.pakfire.bugzilla.get_bug(update.bug_id)
- if not bug:
- logging.error("Bug #%s does not exist." % update.bug_id)
- continue
-
- # Set the changes.
- bug.set_status(update.status, update.resolution, update.comment)
-
- except Exception, e:
- # If there was an error, we save that and go on.
- self.db.execute("UPDATE builds_bugs_updates SET error = 'Y', error_msg = %s \
- WHERE id = %s", "%s" % e, update.id)
-
- else:
- # Remove the update when it has been done successfully.
- self.db.execute("DELETE FROM builds_bugs_updates WHERE id = %s", update.id)
# Sends all queued messages
"process-message-queue" : self.backend.messages.process_queue,
+
+ # Send bug updates to Bugzilla
+ "send-bug-updates" : self.backend.bugzilla.send_all,
}
def __call__(self, *args):