bodhi/config/app.cfg | 2 +-
bodhi/jobs.py | 4 ++--
bodhi/masher.py | 17 +++++++++--------
bodhi/overrides.py | 43 +++++++++++++++++++++++++------------------
bodhi/widgets.py | 3 ++-
5 files changed, 39 insertions(+), 30 deletions(-)
New commits:
commit 2b96812f14bb9320b7d40a192dede24cd4c55b85
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Apr 26 16:58:56 2011 -0400
More buildroot override changes
- Add a calendar date picker for expiration (defaults to 1 day)
- Make our koji handling more robust
- Improved error handling
- Auto expire updates once they go to stable (not testing)
- Run the auto-expiration job every hour
diff --git a/bodhi/config/app.cfg b/bodhi/config/app.cfg
index 73d8911..a500b02 100644
--- a/bodhi/config/app.cfg
+++ b/bodhi/config/app.cfg
@@ -220,7 +220,7 @@ feeds.max_entries = 20
## Buildroot Override Settings
# Number of days before expiring overrides
-buildroot_overrides.expire_after = 4
+buildroot_overrides.expire_after = 1
# VIEW
diff --git a/bodhi/jobs.py b/bodhi/jobs.py
index 4b0bbf3..6e65508 100644
--- a/bodhi/jobs.py
+++ b/bodhi/jobs.py
@@ -272,7 +272,7 @@ def schedule():
log.debug("Scheduling expire_buildroot_overrides job")
scheduler.add_interval_task(action=expire_buildroot_overrides,
# Run every 6 hours
- initialdelay=21600,
- interval=21600)
+ initialdelay=3600,
+ interval=3600)
#weekdays=range(1,8),
#timeonday=(0,0))
diff --git a/bodhi/masher.py b/bodhi/masher.py
index 3247df9..cc4553f 100644
--- a/bodhi/masher.py
+++ b/bodhi/masher.py
@@ -476,14 +476,15 @@ class MashTask(Thread):
def obsolete_buildroot_overrides(self):
""" Obsolete any buildroot overrides that are in this push
"""
for update in self.updates:
- for build in update.builds:
- try:
- override = BuildRootOverride.byBuild(build.nvr)
- log.info('Expiring buildroot override: %s' % build.nvr)
- override.untag()
- override.destroySelf()
- except SQLObjectNotFound:
- pass
+ if update.request == 'stable':
+ for build in update.builds:
+ try:
+ override = BuildRootOverride.byBuild(build.nvr)
+ log.info('Expiring buildroot override: %s' % build.nvr)
+ override.untag()
+ override.destroySelf()
+ except SQLObjectNotFound:
+ pass
# With a large pushes, this tends to cause much buildsystem churn, as well
# as polluting the tag history.
diff --git a/bodhi/overrides.py b/bodhi/overrides.py
index 2bc9a80..d443645 100644
--- a/bodhi/overrides.py
+++ b/bodhi/overrides.py
@@ -39,19 +39,22 @@ class BuildRootOverrideController(Controller):
@paginate('overrides', default_order='-date_submitted',
limit=20, max_limit=1000)
def index(self, build=None, tg_errors=None, *args, **kw):
- overrides = BuildRootOverride.select()
+ if 'releng' in identity.current.groups:
+ overrides = BuildRootOverride.select()
+ else:
+ overrides = BuildRootOverride.select(
+ BuildRootOverride.q.submitter == identity.current.user_name)
return dict(overrides=overrides, title='Buildroot Overrides',
num_items=overrides.count())
@expose(template="bodhi.templates.form")
- def new(self, build=None, tg_errors=None, *args, **kw):
- if tg_errors:
- flash(tg_errors)
- if build:
- log.debug('redirecting!')
- raise redirect('/override/%s' % build)
- return dict(form=override_form, values={}, action=url('/override/save'),
- title='Buildroot Overrides')
+ def new(self, tg_errors=None, *args, **kw):
+ #if tg_errors:
+ # flash(tg_errors)
+ expiration = datetime.utcnow() + \
+ timedelta(days=config.get('buildroot_overrides.expire_after', 1))
+ return dict(form=override_form, values={'expiration': expiration},
+ action=url('/override/save'), title='Buildroot
Overrides')
@expose(allow_json=True)
def expire(self, build, *args, **kw):
@@ -74,8 +77,17 @@ class BuildRootOverrideController(Controller):
@expose('json')
@validate(form=override_form)
@error_handler(new)
- def save(self, builds, notes, *args, **kw):
+ def save(self, builds, notes, expiration, *args, **kw):
log.debug('BuildRootOverrideController.save(%s)' % builds)
+
+ try:
+ koji = get_session()
+ except Exception, e:
+ flash('Unable to connect to Koji')
+ if request_format() == 'json':
+ return dict()
+ raise redirect('/override/new')
+
for build in builds:
release = None
n, v, r = get_nvr(build)
@@ -86,7 +98,6 @@ class BuildRootOverrideController(Controller):
flash("Error: You do not have commit privileges to %s" % n)
# Make sure the build is tagged correctly
- koji = get_session()
try:
tags = [tag['name'] for tag in koji.listTags(build)]
except Exception, e:
@@ -109,19 +120,15 @@ class BuildRootOverrideController(Controller):
if not release:
flash('Error: Could not determine release for %s with tags %s' %
- (builds, tags))
+ (build, map(str, tags)))
if request_format() == 'json':
return dict()
- raise redirect('/override')
+ raise redirect('/override/new')
# Create a new overrides object
override = BuildRootOverride(build=build,
notes=notes, submitter=identity.current.user_name,
- releaseID=release.id)
-
- now = datetime.utcnow()
- override.expiration = now + \
- timedelta(days=config.get('buildroot_overrides.expire_after'))
+ expiration=expiration, releaseID=release.id)
# Tag the build
override.tag()
diff --git a/bodhi/widgets.py b/bodhi/widgets.py
index 3f294f1..3b897e9 100644
--- a/bodhi/widgets.py
+++ b/bodhi/widgets.py
@@ -17,7 +17,7 @@ from turbogears import validators, config
from turbogears.widgets import (Form, TextField, SubmitButton, TextArea,
AutoCompleteField, SingleSelectField, CheckBox,
HiddenField, RemoteForm, CheckBoxList, JSLink,
- DataGrid, CSSLink)
+ DataGrid, CSSLink, CalendarDatePicker)
from bodhi.util import make_update_link, url
from bodhi.validators import *
@@ -203,5 +203,6 @@ class BuildRootOverrideForm(Form):
validator=AutoCompleteValidator()),
TextArea('notes', validator=validators.UnicodeString(),
rows=13, cols=65),
+ CalendarDatePicker('expiration')
]
submit_text = "Submit"