bodhi.egg-info/SOURCES.txt | 1
bodhi.spec | 2 -
bodhi/mail.py | 18 ++++++++++-
bodhi/model.py | 12 +++++++
bodhi/tests/test_controllers.py | 61 ++++++++++++++++++++++------------------
5 files changed, 64 insertions(+), 30 deletions(-)
New commits:
commit 68fb6ebdc5f29a87af3e8d909a595377fc186134
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Jan 26 14:05:39 2010 -0500
Some critpath workflow changes and test improvements.
- If a developer +1's a critpath update that for a pending release, and it
becomes approved after, then automatically submit it to stable.
- This makes it so the workflow does not require someone to come along and
request that it be pushed to stable after it has the appropriate karma.
diff --git a/bodhi.egg-info/SOURCES.txt b/bodhi.egg-info/SOURCES.txt
index c579c72..60b8600 100644
--- a/bodhi.egg-info/SOURCES.txt
+++ b/bodhi.egg-info/SOURCES.txt
@@ -166,6 +166,7 @@ bodhi/tests/__init__.py
bodhi/tests/test_buildsystem.py
bodhi/tests/test_client.py
bodhi/tests/test_controllers.py
+bodhi/tests/test_masher.py
bodhi/tests/test_metadata.py
bodhi/tests/test_model.py
bodhi/tests/test_util.py
diff --git a/bodhi.spec b/bodhi.spec
index 663ba19..e40e5a3 100644
--- a/bodhi.spec
+++ b/bodhi.spec
@@ -3,7 +3,7 @@
Name: bodhi
Version: 0.7.0
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: A modular framework that facilitates publishing software updates
Group: Applications/Internet
License: GPLv2+
diff --git a/bodhi/mail.py b/bodhi/mail.py
index 7cad3ee..83ac27d 100644
--- a/bodhi/mail.py
+++ b/bodhi/mail.py
@@ -433,7 +433,7 @@ def send(to, msg_type, update, sender=None):
to = [to]
for person in to:
send_mail(sender, person, '[Fedora Update] %s[%s] %s' % (
- if update.critpath and '[CRITPATH] ' or '',
+ update.critpath and '[CRITPATH] ' or '',
msg_type, update.title), messages[msg_type]['body'] %
messages[msg_type]['fields'](update))
diff --git a/bodhi/model.py b/bodhi/model.py
index 00d69bf..fee8aa8 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -689,9 +689,11 @@ class PackageUpdate(SQLObject):
as stable. If it reaches the 'unstable_karma', it is unpushed.
"""
if not author: author = identity.current.user_name
+ critpath_approved = self.critpath_approved
# Hack: Add admin groups to usernames (eg: "lmacken (releng)")
admin_groups = config.get('admin_groups', 'releng qa
security_respons').split()
+
for group in identity.current.groups:
if group in admin_groups:
author += ' (%s)' % group
@@ -736,6 +738,14 @@ class PackageUpdate(SQLObject):
people.add(comment.author.split()[0])
mail.send(people, 'comment', self)
+ # If we're a Critical Path update for a pending release
+ if self.critpath and self.release.locked:
+ # If we weren't approved before, and now are, push to stable
+ if not critpath_approved and self.critpath_approved:
+ self.comment('Critical path update approved',
author='bodhi')
+ self.request = 'stable'
+ mail.send_admin('critpath_approved', self)
+
def unpush(self):
""" Move this update back to its dist-fX-updates-candidate tag
"""
koji = buildsys.get_session()
diff --git a/bodhi/tests/test_controllers.py b/bodhi/tests/test_controllers.py
index de6755e..b998952 100644
--- a/bodhi/tests/test_controllers.py
+++ b/bodhi/tests/test_controllers.py
@@ -1285,6 +1285,14 @@ class TestControllers(testutil.DBTest):
assert "Push to Stable" in cherrypy.response.body[0]
assert "Push to Testing" in cherrypy.response.body[0]
+ testutil.create_request('/updates/request/stable/%s' %
params['builds'],
+ method='GET', headers=session)
+ update = PackageUpdate.byTitle(params['builds'])
+
+ # We're allowing devs to still request critpath updates to stable
+ # without a karma prerequisite for non-pending releases.
+ assert update.request == 'stable'
+
def test_non_critpath_actions_in_normal_release(self):
session = login()
create_release()
@@ -1324,27 +1332,10 @@ class TestControllers(testutil.DBTest):
update = PackageUpdate.byTitle(params['builds'])
assert update.request == 'testing'
- def test_push_critpath_to_frozen_release_and_request_stable(self):
- session = login()
- create_release(locked=True)
- params = {
- 'builds' : 'kernel-2.6.31-1.fc7',
- 'release' : 'Fedora 7',
- 'type_' : 'bugfix',
- 'bugs' : '',
- 'notes' : 'foobar',
- 'stable_karma' : 1,
- 'request': 'stable',
- 'unstable_karma' : -1,
- }
- self.save_update(params, session)
- update = PackageUpdate.byTitle(params['builds'])
- assert update.request == 'testing'
-
# Ensure we can't create a stable request
testutil.capture_log(["bodhi.util", "bodhi.controllers",
"bodhi.model"])
testutil.create_request('/updates/request/stable/%s' %
params['builds'],
- method='POST', headers=session)
+ method='POST', headers=session)
log = testutil.get_log()
assert "Forcing critical path update into testing" in log
update = PackageUpdate.byTitle(params['builds'])
@@ -1367,6 +1358,15 @@ class TestControllers(testutil.DBTest):
update = PackageUpdate.byTitle(params['builds'])
assert update.request == 'testing'
+ # Ensure we can't create a stable request
+ testutil.capture_log(["bodhi.util", "bodhi.controllers",
"bodhi.model"])
+ testutil.create_request('/updates/request/stable/%s' %
params['builds'],
+ method='POST', headers=session)
+ log = testutil.get_log()
+ assert "Critical path update not yet approved!" in log, log
+ update = PackageUpdate.byTitle(params['builds'])
+ assert update.request == 'testing'
+
def test_critpath_to_frozen_release_available_actions(self):
"""
Ensure devs can attempt to push critpath updates for pending releases
@@ -1435,6 +1435,15 @@ class TestControllers(testutil.DBTest):
assert len(update.comments) == 1
assert update.comments[0].author == 'bob'
+ # Make sure not even releng can submit it to stable until it gets another
+ # approval
+ testutil.create_request('/updates/request/stable/%s' %
params['builds'],
+ method='GET', headers=releng)
+ update = PackageUpdate.byTitle(params['builds'])
+ assert update.request == 'testing'
+ assert update.karma == 1
+ update.request = None
+
# Have another developer +1 it, so it gets up to +2
# Ensure we can't push it to stable, until we get admin approval
testutil.create_request('/updates/comment?text=foobar&title=%s&karma=1' %
@@ -1444,8 +1453,11 @@ class TestControllers(testutil.DBTest):
method='GET',
headers=login(username='foobar'))
assert "Push Critical Path update to Stable" not in
cherrypy.response.body[0]
update = PackageUpdate.byTitle(params['builds'])
- assert not update.request
assert update.karma == 2
+ assert update.request == 'stable'
+
+ # Reset it, and have releng approve it as well
+ update.request = None
# Have releng try again, and ensure it can be pushed to stable
testutil.create_request('/updates/comment?text=foobar&title=%s&karma=1' %
@@ -1569,15 +1581,10 @@ class TestControllers(testutil.DBTest):
headers=login(username='bob'))
update = PackageUpdate.byTitle(params['builds'])
- assert len(update.comments) == 2
+ assert len(update.comments) == 3, update.comments
assert update.comments[1].author == 'bob', update.comments
-
- testutil.create_request('/updates/%s' % params['builds'],
- method='GET', headers=session)
- update = PackageUpdate.byTitle(params['builds'])
- assert update.comments[0].author == 'guest (qa)'
-
- assert "Mark Critical Path update as Stable" in
cherrypy.response.body[0], cherrypy.response.body[0]
+ assert update.comments[2].author == 'bodhi', update.comments
+ assert update.comments[2].text == 'Critical path update approved'
def test_created_since(self):
session = login()
commit b4814867cacae7f1f52b008545eea20291f4b900
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Jan 26 13:52:08 2010 -0500
Send an email to releng once critical path updates get approved
diff --git a/bodhi/mail.py b/bodhi/mail.py
index 1842e17..7cad3ee 100644
--- a/bodhi/mail.py
+++ b/bodhi/mail.py
@@ -227,6 +227,19 @@ the link below:
}
},
+ 'critpath_approved' : {
+ 'body' : u"""\
+The Critical Path update `%(package)s` has been approved.
+
+%(updatestr)s
+
+""",
+ 'fields' : lambda x: {
+ 'package' : x.title,
+ 'updatestr' : unicode(x)
+ }
+ },
+
}
fedora_errata_template = u"""\
diff --git a/bodhi/model.py b/bodhi/model.py
index 9a0ecbb..00d69bf 100644
--- a/bodhi/model.py
+++ b/bodhi/model.py
@@ -414,9 +414,11 @@ class PackageUpdate(SQLObject):
for group in identity.current.groups:
if group in admin_groups:
if not self.critpath_approved:
+ log.info("Critical path update not yet approved!")
action = 'testing'
self.comment('Critical path update approved',
author=identity.current.user_name)
+ mail.send_admin('critpath_approved', self)
break
else:
log.info('Forcing critical path update into testing')
commit d38f67834943129ea857a3fce3e9e9677a6ee0e4
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Jan 26 13:39:23 2010 -0500
Mark emails to admins as [CRITPATH] when necessary
diff --git a/bodhi/mail.py b/bodhi/mail.py
index 6c11187..1842e17 100644
--- a/bodhi/mail.py
+++ b/bodhi/mail.py
@@ -419,8 +419,9 @@ def send(to, msg_type, update, sender=None):
if type(to) not in (list, set, tuple):
to = [to]
for person in to:
- send_mail(sender, person, '[Fedora Update] [%s] %s' % (msg_type,
- update.title), messages[msg_type]['body'] %
+ send_mail(sender, person, '[Fedora Update] %s[%s] %s' % (
+ if update.critpath and '[CRITPATH] ' or '',
+ msg_type, update.title), messages[msg_type]['body'] %
messages[msg_type]['fields'](update))
def send_releng(subject, body):