4 commits - bodhi/controllers.py bodhi/__init__.py bodhi/templates bodhi/util.py
by Luke Macken
bodhi/__init__.py | 2 -
bodhi/controllers.py | 64 ++++++++++++++++++++++++-----------------------
bodhi/templates/form.kid | 18 -------------
bodhi/util.py | 6 ++--
4 files changed, 38 insertions(+), 52 deletions(-)
New commits:
commit 725efbb64fc15c5fb933e4f16a06771f2ea7279d
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Aug 22 12:31:10 2008 -0400
Put the full update url into bugzilla comments
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index 37134fc..744f504 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -379,6 +379,7 @@ class Root(controllers.RootController):
'autokarma' : update.builds[0].package.stable_karma != 0 and
update.builds[0].package.unstable_karma != 0,
}
+ log.debug("values = %s" % values)
if update.status == 'testing':
flash("Editing this update will move it back to a pending state.")
return dict(form=update_form, values=values, action=url("/save"),
@@ -684,7 +685,8 @@ class Root(controllers.RootController):
# Add/remove the necessary Bugzillas
try:
update.update_bugs(bugs)
- except xmlrpclib.Fault:
+ except xmlrpclib.Fault, f:
+ log.exception(f)
note.insert(0, "Unable to access one or more bugs")
# If there are any security bugs, make sure this update is
@@ -713,7 +715,7 @@ class Root(controllers.RootController):
bug.add_comment(update,
"%s has been submitted as an update for %s.\n%s" %
(update.title, release.long_name,
- url(update.get_url())))
+ config.get('base_address') + url(update.get_url())))
# If a request is specified, make it. By default we're submitting
# new updates directly into testing
commit 1c884253d66c168d81c600307e64e4c18700a31b
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Aug 22 12:25:46 2008 -0400
Fix a bug in bodhi.util.make_update_link
diff --git a/bodhi/util.py b/bodhi/util.py
index 34efc3d..d618c46 100644
--- a/bodhi/util.py
+++ b/bodhi/util.py
@@ -129,12 +129,12 @@ def authorized_user(update, identity):
def make_update_link(obj):
""" Return a link Element for a given PackageUpdate or PackageBuild """
update = None
- if hasattr(obj, 'get_url'): # PackageUpdate
+ if hasattr(obj, 'updates'): # Package or PackageBuild
+ update = obj.updates[0]
+ elif hasattr(obj, 'get_url'): # PackageUpdate
update = obj
elif hasattr(obj, 'update'): # Comment
update = obj.update
- elif hasattr(obj, 'updates'): # Package
- update = obj.updates[0]
else:
log.error("Unknown parameter make_update_link(%s)" % obj)
return None
commit e2f7fbba21bd6234668cbd82d9700b29a0d477eb
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Aug 22 12:25:32 2008 -0400
Disable our fancy obsoletion dialog, as it is not really that useful anymore
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index 6cd08de..37134fc 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -947,35 +947,35 @@ class Root(controllers.RootController):
raise redirect(update.get_url())
return dict(form=self.ok_cancel_form, nvr=nvr)
- @expose(template='bodhi.templates.obsolete')
- def obsolete_dialog(self, update):
- from bodhi.widgets import ObsoleteForm
- package = Package.byName('-'.join(update.split('-')[:-2]))
- builds = filter(lambda x: x.updates[0].status in ('testing', 'pending'),
- package.builds)
- if not len(builds):
- return dict(dialog=None)
- return dict(dialog=ObsoleteForm(builds))
-
- @expose("json")
- def obsolete(self, updates, *args, **kw):
- """
- Called by our ObsoleteForm widget. This method will
- request that any specified updates be marked as obsolete
- """
- log.debug("obsolete(%s, %s, %s)" % (updates, args, kw))
- errors = []
- if type(updates) != list:
- updates = [updates]
- for update in updates:
- up = PackageBuild.byNvr(update).update[0]
- if not util.authorized_user(up, identity):
- msg = "Unauthorized to obsolete %s" % up.title
- errors.append(msg)
- flash_log(msg)
- else:
- up.obsolete()
- return len(errors) and errors[0] or "Done!"
+ #@expose(template='bodhi.templates.obsolete')
+ #def obsolete_dialog(self, update):
+ # from bodhi.widgets import ObsoleteForm
+ # package = Package.byName('-'.join(update.split('-')[:-2]))
+ # builds = filter(lambda x: x.updates[0].status in ('testing', 'pending'),
+ # package.builds)
+ # if not len(builds):
+ # return dict(dialog=None)
+ # return dict(dialog=ObsoleteForm(builds))
+
+ #@expose("json")
+ #def obsolete(self, updates, *args, **kw):
+ # """
+ # Called by our ObsoleteForm widget. This method will
+ # request that any specified updates be marked as obsolete
+ # """
+ # log.debug("obsolete(%s, %s, %s)" % (updates, args, kw))
+ # errors = []
+ # if type(updates) != list:
+ # updates = [updates]
+ # for update in updates:
+ # up = PackageBuild.byNvr(update).update[0]
+ # if not util.authorized_user(up, identity):
+ # msg = "Unauthorized to obsolete %s" % up.title
+ # errors.append(msg)
+ # flash_log(msg)
+ # else:
+ # up.obsolete()
+ # return len(errors) and errors[0] or "Done!"
@expose(allow_json=True)
def dist_tags(self):
diff --git a/bodhi/templates/form.kid b/bodhi/templates/form.kid
index 6ef8879..96c65b3 100644
--- a/bodhi/templates/form.kid
+++ b/bodhi/templates/form.kid
@@ -4,27 +4,11 @@
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
-
- /*
- ** If we're flashing a broken update path error message, then display
- ** the obsolete dialog.
- */
- <script type="text/javascript">
- $(document).ready(function() {
- if( $('div.flash').text().substring(18, 0) == "Broken update path" ){
- $('#obsolete_dialog').load('/updates/obsolete_dialog?update=' +
- $('#form_builds_text').val().split()[0]);
- }
- })
- </script>
-
<title py:content="title" />
</head>
-
-<body class="flora">
- <div id="obsolete_dialog" class="obsolete_dialog" />
+<body>
<div>
<table class="show" cellpadding="0" cellspacing="0">
<tr>
commit b2dcc64acf00d46051b97da1960188c0fc3279ae
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Aug 21 18:46:57 2008 -0400
Cut the hostname down to the name only
diff --git a/bodhi/__init__.py b/bodhi/__init__.py
index dcf96e8..c9642e7 100644
--- a/bodhi/__init__.py
+++ b/bodhi/__init__.py
@@ -1,5 +1,5 @@
import socket
-hostname = socket.gethostname()
+hostname = socket.gethostname().split('.')[0]
from bodhi.release import VERSION as version
15 years, 8 months
7 commits - bodhi/controllers.py bodhi/model.py bodhi/search.py bodhi/templates bodhi/tests
by Luke Macken
bodhi/controllers.py | 17 +++++++----
bodhi/model.py | 3 +
bodhi/search.py | 2 -
bodhi/templates/search.kid | 61 ++++++++++++++++++++++++++++++++++++++++
bodhi/tests/test_controllers.py | 25 +++++++++-------
5 files changed, 90 insertions(+), 18 deletions(-)
New commits:
commit 1f669ca7354e5d704220352ad04b7d29e700c4e6
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Aug 20 15:32:58 2008 -0400
Use our new search template in the search controller
diff --git a/bodhi/search.py b/bodhi/search.py
index 45a4b05..4f13c9c 100644
--- a/bodhi/search.py
+++ b/bodhi/search.py
@@ -38,7 +38,7 @@ class SearchController(Controller):
return dict(form=search_form, values={}, action=url('/search/'),
title='Search Updates')
- @expose(template="bodhi.templates.list")
+ @expose(template="bodhi.templates.search")
@validate(validators={ "search" : validators.UnicodeString() })
@error_handler(index)
@paginate('updates', default_order='date_submitted', default_reversed=True,
commit e8f7387132b0a3bc68d27446ddf63d4d5457391a
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Aug 20 15:30:31 2008 -0400
Add a custom search template so we can order results by date submitted
diff --git a/bodhi/templates/search.kid b/bodhi/templates/search.kid
new file mode 100644
index 0000000..015aa56
--- /dev/null
+++ b/bodhi/templates/search.kid
@@ -0,0 +1,61 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
+ py:extends="'master.kid'">
+
+<head>
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
+ <title>Fedora Updates</title>
+</head>
+
+<body>
+ <b>${title}</b>
+ <div py:if="num_items" class="list">
+ <span py:for="page in tg.paginate.pages">
+ <a py:if="page != tg.paginate.current_page"
+ href="${tg.paginate.get_href(page)}">${page}</a>
+ <b py:if="page == tg.paginate.current_page">${page}</b>
+ </span>
+ <a href="?tg_paginate_limit=${num_items}">all</a>
+ </div>
+
+ <table class="list">
+ <tr class="list">
+ <th class="list">
+ <b>ID</b>
+ </th>
+ <th class="list">
+ <b>Update</b>
+ </th>
+ <th class="list">
+ <center><b>Type</b></center>
+ </th>
+ <th class="list">
+ <b>Submitter</b>
+ </th>
+ <th class="list">
+ <b>Date Submitted</b>
+ </th>
+ </tr>
+ <?python row_color = "#FFFFFF" ?>
+ <tr class="list" bgcolor="${row_color}" py:for="update in updates">
+ <td class="list">
+ ${update.updateid}
+ </td>
+ <td class="list" width="35%">
+ <a class="list" href="${tg.url(update.get_url())}">${update.title.replace(',', ', ')}</a>
+ </td>
+ <td class="list" align="center">
+ <img src="${tg.url('/static/images/%s.png' % update.type)}" title="${update.type}" />
+ </td>
+ <td class="list">
+ <a href="${tg.url('/user/' + update.submitter)}">${update.submitter}</a>
+ </td>
+ <td class="list">
+ ${update.date_submitted}
+ </td>
+ <?python row_color = (row_color == "#f1f1f1") and "#FFFFFF" or "#f1f1f1" ?>
+ </tr>
+ </table>
+
+</body>
+</html>
commit fd47b0174787c10a514d6a87286f92f77b5b0fcc
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Aug 20 14:50:31 2008 -0400
Avoid a koji tag race condition by skipping tag verification if we're editing and update.
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index ec4227e..6cd08de 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -566,7 +566,11 @@ class Root(controllers.RootController):
buildinfo[build]['releases'].add(rel)
valid = True
- if not valid:
+ # If all of the builds are not properly tagged, then complain.
+ # If we're editing an update, we can already assume that we've
+ # moved the builds back to the candidates tag above, and can
+ # skip this verification.
+ if not valid and not edited:
flash_log("%s not tagged as an update candidate" % build)
if request_format() == 'json': return dict()
raise redirect('/new', **params)
commit 54c5118de5d23e8da128e2c9579bfd0b55b7e77c
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Aug 20 14:45:30 2008 -0400
Stop spamming all committers for each comment, until we can figure out how to differentiate between a 'committer' and a 'maintainer'
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index ce68748..ec4227e 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -693,13 +693,15 @@ class Root(controllers.RootController):
# Send out mail notifications
if edited:
- mail.send(update.get_maintainers(), 'edited', update)
+ #mail.send(update.get_maintainers(), 'edited', update)
+ mail.send(update.submitter, 'edited', update)
note.insert(0, "Update successfully edited")
else:
# Notify security team of newly submitted security updates
if update.type == 'security':
mail.send(config.get('security_team'), 'security', update)
- mail.send(update.get_maintainers(), 'new', update)
+ #mail.send(update.get_maintainers(), 'new', update)
+ mail.send(update.submitter, 'new', update)
note.insert(0, "Update successfully created")
# Comment on all bugs
commit b3fc0d0800fcba90d07b4da27c30a211faadf4a0
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Aug 20 13:34:49 2008 -0400
Clean up some unnecessary output
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index bdf9ad5..ce68748 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -643,7 +643,6 @@ class Root(controllers.RootController):
bugs.append(unicode(bug.bz_id))
# Also inherit the older updates notes as well
notes += '\n' + update.notes
- print "new notes =", notes
update.obsolete(newer=build)
note.append('This update has obsoleted %s, and has '
'inherited its bugs and notes.' % oldBuild.nvr)
@@ -663,7 +662,6 @@ class Root(controllers.RootController):
log.debug("Removing unnecessary build: %s" % build.nvr)
update.removePackageBuild(build)
if len(build.updates) == 0:
- log.debug("Destroying %s" % build.nvr)
build.destroySelf()
else:
update = PackageUpdate(title=','.join(builds),
diff --git a/bodhi/model.py b/bodhi/model.py
index 23694cf..39533c8 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -633,7 +633,8 @@ class PackageUpdate(SQLObject):
return
for build in self.builds:
if build.inherited:
- log.debug("Removing %s tag from %s" % (curtag, build.nvr))
+ log.debug("Removing %s tag from inherited build %s" % (
+ curtag, build.nvr))
koji.untagBuild(curtag, build.nvr, force=True)
else:
log.debug("Moving %s from %s to %s" % (build.nvr, curtag, newtag))
commit 8c87c33645b95ef7da9daa9bdd6bec0e9be4d3da
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Aug 20 13:34:22 2008 -0400
I really hope this fixes the self-obsoletion issue...
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index 48ff56a..bdf9ad5 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -629,7 +629,8 @@ class Root(controllers.RootController):
if update.status not in ('pending', 'testing') or \
update.request or \
update.release not in buildinfo[build]['releases'] or \
- update in pkgBuild.updates:
+ update in pkgBuild.updates or \
+ (edited and oldBuild in edited.builds):
obsoletable = False
break
if rpm.labelCompare(util.get_nvr(oldBuild.nvr), nvr) < 0:
commit 8974a9e098164d6dad200911a7f881d852ad0674
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Aug 20 13:30:47 2008 -0400
Elaborate on our test_edit_obsoletion unit test with some real world data
diff --git a/bodhi/tests/test_controllers.py b/bodhi/tests/test_controllers.py
index 8c80f90..b0bd843 100644
--- a/bodhi/tests/test_controllers.py
+++ b/bodhi/tests/test_controllers.py
@@ -1069,27 +1069,32 @@ class TestControllers(testutil.DBTest):
def test_edit_obsoletion(self):
""" Make sure that an update cannot obsolete itself during edit """
session = login()
- create_release()
+ create_release(num='9', dist='dist-f')
+ create_release(num='8', dist='dist-f')
params = {
- 'builds' : 'TurboGears-2.6.23.1-21.fc7,python-sqlalchemy-0.5.0-1.fc7',
- 'release' : 'Fedora 7',
- 'type_' : 'newpackage',
- 'bugs' : '',
- 'notes' : '',
+ 'builds' : u'kdelibs-4.1.0-5.fc9,kdegames-4.1.0-2.fc9,konq-plugins-4.1.0-2.fc9,qt-4.4.1-2.fc9,quarticurve-kwin-theme-0.0-0.5.beta4.fc9,kdepimlibs-4.1.0-2.fc9,kdebase-workspace-4.1.0-8.fc9,akonadi-1.0.0-2.fc9,kde-l10n-4.1.0-2.fc9,kdegraphics-4.1.0-3.fc9,kdeutils-4.1.0-1.fc9.1,kdebindings-4.1.0-5.fc9,kde-i18n-3.5.9-8.fc9,kdeartwork-4.1.0-1.fc9,kdemultimedia-4.1.0-1.fc9,kdetoys-4.1.0-1.fc9,kdebase-runtime-4.1.0-1.fc9,kdeadmin-4.1.0-2.fc9,kdenetwork-4.1.0-2.fc9,kdeaccessibility-4.1.0-1.fc9,kdeplasma-addons-4.1.0-1.fc9,kdeedu-4.1.0-1.fc9,kdebase-4.1.0-1.fc9.1,kdesdk-4.1.0-1.fc9,kde-filesystem-4-17.fc9,qscintilla-2.2-3.fc9,qgtkstyle-0.0-0.2.20080719svn693.fc9,compiz-0.7.6-3.fc9.1,soprano-2.1-1.fc9,PyQt4-4.4.2-2.fc9,sip-4.7.6-1.fc9,automoc-1.0-0.8.rc1.fc9,phonon-4.2.0-2.fc9',
+ 'type_' : 'enhancement',
+ 'bugs' : u'457526 456820 454930 454458 456827 456797 456850 440226 455623 440031 453321 457479 457739',
+ 'notes' : u'This is an update to kde-4.1.0. \r\n\r\nSee also:\r\nhttp://www.kde.org/announcements/4.1/\r\n\r\nNOTE: This update does not include kdepim-4.1.0',
}
self.save_update(params, session)
+ assert PackageUpdate.select().count() == 1
update = PackageUpdate.byTitle(params['builds'])
assert update.status == 'pending'
+ assert PackageBuild.select().count() == len(params['builds'].split(','))
+ update.status = 'testing'
params = {
- 'builds' : 'TurboGears-2.6.24.1-21.fc7,python-sqlalchemy-0.5.0-1.fc7',
+ 'builds' : u'kdelibs-4.1.0-5.fc9,kdegames-4.1.0-2.fc9,konq-plugins-4.1.0-2.fc9,qt-4.4.1-2.fc9,quarticurve-kwin-theme-0.0-0.5.beta4.fc9,kdepimlibs-4.1.0-2.fc9,kdebase-workspace-4.1.0-8.fc9,akonadi-1.0.0-2.fc9,kde-l10n-4.1.0-2.fc9,kdegraphics-4.1.0-4.fc9,kdeutils-4.1.0-1.fc9.1,kdebindings-4.1.0-5.fc9,kde-i18n-3.5.9-8.fc9,kdeartwork-4.1.0-1.fc9,kdemultimedia-4.1.0-1.fc9,kdetoys-4.1.0-1.fc9,kdebase-runtime-4.1.0-3.fc9,kdeadmin-4.1.0-2.fc9,kdenetwork-4.1.0-2.fc9,kdeaccessibility-4.1.0-1.fc9,kdeplasma-addons-4.1.0-1.fc9,kdeedu-4.1.0-1.fc9,kdebase-4.1.0-1.fc9.1,kdesdk-4.1.0-1.fc9,kde-filesystem-4-17.fc9,qscintilla-2.2-3.fc9,qgtkstyle-0.0-0.2.20080719svn693.fc9,compiz-0.7.6-3.fc9.1,soprano-2.1-1.fc9,PyQt4-4.4.2-2.fc9,sip-4.7.6-1.fc9,automoc-1.0-0.8.rc1.fc9,phonon-4.2.0-4.fc9',
'release' : 'Fedora 7',
- 'type_' : 'newpackage',
+ 'type_' : 'enhancement',
'bugs' : '',
'notes' : '',
- 'edited' : 'TurboGears-2.6.23.1-21.fc7,python-sqlalchemy-0.5.0-1.fc7',
+ 'edited' : u'kdelibs-4.1.0-5.fc9,kdegames-4.1.0-2.fc9,konq-plugins-4.1.0-2.fc9,qt-4.4.1-2.fc9,quarticurve-kwin-theme-0.0-0.5.beta4.fc9,kdepimlibs-4.1.0-2.fc9,kdebase-workspace-4.1.0-8.fc9,akonadi-1.0.0-2.fc9,kde-l10n-4.1.0-2.fc9,kdegraphics-4.1.0-3.fc9,kdeutils-4.1.0-1.fc9.1,kdebindings-4.1.0-5.fc9,kde-i18n-3.5.9-8.fc9,kdeartwork-4.1.0-1.fc9,kdemultimedia-4.1.0-1.fc9,kdetoys-4.1.0-1.fc9,kdebase-runtime-4.1.0-1.fc9,kdeadmin-4.1.0-2.fc9,kdenetwork-4.1.0-2.fc9,kdeaccessibility-4.1.0-1.fc9,kdeplasma-addons-4.1.0-1.fc9,kdeedu-4.1.0-1.fc9,kdebase-4.1.0-1.fc9.1,kdesdk-4.1.0-1.fc9,kde-filesystem-4-17.fc9,qscintilla-2.2-3.fc9,qgtkstyle-0.0-0.2.20080719svn693.fc9,compiz-0.7.6-3.fc9.1,soprano-2.1-1.fc9,PyQt4-4.4.2-2.fc9,sip-4.7.6-1.fc9,automoc-1.0-0.8.rc1.fc9,phonon-4.2.0-2.fc9',
}
+ testutil.capture_log(['bodhi.controllers', 'bodhi.util', 'bodhi.model'])
self.save_update(params, session)
update = PackageUpdate.byTitle(params['builds'])
assert update.status == 'pending'
assert PackageUpdate.select().count() == 1
- assert PackageBuild.select().count() == 2
+ assert PackageBuild.select().count() == len(params['builds'].split(','))
+ testutil.print_log()
15 years, 8 months
11 commits - apache/bodhi.conf bodhi/buildsys.py bodhi/config bodhi/controllers.py bodhi/jobs.py bodhi/mail.py bodhi/metrics.py bodhi/model.py bodhi.spec bodhi/templates
by Luke Macken
apache/bodhi.conf | 2 -
bodhi.spec | 2 -
bodhi/buildsys.py | 14 +++++--
bodhi/config/app.cfg | 5 ++
bodhi/controllers.py | 2 -
bodhi/jobs.py | 17 ++++++--
bodhi/mail.py | 2 -
bodhi/metrics.py | 84 ++++++++++++++++++++++++++++++++++----------
bodhi/model.py | 20 ++--------
bodhi/templates/welcome.kid | 4 +-
10 files changed, 105 insertions(+), 47 deletions(-)
New commits:
commit 69a5877a990365513732157873e981b5a8d39ddc
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Aug 14 01:31:12 2008 -0400
Support the new fas User properties, as well as the default turbogears identity providers.
diff --git a/bodhi/templates/welcome.kid b/bodhi/templates/welcome.kid
index 018c2be..d162220 100644
--- a/bodhi/templates/welcome.kid
+++ b/bodhi/templates/welcome.kid
@@ -26,7 +26,7 @@
<body>
<table width="90%" align="center" valign="top">
<tr>
- <td align="left" valign="bottom"><b><font size="4">Welcome to bodhi v${version}<span py:if="not tg.identity.anonymous">, ${tg.identity.user.display_name.split()[0]}</span></font></b></td>
+ <td align="left" valign="bottom"><b><font size="4">Welcome to bodhi v${version}<span py:if="not tg.identity.anonymous">, ${hasattr(tg.identity.user, 'human_name') and tg.identity.user.human_name.split()[0] or tg.identity.user.display_name}</span></font></b></td>
<td align="right">
<table>
<tr>
@@ -75,7 +75,7 @@
<tr>
<td>
<span py:if="updates">
- <h3><span py:replace="tg.identity.anonymous and 'Latest' or '%s\'' % tg.identity.user.user_name"></span> Updates</h3>
+ <h3><span py:replace="tg.identity.anonymous and 'Latest' or '%s\'' % (hasattr(tg.identity, 'user_name') and tg.identity.user_name or tg.identity.user.user_name)"></span> Updates</h3>
${updates.display()}
</span>
</td>
commit 976fac2cd6cc2d3722a214ddab2bdc431bf8d24a
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Aug 14 01:30:31 2008 -0400
s/sortBy/orderBy/
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index 8e183bd..96f2db0 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -998,7 +998,7 @@ class Root(controllers.RootController):
AND(PackageUpdate.q.type == 'security',
PackageUpdate.q.status == 'pending',
PackageUpdate.q.approved == None),
- sortBy=PackageUpdate.q.date_submitted)
+ orderBy=PackageUpdate.q.date_submitted)
return dict(updates=updates)
@expose(template="bodhi.templates.user")
commit 87eac516a14db4f79e09704c6e04b603afb53e4d
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Aug 14 01:30:04 2008 -0400
Spec bump
diff --git a/bodhi.spec b/bodhi.spec
index e72bc40..27fcf6c 100644
--- a/bodhi.spec
+++ b/bodhi.spec
@@ -3,7 +3,7 @@
Name: bodhi
Version: 0.5.0
-Release: 1%{?dist}
+Release: 6%{?dist}
Summary: A modular framework that facilitates publishing software updates
Group: Applications/Internet
License: GPLv2+
commit 91a1d6c2bd4a020cc16a3765149ddff4f6497261
Author: Luke Macken <lmacken(a)redhat.com>
Date: Thu Aug 14 00:11:14 2008 -0400
Stop trying to email anonymous commenters
diff --git a/bodhi/model.py b/bodhi/model.py
index 9d3d057..23694cf 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -617,7 +617,7 @@ class PackageUpdate(SQLObject):
for person in self.get_maintainers():
people.add(person)
for comment in self.comments:
- if comment.author == 'bodhi':
+ if comment.anonymous or comment.author == 'bodhi':
continue
people.add(comment.author)
mail.send(people, 'comment', self)
commit 742ec2d3771f2126fa6f61bf13e21512b11ac75c
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Aug 13 23:56:15 2008 -0400
Stop logging the fully text to every email we send.
diff --git a/bodhi/mail.py b/bodhi/mail.py
index ea3c11f..50d5ee9 100644
--- a/bodhi/mail.py
+++ b/bodhi/mail.py
@@ -368,8 +368,8 @@ def send_mail(sender, to, subject, body):
message = turbomail.Message(sender, to, subject)
message.plain = body
try:
+ #log.debug("Sending mail: %s" % message.plain)
turbomail.enqueue(message)
- log.debug("Sending mail: %s" % message.plain)
except MailNotEnabledException:
log.warning("TurboMail is not enabled!")
except Exception, e:
commit b3f28387e398ed26b5f9e1453f4bdee5d4007d67
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Aug 13 19:57:48 2008 -0400
Make our certificates configurable
diff --git a/bodhi/buildsys.py b/bodhi/buildsys.py
index c8a25ff..46deb5b 100644
--- a/bodhi/buildsys.py
+++ b/bodhi/buildsys.py
@@ -154,12 +154,20 @@ class DevBuildsys(Buildsystem):
return [self.getBuild(),]
-def koji_login(client=join(expanduser('~'), '.fedora.cert'),
- clientca=join(expanduser('~'), '.fedora-upload-ca.cert'),
- serverca=join(expanduser('~'), '.fedora-server-ca.cert')):
+def koji_login(client=None, clientca=None, serverca=None):
"""
Login to Koji and return the session
"""
+ if not client:
+ client = config.get('client_cert',
+ join(expanduser('~'), '.fedora.cert'))
+ if not clientca:
+ clientca = config.get('clientca_cert',
+ join(expanduser('~'), '.fedora-upload-ca.cert'))
+ if not serverca:
+ serverca = config.get('serverca_cert',
+ join(expanduser('~'), '.fedora-server-ca.cert'))
+
koji_session = koji.ClientSession(config.get('koji_hub'), {})
koji_session.ssl_login(client, clientca, serverca)
return koji_session
diff --git a/bodhi/config/app.cfg b/bodhi/config/app.cfg
index 41f32cd..d4903eb 100644
--- a/bodhi/config/app.cfg
+++ b/bodhi/config/app.cfg
@@ -100,6 +100,11 @@ build_dir = '%(top_level_dir)s/../packages'
# Koji's XML-RPC hub
koji_hub = 'https://koji.fedoraproject.org/kojihub'
+# Koji certs
+client_cert = None
+clientca_cert = None
+serverca_cert = None
+
##
## ACL system
## Choices are 'pkgdb', which will send a JSON query to the pkgdb_url below,
commit 49f2773f0861306cd8724ec629570fbff83db571
Author: Luke Macken <lmacken(a)redhat.com>
Date: Wed Aug 13 19:35:19 2008 -0400
Don't delay the release caching job
diff --git a/bodhi/jobs.py b/bodhi/jobs.py
index 9b98ed0..8501df4 100644
--- a/bodhi/jobs.py
+++ b/bodhi/jobs.py
@@ -170,7 +170,7 @@ def schedule():
log.debug("Scheduling cache_release_data job")
scheduler.add_interval_task(action=cache_release_data,
taskname='Cache release data',
- initialdelay=300,
+ initialdelay=0,
interval=172800)
# If we're the masher, then handle the costly metric regenration
commit eb548e5620122ca1fe14e39aa50501ed3de2625a
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Aug 12 12:39:37 2008 -0400
Fix a few more bugs in the metrics module
diff --git a/bodhi/metrics.py b/bodhi/metrics.py
index 2ef631e..6d780b7 100644
--- a/bodhi/metrics.py
+++ b/bodhi/metrics.py
@@ -147,7 +147,7 @@ class MostUpdatedMetric(Metric):
A metric that calculates what packages have been updated the most.
"""
def __init__(self, release):
- self.release = release.long_name
+ self.release = release
self.data = {}
self.pkgs = []
@@ -191,7 +191,7 @@ class ActiveDevsMetric(Metric):
A metric that calculates which developers have pushed out the most updates
"""
def __init__(self, release):
- self.release = release.long_name
+ self.release = release
self.users = {} # { user : # updates }
self.data = {}
@@ -234,7 +234,7 @@ class KarmaMetric(Metric):
"""
def __init__(self, release):
self.data = {} # { pkg : karma }
- self.release = release.long_name
+ self.release = release
self.bestpkgs = {}
self.bestdata = []
self.worstpkgs = {}
@@ -280,7 +280,7 @@ class TopTestersMetric(Metric):
testing feedback for updates
"""
def __init__(self, release):
- self.release = release.long_name
+ self.release = release
self.data = {} # { person : # of comments }
self.people = {}
@@ -325,7 +325,7 @@ class MostTestedMetric(Metric):
A metric that calculates the packages with the most +1/-1 comments
"""
def __init__(self, release):
- self.release = release.long_name
+ self.release = release
self.data = {} # {pkg: # of +1/-1's}
self.tested_data = []
self.tested_pkgs = {}
@@ -359,7 +359,7 @@ class MostTestedMetric(Metric):
{
'xaxis': {'ticks': data['pkgs']}
},
- label = 'Most tested %s packages' % self.release
+ label = 'Most tested %s packages' % self.release.long_name
)
@@ -428,7 +428,6 @@ class MetricData(Singleton):
if not rel.metrics:
log.warning("No metrics found for %s" % rel.name)
return
- #self.init_metrics(rel) # Really?
if not freshwidgets.has_key(rel.name):
freshwidgets[rel.name] = {}
for metric in self.metrics:
commit 723a9fd3970d51fea2f2e859d08e4fc2ed9433fa
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Aug 12 12:07:43 2008 -0400
Run the cache_release_data job every couple of days
diff --git a/bodhi/jobs.py b/bodhi/jobs.py
index 065e994..9b98ed0 100644
--- a/bodhi/jobs.py
+++ b/bodhi/jobs.py
@@ -171,7 +171,7 @@ def schedule():
scheduler.add_interval_task(action=cache_release_data,
taskname='Cache release data',
initialdelay=300,
- interval=60)
+ interval=172800)
# If we're the masher, then handle the costly metric regenration
if not config.get('masher'):
commit f0ceeacecaf55c3d5c206076ee03b27907a80f84
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Aug 12 12:07:16 2008 -0400
Metrics optimizations
- Instead of each bodhi node calculating release stats for the sidebar on its
own, add a new metric for this data and have the masher calculate this hourly.
The results are then stored in Release.metrics['UpdateTypeMetric'], which
is then cached by our frontend bodhi instances every day.
diff --git a/bodhi/jobs.py b/bodhi/jobs.py
index 548c759..065e994 100644
--- a/bodhi/jobs.py
+++ b/bodhi/jobs.py
@@ -118,16 +118,23 @@ def cache_release_data():
for each visit (as much as possible).
"""
+ log.info("Caching release metrics")
from bodhi.model import Releases
- Releases().update()
+ try:
+ Releases().update()
+ except Exception, e:
+ log.exception(e)
+ log.info("Release cache complete")
+
def refresh_metrics():
""" Refresh all of our graphs and metrics """
- log.info("Regenerating update metrics...")
from bodhi.metrics import MetricData
- MetricData().refresh()
- log.info("Regeneration of metrics complete")
+ try:
+ MetricData().refresh()
+ except Exception, e:
+ log.exception(e)
def schedule():
@@ -163,8 +170,8 @@ def schedule():
log.debug("Scheduling cache_release_data job")
scheduler.add_interval_task(action=cache_release_data,
taskname='Cache release data',
- initialdelay=0,
- interval=3600)
+ initialdelay=300,
+ interval=60)
# If we're the masher, then handle the costly metric regenration
if not config.get('masher'):
diff --git a/bodhi/metrics.py b/bodhi/metrics.py
index 6802c8c..2ef631e 100644
--- a/bodhi/metrics.py
+++ b/bodhi/metrics.py
@@ -22,7 +22,7 @@ from turbogears import expose, config, flash, redirect
from turbogears.controllers import Controller
from bodhi.util import Singleton, get_age_in_days
-from bodhi.model import PackageUpdate, Release
+from bodhi.model import PackageUpdate, Release, hub
log = logging.getLogger(__name__)
@@ -107,7 +107,6 @@ class AllMetric(Metric):
self.months += m
def get_widget(self, data):
- log.debug("%s.get_widget(%s)" % (self.__class__.__name__, data))
return TurboFlot([
{
'data' : data['all'],
@@ -135,7 +134,7 @@ class AllMetric(Metric):
{
'xaxis' : {'ticks': data['months']},
},
- label = '%s Updates' % self.release
+ label = '%s Updates' % self.release.long_name
)
def get_data(self):
@@ -148,7 +147,7 @@ class MostUpdatedMetric(Metric):
A metric that calculates what packages have been updated the most.
"""
def __init__(self, release):
- self.release = release
+ self.release = release.long_name
self.data = {}
self.pkgs = []
@@ -183,7 +182,7 @@ class MostUpdatedMetric(Metric):
{
'xaxis': {'ticks': data['pkgs']}
},
- label = 'Most Updated Packages in %s' % self.release
+ label = 'Most Updated Packages in %s' % self.release.long_name
)
@@ -192,7 +191,7 @@ class ActiveDevsMetric(Metric):
A metric that calculates which developers have pushed out the most updates
"""
def __init__(self, release):
- self.release = release
+ self.release = release.long_name
self.users = {} # { user : # updates }
self.data = {}
@@ -224,7 +223,7 @@ class ActiveDevsMetric(Metric):
{
'xaxis': {'ticks': data['people']}
},
- label = 'Most updates per developer in %s' % self.release
+ label = 'Most updates per developer in %s' % self.release.long_name
)
@@ -235,7 +234,7 @@ class KarmaMetric(Metric):
"""
def __init__(self, release):
self.data = {} # { pkg : karma }
- self.release = release
+ self.release = release.long_name
self.bestpkgs = {}
self.bestdata = []
self.worstpkgs = {}
@@ -281,7 +280,7 @@ class TopTestersMetric(Metric):
testing feedback for updates
"""
def __init__(self, release):
- self.release = release
+ self.release = release.long_name
self.data = {} # { person : # of comments }
self.people = {}
@@ -317,7 +316,7 @@ class TopTestersMetric(Metric):
{
'xaxis': {'ticks': data['people']}
},
- label = 'Top %s testers' % self.release
+ label = 'Top %s testers' % self.release.long_name
)
@@ -326,7 +325,7 @@ class MostTestedMetric(Metric):
A metric that calculates the packages with the most +1/-1 comments
"""
def __init__(self, release):
- self.release = release
+ self.release = release.long_name
self.data = {} # {pkg: # of +1/-1's}
self.tested_data = []
self.tested_pkgs = {}
@@ -364,11 +363,48 @@ class MostTestedMetric(Metric):
)
+class UpdateTypeMetric(Metric):
+ """
+ This metric calculates the number of updates of various types for all
+ releases. This data is used by the sidebar in our master template. It is
+ generated by the masher, cached in the Release.metrics column, which is
+ then cached by our frontends every day.
+ """
+ def __init__(self, release):
+ self.release = {
+ 'id': release.id,
+ 'name': release.name,
+ 'long_name': release.long_name,
+ 'num_pending': 0,
+ 'num_testing': 0,
+ 'num_stable': 0,
+ 'num_obsolete': 0,
+ 'num_security': 0,
+ 'num_bugfix': 0,
+ 'num_enhancement': 0,
+ 'num_newpackage': 0,
+ }
+
+ def update(self, update):
+ self.release['num_%s' % update.status] += 1
+ if update.pushed:
+ self.release['num_%s' % update.type] += 1
+
+ def done(self):
+ pass
+
+ def get_data(self):
+ return self.release
+
+ def get_widget(self, data):
+ pass
+
+
##
## All of the metrics that we are going to generate
##
metrics = [AllMetric, MostUpdatedMetric, ActiveDevsMetric, KarmaMetric,
- TopTestersMetric, MostTestedMetric]
+ TopTestersMetric, MostTestedMetric, UpdateTypeMetric,]
class MetricData(Singleton):
@@ -379,7 +415,7 @@ class MetricData(Singleton):
def get_widgets(self, release):
""" Return the metrics for a specified release.
-
+
If our metric widgets are more than a day old, recreate them with
fresh metrics from our database.
"""
@@ -392,12 +428,13 @@ class MetricData(Singleton):
if not rel.metrics:
log.warning("No metrics found for %s" % rel.name)
return
- self.init_metrics(rel)
+ #self.init_metrics(rel) # Really?
if not freshwidgets.has_key(rel.name):
freshwidgets[rel.name] = {}
for metric in self.metrics:
- freshwidgets[rel.name][metric.__class__.__name__] = \
- metric.get_widget(rel.metrics[metric.__class__.__name__])
+ widget = metric.get_widget(rel.metrics[metric.__class__.__name__])
+ if widget:
+ freshwidgets[rel.name][metric.__class__.__name__] = widget
self.widgets = freshwidgets
self.age = datetime.utcnow()
@@ -407,27 +444,38 @@ class MetricData(Singleton):
""" Initialize our Metric objects for a given release """
self.metrics = []
for metric in metrics:
- self.metrics.append(metric(release.long_name))
+ self.metrics.append(metric(release))
def refresh(self):
""" Refresh all of the metrics for all releases.
-
+
For each release, initialize our metrics objects, and feed them every
update for that release. Do the necessary calculations, and then save
our metrics to the database in the Release.metrics PickleCol.
"""
log.info("Doing a hard refresh of our metrics data")
metrics = {}
- for release in Release.select():
+ updates = {} # {release: [updates,]}
+ all_updates = list(PackageUpdate.select())
+ releases = list(Release.select())
+ for release in releases:
+ updates[release.name] = []
+ for update in all_updates:
+ updates[update.release.name].append(update)
+ for release in releases:
+ log.debug("Calculating metrics for %s" % release.name)
self.init_metrics(release)
- for update in PackageUpdate.select(
- PackageUpdate.q.releaseID == release.id):
+ for update in updates[release.name]:
for metric in self.metrics:
metric.update(update)
for metric in self.metrics:
metric.done()
metrics[metric.__class__.__name__] = metric.get_data()
release.metrics = metrics
+ hub.commit()
+ del all_updates
+ del releases
+ log.info("Metrics generation complete!")
class MetricsController(Controller):
@@ -446,5 +494,6 @@ class MetricsController(Controller):
widgets = MetricData().get_widgets(release)
if not widgets:
return dict(metrics=[], title="Metrics currently unavailable")
- return dict(metrics=[widgets[name.__name__] for name in metrics],
+ return dict(metrics=[widgets[name.__name__] for name in metrics
+ if name.__name__ in widgets],
title="%s Update Metrics" % rel.long_name)
diff --git a/bodhi/model.py b/bodhi/model.py
index 8257ea3..9d3d057 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -873,20 +873,10 @@ class Releases(Singleton):
'name': release.name,
'id': release.id,
}
-
- # Count the number of different types of updates for this release
- for status in ('pending', 'testing', 'stable'):
- rel['num_%s' % status] = PackageUpdate.select(
- AND(PackageUpdate.q.releaseID == release.id,
- PackageUpdate.q.status == status)).count()
-
- # Count the number of pushed security updates for this release
- rel['num_security'] = PackageUpdate.select(
- AND(PackageUpdate.q.type == 'security',
- PackageUpdate.q.releaseID == release.id,
- PackageUpdate.q.pushed == True)).count()
-
+ if not release.metrics or 'UpdateTypeMetric' not in release.metrics:
+ log.warning("Release metrics have not been generated!")
+ return
+ rel.update(release.metrics['UpdateTypeMetric'])
releases.append(rel)
releases.sort(lambda x, y: cmp(x['name'], y['name']))
-
self.data = releases
commit deabe9f729538f8474eac7a530b0e1b85d11685e
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Aug 12 12:02:03 2008 -0400
Change our default WSGI config to only use 1 process (default)
diff --git a/apache/bodhi.conf b/apache/bodhi.conf
index 0c126d3..a0be3b4 100644
--- a/apache/bodhi.conf
+++ b/apache/bodhi.conf
@@ -1,6 +1,6 @@
Alias /updates/static /usr/share/bodhi/static
-WSGIDaemonProcess bodhi user=apache processes=4 threads=2 maximum-requests=1000 display-name=bodhi
+WSGIDaemonProcess bodhi user=apache maximum-requests=1000 display-name=bodhi
WSGISocketPrefix run/wsgi
WSGIRestrictStdout On
WSGIRestrictSignal Off
15 years, 8 months
bodhi/tools
by Luke Macken
bodhi/tools/client.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 09c1c5ce213c67a0eea68bcd1089d33855774156
Author: Luke Macken <lmacken(a)redhat.com>
Date: Mon Aug 11 18:02:03 2008 -0400
Change the default client limit to 60
diff --git a/bodhi/tools/client.py b/bodhi/tools/client.py
index 82da0dc..2cfef66 100755
--- a/bodhi/tools/client.py
+++ b/bodhi/tools/client.py
@@ -92,7 +92,7 @@ def get_parser():
help="Show debugging messages")
parser.add_option("-l", "--limit", action="store", type="int", dest="limit",
default=60, help="Maximum number of updates to return "
- "(default: 10)")
+ "(default: 60)")
return parser
15 years, 8 months
12 commits - bodhi/buildsys.py bodhi.cfg bodhi/controllers.py bodhi/new.py bodhi.spec bodhi/templates bodhi/tests bodhi/tools bodhi/widgets.py
by Luke Macken
bodhi.cfg | 7 ++--
bodhi.spec | 2 +
bodhi/buildsys.py | 4 +-
bodhi/controllers.py | 37 +++++++++++----------
bodhi/new.py | 4 +-
bodhi/templates/new.kid | 2 -
bodhi/tests/test_client.py | 22 ++++++++----
bodhi/tests/test_controllers.py | 17 +++++----
bodhi/tools/client.py | 69 +++++++++++++++++++++++-----------------
bodhi/widgets.py | 18 ++++++----
10 files changed, 107 insertions(+), 75 deletions(-)
New commits:
commit 17acda6c2bc1c64b3b5f94af7827bba8cf9a8fc1
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Aug 8 15:20:05 2008 -0400
make the test cases work again
diff --git a/bodhi.cfg b/bodhi.cfg
index 6c3645f..c20145d 100644
--- a/bodhi.cfg
+++ b/bodhi.cfg
@@ -5,7 +5,8 @@
# bodhi/config/app.cfg
# DATABASE
-sqlobject.dburi="sqlite:///var/tmp/bodhi.sqlite"
+#sqlobject.dburi="sqlite:///var/tmp/bodhi.sqlite"
+sqlobject.dburi="postgres://bodhi:b0dh1@localhost/bodhi"
# If you have sqlite, here's a simple default to get you started
# in development
@@ -34,8 +35,8 @@ tg.strict_parameters = True
#base_url_filter.use_x_forwarded_host = True
# MASHER
-masher = None # we are the masher
-#masher = 'http://localhost:8085/updates' # point to an external masher
+#masher = None # we are the masher
+masher = 'http://localhost:8085/updates' # point to an external masher
# Buildsystem. 'koji' or 'dev' (default)
# buildsystem = 'koji'
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index 3dc35f2..8e183bd 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -427,6 +427,7 @@ class Root(controllers.RootController):
# 'build' : PackageBuild } }
if not bugs: bugs = []
+ if request == 'None': request = None
if request: request = request.lower()
koji = buildsys.get_session()
diff --git a/bodhi/tests/test_controllers.py b/bodhi/tests/test_controllers.py
index 4e2af5e..7919cf6 100644
--- a/bodhi/tests/test_controllers.py
+++ b/bodhi/tests/test_controllers.py
@@ -549,7 +549,7 @@ class TestControllers(testutil.DBTest):
'request' : 'foobar!',
}
self.save_update(params, session)
- assert "Value must be one of: Testing; Stable; None; testing; stable; none (not u'foobar!')" in cherrypy.response.body[0], cherrypy.response.body[0]
+ assert "Value must be one of: Testing; Stable; None; None; testing; stable; none (not u'foobar!')" in cherrypy.response.body[0], cherrypy.response.body[0]
def test_broken_update_path_on_submission(self):
""" Make sure we are unable to break upgrade paths upon submission """
@@ -669,7 +669,7 @@ class TestControllers(testutil.DBTest):
params = {
'builds' : 'TurboGears-1.0.2.2-2.fc7',
'release' : 'Fedora 7',
- 'type_' : 'enhancement',
+ 'type_' : 'enhancement',
'bugs' : '1234',
'cves' : 'CVE-2020-0001',
'notes' : 'foobar',
diff --git a/bodhi/widgets.py b/bodhi/widgets.py
index e944332..c2b63ab 100644
--- a/bodhi/widgets.py
+++ b/bodhi/widgets.py
@@ -76,7 +76,7 @@ class NewUpdateForm(Form):
template = "bodhi.templates.new"
submit_text = "Save Update"
update_types = config.get('update_types').split()
- request_types = ['Testing', 'Stable', None]
+ request_types = ['Testing', 'Stable', 'None', None]
fields = [
AutoCompleteField('builds', label='Package',
search_controller=url('/new/search'),
commit f1d411645674b509cd128ae73a42ab5fd301afb0
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Aug 8 15:12:40 2008 -0400
Change the build_dir flash to a log.warning
diff --git a/bodhi/new.py b/bodhi/new.py
index 3b9b6a1..ab20274 100644
--- a/bodhi/new.py
+++ b/bodhi/new.py
@@ -13,11 +13,13 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import os
+import logging
from os.path import join
from bodhi.widgets import NewUpdateForm
from turbogears import expose, controllers, identity, config, url, flash
+log = logging.getLogger(__name__)
update_form = NewUpdateForm()
class NewUpdateController(controllers.Controller):
@@ -30,7 +32,7 @@ class NewUpdateController(controllers.Controller):
try:
self.packages = os.listdir(self.build_dir)
except (OSError, TypeError):
- flash("Warning: build_dir either invalid or not set in app.cfg")
+ log.warning("Warning: build_dir either invalid or not set in app.cfg")
@identity.require(identity.not_anonymous())
@expose(template="bodhi.templates.form")
commit 55eeae08e3fc7853478cb3b72b19972f9e8dd62a
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Aug 8 15:05:05 2008 -0400
Apply a modified patch from Ricky to use an improved update template parser.
diff --git a/bodhi/tests/test_client.py b/bodhi/tests/test_client.py
index 261ef4b..d82a072 100644
--- a/bodhi/tests/test_client.py
+++ b/bodhi/tests/test_client.py
@@ -95,8 +95,8 @@ class TestClient(testutil.DBTest):
assert bz in update.bugs
def __save_update(self, build, opts, bodhi):
- bodhi.save(builds=build, release=opts.release, type_=opts.type_,
- bugs=opts.bugs, notes=opts.notes, request=opts.request)
+ bodhi.save(builds=build, type_=opts.type_, bugs=opts.bugs,
+ notes=opts.notes, request=opts.request)
def test_query(self):
bodhi = self.__get_bodhi_client()
@@ -164,13 +164,21 @@ class TestClient(testutil.DBTest):
opts = self.__get_opts()
out = file(opts.input_file, 'w')
- out.write('type=E\nrequest=T\nbug=123,456\nbar')
+ out.write('''[%s]
+type=enhancement
+request=testing
+bugs=123,456
+notes=bar
+autokarma=True
+stable_karma=10
+unstable_karma=-10
+close_bugs=True
+''' % self.build)
out.close()
- update = bodhi.parse_file(input_file=opts.input_file)
- for key, value in update.items():
- setattr(opts, key, value)
- self.__save_update(self.build, opts, bodhi)
+ updates = bodhi.parse_file(input_file=opts.input_file)
+ for update_args in updates:
+ bodhi.save(**update_args)
update = PackageUpdate.byTitle(self.build)
assert update.type == 'enhancement'
diff --git a/bodhi/tools/client.py b/bodhi/tools/client.py
index 58f4ce7..82da0dc 100755
--- a/bodhi/tools/client.py
+++ b/bodhi/tools/client.py
@@ -126,39 +126,52 @@ def main():
while True:
try:
if opts.new:
- verify_args(args)
- extra_args = {
- 'builds': args[0], 'release': opts.release,
- 'type_': opts.type_, 'bugs': opts.bugs, 'notes': opts.notes,
- 'request': opts.request or 'testing',
- }
+ # Note: All options are ignored if you're passing input from a file.
if opts.input_file:
- extra_args.update(
- bodhi.parse_file(input_file=opts.input_file))
- # hack. remove this with the next version of python-fedora
- if 'type' in extra_args:
- extra_args['type_'] = extra_args['type']
- del(extra_args['type'])
- if not extra_args['release']:
- log.error("Error: No release specified (ie: -r F8)")
- sys.exit(-1)
- if not extra_args['type_']:
- log.error("Error: No update type specified (ie: -t bugfix)")
- sys.exit(-1)
- log.info("Creating a new update for %s" % args[0])
- data = bodhi.save(**extra_args)
- if data.get('tg_flash'):
- log.info(data['tg_flash'])
- if 'update' in data:
- log.info(data['update'])
+ updates = bodhi.parse_file(input_file=opts.input_file)
+ for update_args in updates:
+ if not update_args['type_']:
+ log.error("Error: No update type specified (ie: "
+ "type=bugfix), skipping.")
+ continue
+ log.info("Creating a new update for %s" %
+ update_args['builds'])
+ data = bodhi.save(**update_args)
+ if data.get('tg_flash'):
+ log.info(data['tg_flash'])
+ if 'updates' in data:
+ for update in data['updates']:
+ log.info(bodhi.update_str(update))
+ else:
+ validate_auth(data)
else:
- validate_auth(data)
+ verify_args(args)
+ extra_args = {
+ 'builds': args[0],
+ 'type_': opts.type_,
+ 'bugs': opts.bugs,
+ 'notes': opts.notes,
+ 'request': opts.request or 'testing',
+ }
+ if not extra_args['type_']:
+ log.error("Error: No update type specified (ie: -t bugfix)")
+ sys.exit(-1)
+ log.info("Creating a new update for %s" % args[0])
+ data = bodhi.save(**extra_args)
+ print "data =", data
+ if data.get('tg_flash'):
+ log.info(data['tg_flash'])
+ if 'updates' in data:
+ for update in data['updates']:
+ log.info(bodhi.update_str(update))
+ else:
+ validate_auth(data)
elif opts.edit:
verify_args(args)
log.info("Editing update for %s" % args[0])
- data = bodhi.save(builds=args[0], release=opts.release,
- type_=opts.type_, bugs=opts.bugs,
- notes=opts.notes, request=opts.request)
+ data = bodhi.save(builds=args[0], type_=opts.type_,
+ bugs=opts.bugs, notes=opts.notes,
+ request=opts.request)
log.info(data['tg_flash'])
validate_auth(data)
if data.has_key('update'):
commit 2dc8c8e3a9612f460df8326f90a7c46bb7185bb9
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Aug 8 14:51:44 2008 -0400
Use the formencode.validators.StringBool instead of Bool in our NewUpdateForm.
I'm really surprised this bug hasn't caused more issues...
diff --git a/bodhi/widgets.py b/bodhi/widgets.py
index 3972322..e944332 100644
--- a/bodhi/widgets.py
+++ b/bodhi/widgets.py
@@ -84,6 +84,7 @@ class NewUpdateForm(Form):
template='bodhi.templates.packagefield',
validator=AutoCompleteValidator()),
CheckBox('inheritance', label='Follow Build inheritance',
+ validator=validators.StringBool(),
default=False, attrs={'title' : 'Build Inheritance - '
'TODO'}),
SingleSelectField('type_', label='Type', options=update_types,
@@ -102,19 +103,21 @@ class NewUpdateForm(Form):
'about this update that will appear in '
'the notice'}),
CheckBox(name='close_bugs', help_text='Automatically close bugs',
+ validator=validators.StringBool(),
default=True, attrs={'title' : 'Close Bugs - '
'Automatically close bugs '
'when this update is '
'pushed as stable'}),
HiddenField('edited', default=None),
CheckBox(name='suggest_reboot', label='Suggest Reboot',
+ validator=validators.StringBool(),
default=False, attrs={'title': 'Suggest Reboot - '
'Recommend that the user '
'restarts their machine '
'after installing this '
'update'}),
CheckBox(name='autokarma', label='Enable karma automatism',
- default=True, validator=validators.Bool(),
+ default=True, validator=validators.StringBool(),
attrs={'onclick':
'$("#form_stable_karma").attr("disabled", !$("#form_stable_karma").attr("disabled"));'
'$("#form_unstable_karma").attr("disabled", !$("#form_unstable_karma").attr("disabled"));',
commit cadc765fc7a1bce45b6b82475e7d7cacf2f71e77
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Aug 8 14:51:12 2008 -0400
Change our request_types to 'Testing', 'Stable' and None (instead of 'None')
diff --git a/bodhi/widgets.py b/bodhi/widgets.py
index 2712dc4..3972322 100644
--- a/bodhi/widgets.py
+++ b/bodhi/widgets.py
@@ -76,7 +76,7 @@ class NewUpdateForm(Form):
template = "bodhi.templates.new"
submit_text = "Save Update"
update_types = config.get('update_types').split()
- request_types = ['Testing', 'Stable', 'None']
+ request_types = ['Testing', 'Stable', None]
fields = [
AutoCompleteField('builds', label='Package',
search_controller=url('/new/search'),
@@ -90,7 +90,7 @@ class NewUpdateForm(Form):
validator=validators.OneOf(update_types)),
SingleSelectField('request', options=request_types,
validator=validators.OneOf(request_types +
- [r.lower() for r in request_types])),
+ [r.lower() for r in request_types if r])),
TextField('bugs', validator=BugValidator(),
attrs={'title' : 'Bug Numbers - A space or comma '
'delimited list of bug numbers or '
commit f52cff99946d009ceab8a631aff8558b271c2d24
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Aug 8 14:49:32 2008 -0400
Fix some more broken test cases
diff --git a/bodhi/tests/test_controllers.py b/bodhi/tests/test_controllers.py
index 57038d1..4e2af5e 100644
--- a/bodhi/tests/test_controllers.py
+++ b/bodhi/tests/test_controllers.py
@@ -151,13 +151,14 @@ class TestControllers(testutil.DBTest):
params = {
'builds' : 'TurboGears-1.0.2.2-2.fc7',
'release' : 'Fedora 7',
- 'type_' : 'REGRESSION!',
+ 'type_' : 'REGRESSION!',
'bugs' : '',
'cves' : '',
'notes' : ''
}
+ cherrypy.config.update({'build_dir': '/tmp'})
self.save_update(params, session)
- assert "Invalid: expected a member of ['security', 'bugfix', 'enhancement', 'newpackage'] in the EnumCol 'type', got u'REGRESSION!' instead" in cherrypy.response.body[0]
+ assert "Value must be one of: bugfix; enhancement; security; newpackage (not u'REGRESSION!')" in cherrypy.response.body[0]
def test_user_notes_encoding(self):
session = login(username='guest', display_name='foo\xc3\xa9bar')
@@ -792,7 +793,7 @@ class TestControllers(testutil.DBTest):
params = {
'builds' : 'TurboGears-2.6.23.1-21.fc7',
'release' : 'Fedora 7',
- 'type_' : 'enhancement',
+ 'type_' : 'enhancement',
'bugs' : '321',
'cves' : '',
'notes' : 'foobar',
@@ -803,7 +804,7 @@ class TestControllers(testutil.DBTest):
params = {
'builds' : 'python-sqlobject-1.6.3-13.fc7',
'release' : 'Fedora 7',
- 'type_' : 'enhancement',
+ 'type_' : 'enhancement',
'bugs' : '321',
'cves' : '',
'notes' : 'foobar',
@@ -815,7 +816,7 @@ class TestControllers(testutil.DBTest):
params = {
'builds' : 'nethack-2.10-3.20070831cvs.fc7',
'release' : 'Fedora 7',
- 'type_' : 'enhancement',
+ 'type_' : 'enhancement',
'bugs' : '321',
'cves' : '',
'notes' : 'foobar',
@@ -827,7 +828,7 @@ class TestControllers(testutil.DBTest):
params = {
'builds' : 'xprobe2-1.4.6-1.fc7',
'release' : 'Fedora 7',
- 'type_' : 'enhancement',
+ 'type_' : 'enhancement',
'bugs' : '321',
'cves' : '',
'notes' : 'foobar',
commit 66783403cd3c9295ccb5535bc5836b7c847f5fc1
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Aug 8 14:48:56 2008 -0400
Lots of various Controller.save() method cleanups
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index f626392..3dc35f2 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -427,6 +427,7 @@ class Root(controllers.RootController):
# 'build' : PackageBuild } }
if not bugs: bugs = []
+ if request: request = request.lower()
koji = buildsys.get_session()
# Basic sanity checks
@@ -434,7 +435,7 @@ class Root(controllers.RootController):
flash_log('Unknown update type: %s. Valid types are: %s' % (
type_, config.get('update_types')))
return dict()
- if request not in ('testing', 'stable', 'None', None):
+ if request not in ('testing', 'stable', None):
flash_log('Unknown request: %s. Valid requests are: testing, '
'stable, None' % request)
return dict()
@@ -463,7 +464,7 @@ class Root(controllers.RootController):
else:
flash_log("%s update already exists!" %
link(build, b.get_url()))
- raise redirect('/new', **params)
+ raise redirect('/new', **params)
except SQLObjectNotFound:
pass
@@ -574,11 +575,11 @@ class Root(controllers.RootController):
kojiBuild['release'])
# Check for broken update paths against all releases
+ log.info("Checking for broken update paths")
for release in Release.select():
- tags = ['dist-rawhide', release.dist_tag, release.dist_tag +
- '-updates']
+ tags = ['dist-rawhide', release.dist_tag,
+ release.dist_tag + '-updates']
for tag in tags:
- log.info("Checking for broken update paths in " + tag)
pkg = buildinfo[build]['nvr'][0]
for oldBuild in koji.listTagged(tag, package=pkg,
latest=True):
@@ -612,10 +613,9 @@ class Root(controllers.RootController):
# Create or fetch the PackageBuild object for this build
try:
- pkgBuild = PackageBuild(nvr=build, package=package)
- except (PostgresIntegrityError, SQLiteIntegrityError,
- DuplicateEntryError):
pkgBuild = PackageBuild.byNvr(build)
+ except SQLObjectNotFound:
+ pkgBuild = PackageBuild(nvr=build, package=package)
buildinfo[build]['build'] = pkgBuild
# Obsolete any older pending/testing updates.
@@ -709,9 +709,9 @@ class Root(controllers.RootController):
# If a request is specified, make it. By default we're submitting
# new updates directly into testing
- if request and request != "None" and request != update.request:
+ if request and request != update.request:
try:
- update.set_request(request.lower(), pathcheck=False)
+ update.set_request(request, pathcheck=False)
except InvalidRequest, e:
flash_log(str(e))
if request_format() == 'json': return dict()
commit 81a3601dfeca7d7456b405a1b09a97854cade2e2
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Aug 8 14:08:31 2008 -0400
Make a few semantic cleanups
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index addf4bc..f626392 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -299,7 +299,7 @@ class Root(controllers.RootController):
Request that a specified action be performed on a given update.
Action must be one of: 'testing', 'stable', 'unpush' or 'obsolete'.
"""
- log.debug("request(%s, %s)" % (action, update))
+ log.debug('request(%s)' % locals())
try:
update = PackageUpdate.byTitle(update)
update.set_request(action)
@@ -393,8 +393,8 @@ class Root(controllers.RootController):
""" Save an update.
This entails either creating a new update, or editing an existing one.
- To edit an existing update, you must specify the update title in
- the ``edited`` keyword argument.
+ To edit an existing update, you must specify the update's original
+ title in the ``edited`` keyword argument.
Arguments:
:builds: A list of koji builds for this update.
@@ -417,10 +417,7 @@ class Root(controllers.RootController):
:edited: The update title of the existing update that we are editing.
"""
- log.debug("save(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)" % (
- builds, type_, notes, bugs, close_bugs, edited, request,
- suggest_reboot, inheritance, stable_karma, unstable_karma,
- kw))
+ log.debug('save(%s)' % locals())
note = [] # Messages to flash to the user
updates = [] # PackageUpdate objects
commit f6f63443ad2fa2ddfb8640b3cf39ba04a397b3da
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Aug 8 14:07:57 2008 -0400
Fix a couple of bugs when editing updates
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index b4f295b..addf4bc 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -367,13 +367,16 @@ class Root(controllers.RootController):
'release' : update.release.long_name,
'testing' : update.status == 'testing',
'request' : str(update.request).title(),
- 'type' : update.type,
+ 'type_' : update.type,
'notes' : update.notes,
'bugs' : update.get_bugstring(),
'edited' : update.title,
'close_bugs': update.close_bugs,
'stable_karma' : update.builds[0].package.stable_karma,
'unstable_karma' : update.builds[0].package.unstable_karma,
+ 'suggest_reboot' : update.builds[0].package.suggest_reboot,
+ 'autokarma' : update.builds[0].package.stable_karma != 0 and
+ update.builds[0].package.unstable_karma != 0,
}
if update.status == 'testing':
flash("Editing this update will move it back to a pending state.")
commit 183be020170763ba98286dd5808805bc3ec6f33b
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Aug 8 14:06:21 2008 -0400
Re-enable the inheritance widget, but hide it in the template.
Also, rename 'type' to 'type_' in our NewUpdateForm
diff --git a/bodhi/templates/new.kid b/bodhi/templates/new.kid
index c045bd3..d286591 100644
--- a/bodhi/templates/new.kid
+++ b/bodhi/templates/new.kid
@@ -68,7 +68,7 @@
<table border="0" cellspacing="0" cellpadding="0">
<tr py:for="i, field in enumerate(fields)">
<td class="title">
- <span py:if="i == 5">
+ <span py:if="i in (1, 6)">
<?python continue ?>
</span>
<label class="fieldlabel"
diff --git a/bodhi/widgets.py b/bodhi/widgets.py
index 37e6124..2712dc4 100644
--- a/bodhi/widgets.py
+++ b/bodhi/widgets.py
@@ -83,10 +83,10 @@ class NewUpdateForm(Form):
search_param='name', result_name='pkgs',
template='bodhi.templates.packagefield',
validator=AutoCompleteValidator()),
- #CheckBox('inheritance', label='Follow Build inheritance',
- # default=False, attrs={'title' : 'Build Inheritance - '
- # 'TODO'}),
- SingleSelectField('type', options=update_types,
+ CheckBox('inheritance', label='Follow Build inheritance',
+ default=False, attrs={'title' : 'Build Inheritance - '
+ 'TODO'}),
+ SingleSelectField('type_', label='Type', options=update_types,
validator=validators.OneOf(update_types)),
SingleSelectField('request', options=request_types,
validator=validators.OneOf(request_types +
@@ -114,7 +114,8 @@ class NewUpdateForm(Form):
'after installing this '
'update'}),
CheckBox(name='autokarma', label='Enable karma automatism',
- default=True, attrs={'onclick':
+ default=True, validator=validators.Bool(),
+ attrs={'onclick':
'$("#form_stable_karma").attr("disabled", !$("#form_stable_karma").attr("disabled"));'
'$("#form_unstable_karma").attr("disabled", !$("#form_unstable_karma").attr("disabled"));',
'title': 'Karma Automatism - Enable update request '
commit ad330ae9678979144252803bdead26d25a11665d
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Aug 8 11:34:13 2008 -0400
Update our fake buildsystem to work with some newer test cases
diff --git a/bodhi/buildsys.py b/bodhi/buildsys.py
index e6e3f83..c8a25ff 100644
--- a/bodhi/buildsys.py
+++ b/bodhi/buildsys.py
@@ -101,7 +101,6 @@ class DevBuildsys(Buildsystem):
'task_id': 127621,
'version': '1.0.2.2'}
-
def listBuildRPMs(self, *args, **kw):
return [{'arch': 'src',
'build_id': 6475,
@@ -146,7 +145,8 @@ class DevBuildsys(Buildsystem):
'dist-f8', 'dist-f8-updates', 'dist-f8-updates-testing',
'dist-fc8', 'dist-fc8-updates',
'dist-fc8-updates-testing', 'dist-f8-updates-candidate',
- 'dist-f9', 'dist-f9-updates', 'dist-f9-updates-testing'):
+ 'dist-f9', 'dist-f9-updates', 'dist-f9-updates-testing',
+ 'dist-f9-updates-candidate'):
raise koji.GenericError
return [self.getBuild(),]
commit ff86ceadcff9f2cb9f9473116ac98ddd7ccdbd63
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Aug 8 11:33:35 2008 -0400
Add python-devel to BuildRequires and Require python-decorator
diff --git a/bodhi.spec b/bodhi.spec
index 396477c..e72bc40 100644
--- a/bodhi.spec
+++ b/bodhi.spec
@@ -14,6 +14,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: python-setuptools-devel
+BuildRequires: python-devel
BuildRequires: TurboGears
%description
@@ -50,6 +51,7 @@ Requires: python-imaging
Requires: python-crypto
Requires: python-turboflot
Requires: python-tgcaptcha
+Requires: python-decorator
Requires: mod_wsgi
15 years, 9 months
3 commits - apache/bodhi.conf bodhi/controllers.py
by Luke Macken
apache/bodhi.conf | 4 ++--
bodhi/controllers.py | 21 +++++++++++++++++----
2 files changed, 19 insertions(+), 6 deletions(-)
New commits:
commit 8e55587060717f69584589ec7f6b50bad444a1c4
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Aug 8 10:52:27 2008 -0400
Change our WSGISocketPrefix to make SELinux happy
diff --git a/apache/bodhi.conf b/apache/bodhi.conf
index b5a4e7b..0c126d3 100644
--- a/apache/bodhi.conf
+++ b/apache/bodhi.conf
@@ -1,7 +1,7 @@
Alias /updates/static /usr/share/bodhi/static
WSGIDaemonProcess bodhi user=apache processes=4 threads=2 maximum-requests=1000 display-name=bodhi
-WSGISocketPrefix /tmp/wsgi
+WSGISocketPrefix run/wsgi
WSGIRestrictStdout On
WSGIRestrictSignal Off
WSGIPythonOptimize 2
commit e37a81df5579fdf8e8ffd3534de23b19dbeb47c4
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Aug 5 21:31:54 2008 -0400
Add some more sanity checks to the beginning of save()
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index 6c13b5b..b4f295b 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -385,7 +385,7 @@ class Root(controllers.RootController):
@validate(form=update_form)
@identity.require(identity.not_anonymous())
def save(self, builds, type_, notes, bugs, close_bugs=False, edited=False,
- request='testing', suggest_reboot=False, inheritance=False,
+ request='testing', suggest_reboot=False, inheritance=False,
autokarma=True, stable_karma=3, unstable_karma=-3, **kw):
""" Save an update.
@@ -429,6 +429,16 @@ class Root(controllers.RootController):
if not bugs: bugs = []
koji = buildsys.get_session()
+ # Basic sanity checks
+ if type_ not in config.get('update_types'):
+ flash_log('Unknown update type: %s. Valid types are: %s' % (
+ type_, config.get('update_types')))
+ return dict()
+ if request not in ('testing', 'stable', 'None', None):
+ flash_log('Unknown request: %s. Valid requests are: testing, '
+ 'stable, None' % request)
+ return dict()
+
# Parameters used to re-populate the update form if something fails
params = {
'builds.text' : ' '.join(builds),
@@ -447,9 +457,12 @@ class Root(controllers.RootController):
for build in builds:
try:
b = PackageBuild.byNvr(build)
- flash_log("%s update already exists!" %
- link(build, b.get_url()))
- if request_format() == 'json': return dict()
+ if request_format() == 'json':
+ flash_log("%s update already exists!" % build)
+ return dict()
+ else:
+ flash_log("%s update already exists!" %
+ link(build, b.get_url()))
raise redirect('/new', **params)
except SQLObjectNotFound:
pass
commit 5dd6c3fd9f1a7899e5915f1ed242180afce2654e
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Aug 5 21:04:29 2008 -0400
As it turns out, 'inactivity-timeout' was a bad idea.
diff --git a/apache/bodhi.conf b/apache/bodhi.conf
index a3db7e1..b5a4e7b 100644
--- a/apache/bodhi.conf
+++ b/apache/bodhi.conf
@@ -1,6 +1,6 @@
Alias /updates/static /usr/share/bodhi/static
-WSGIDaemonProcess bodhi user=apache processes=4 threads=2 maximum-requests=1000 display-name=bodhi inactivity-timeout=30
+WSGIDaemonProcess bodhi user=apache processes=4 threads=2 maximum-requests=1000 display-name=bodhi
WSGISocketPrefix /tmp/wsgi
WSGIRestrictStdout On
WSGIRestrictSignal Off
15 years, 9 months
3 commits - bodhi/controllers.py bodhi/templates start-bodhi
by Luke Macken
bodhi/controllers.py | 28 +++++++++++++++++++++++++---
bodhi/templates/master.kid | 2 +-
start-bodhi | 1 -
3 files changed, 26 insertions(+), 5 deletions(-)
New commits:
commit 14b29e9e0ea3c89e65a94d15dd042bc07b9f0204
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Aug 5 16:32:10 2008 -0400
Apply a modified patch from J5 to add a get_auth parameter to the list() method.
This patch allows for the ``get_auth`` argument to the list method, which if
True, will check to see if the current user has rights to modify the request
for release. A 'can_modify' key will be inserted into the returning dictionary
that contains this value.
diff --git a/bodhi/controllers.py b/bodhi/controllers.py
index a3e49de..6c13b5b 100644
--- a/bodhi/controllers.py
+++ b/bodhi/controllers.py
@@ -178,15 +178,20 @@ class Root(controllers.RootController):
@expose(template="bodhi.templates.list", allow_json=True)
@paginate('updates', limit=20, allow_limit_override=True)
def list(self, release=None, bugs=None, cves=None, status=None, type_=None,
- package=None, mine=False, stringify=False):
+ package=None, mine=False, stringify=False, get_auth=False):
""" Return a list of updates based on given parameters """
- log.debug("list(%s, %s, %s, %s, %s, %s, %s, %s)" % (release, bugs, cves,
- status, type_, package, mine, stringify))
+ log.debug("list(%s, %s, %s, %s, %s, %s, %s, %s, %s)" % (release, bugs,
+ cves, status, type_, package, mine, stringify, get_auth))
query = []
updates = []
try:
if release:
+ # TODO: if a specific release is requested along with get_auth,
+ # and it is not found in PackageUpdate we should add.
+ # another value to the output which indicates if the.
+ # logged in user is allowed to create a new update for.
+ # this package
rel = Release.byName(release.upper())
query.append(PackageUpdate.q.releaseID == rel.id)
if status:
@@ -250,6 +255,23 @@ class Root(controllers.RootController):
if request_format() == 'json':
return dict(updates=[])
+ # if get_auth is True add can_modify flag and check if the current user
+ # is allowed to modify the request
+ if get_auth:
+ results = []
+ for up in updates:
+ can_modify = False
+ if not identity.current.anonymous:
+ people, groups = get_pkg_pushers(up.builds[0].package.name,
+ up.release.id_prefix.capitalize(),
+ up.release.get_version())
+ if (identity.current.user_name in people[0]):
+ can_modify = True
+ dict_up = dict(up._reprItems())
+ dict_up['can_modify'] = can_modify
+ results.append(dict_up)
+ updates = results
+
if isinstance(updates, list): num_items = len(updates)
else: num_items = updates.count()
if stringify: updates = map(unicode, updates)
commit c44e298d9dc8ebc438f4f52a4d602268e377b1ad
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Aug 5 16:13:05 2008 -0400
Remove an unnecessary __requires__ from the start-bodhi script
diff --git a/start-bodhi b/start-bodhi
index 2ba34c2..1c51f71 100755
--- a/start-bodhi
+++ b/start-bodhi
@@ -1,6 +1,5 @@
#!/usr/bin/python -tt
""" Start script for bodhi """
-#__requires__='bodhi'
from bodhi.commands import start, ConfigurationError
if __name__ == '__main__':
commit 992af7c8a6d8e2ca092ae3b005aefac06b46008f
Author: Luke Macken <lmacken(a)redhat.com>
Date: Fri Aug 1 17:51:54 2008 -0400
Fix the security links on our main toolbar
diff --git a/bodhi/templates/master.kid b/bodhi/templates/master.kid
index f479a31..7587a99 100644
--- a/bodhi/templates/master.kid
+++ b/bodhi/templates/master.kid
@@ -98,7 +98,7 @@ $(document).ready(function() {
<a href="${tg.url('/%s/%s' % (release['name'], status != 'stable' and status or ''))}" class="link">${status.title()} (${release['num_' + status]})</a> <a href="${tg.url('/rss/rss2.0?release=%s&status=%s' % (release['name'], status))}" class="rsslink"><img src="${tg.url('/static/images/rss.png')}" /></a>
</li>
<li class="release">
- <a href="${tg.url('/%s/%s' % (release['name'], status))}" class="link">Security (${release['num_security']})</a> <a href="${tg.url('/rss/rss2.0?release=%s&type=security' % release['name'])}" class="rsslink"><img src="${tg.url('/static/images/rss.png')}" /></a>
+ <a href="${tg.url('/%s/security' % release['name'])}" class="link">Security (${release['num_security']})</a> <a href="${tg.url('/rss/rss2.0?release=%s&type=security' % release['name'])}" class="rsslink"><img src="${tg.url('/static/images/rss.png')}" /></a>
</li>
</ul>
</div>
15 years, 9 months