launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #23934
[Merge] lp:~twom/launchpad/sometimes-mirrors-are-broken into lp:launchpad
Tom Wardill has proposed merging lp:~twom/launchpad/sometimes-mirrors-are-broken into lp:launchpad.
Commit message:
Add a BROKEN state for mirrors and allow them to be resubmitted
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1839229 in Launchpad itself: "Allow another status other than 'Official' and 'Unofficial' for Ubuntu mirrors pending review"
https://bugs.launchpad.net/launchpad/+bug/1839229
For more details, see:
https://code.launchpad.net/~twom/launchpad/sometimes-mirrors-are-broken/+merge/372015
A mirror can be submitted for review that obviously does not work, even before probing (DNS failure, incorrect url, etc).
Currently the only option is to mark these as 'UNOFFICIAL' or they clutter the pendingreview view.
This MP adds a 'BROKEN' state, and allows the owner of the archive to resubmit the archive once it is fixed or the details edited.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~twom/launchpad/sometimes-mirrors-are-broken into lp:launchpad.
=== modified file 'lib/lp/registry/browser/configure.zcml'
--- lib/lp/registry/browser/configure.zcml 2017-07-31 11:45:32 +0000
+++ lib/lp/registry/browser/configure.zcml 2019-08-29 17:15:53 +0000
@@ -2439,6 +2439,13 @@
template="../templates/distributionmirror-edit.pt">
</browser:page>
<browser:page
+ name="+resubmit"
+ for="lp.registry.interfaces.distributionmirror.IDistributionMirror"
+ class="lp.registry.browser.distributionmirror.DistributionMirrorResubmitView"
+ permission="launchpad.Edit"
+ template="../templates/distributionmirror-resubmit.pt">
+ </browser:page>
+ <browser:page
name="+review"
for="lp.registry.interfaces.distributionmirror.IDistributionMirror"
class="lp.registry.browser.distributionmirror.DistributionMirrorReviewView"
=== modified file 'lib/lp/registry/browser/distributionmirror.py'
--- lib/lp/registry/browser/distributionmirror.py 2015-10-13 13:22:08 +0000
+++ lib/lp/registry/browser/distributionmirror.py 2019-08-29 17:15:53 +0000
@@ -52,7 +52,7 @@
usedfor = IDistributionMirror
facet = 'overview'
- links = ['proberlogs', 'edit', 'review', 'reassign', 'delete']
+ links = ['proberlogs', 'edit', 'review', 'reassign', 'delete', 'resubmit']
@enabled_with_permission('launchpad.Edit')
def edit(self):
@@ -81,6 +81,11 @@
text = 'Review mirror'
return Link('+review', text, icon='edit')
+ @enabled_with_permission('launchpad.Edit')
+ def resubmit(self):
+ text = 'Resubmit for review'
+ return Link('+resubmit', text, icon='edit')
+
class _FlavoursByDistroSeries:
"""A simple class to help when rendering a table of series and flavours
@@ -293,6 +298,27 @@
self.next_url = canonical_url(self.context)
+class DistributionMirrorResubmitView(LaunchpadEditFormView):
+
+ schema = IDistributionMirror
+ field_names = []
+
+ @property
+ def label(self):
+ """See `LaunchpadFormView`."""
+ return 'Resubmit mirror %s' % self.context.title
+
+ @property
+ def page_title(self):
+ """The page title."""
+ return self.label
+
+ @action(_("Resubmit"), name="resubmit")
+ def action_resubmit(self, action, data):
+ self.context.resubmitForReview()
+ self.next_url = canonical_url(self.context)
+
+
class DistributionMirrorReassignmentView(ObjectReassignmentView):
@property
=== modified file 'lib/lp/registry/browser/tests/distributionmirror-views.txt'
--- lib/lp/registry/browser/tests/distributionmirror-views.txt 2019-05-22 14:57:45 +0000
+++ lib/lp/registry/browser/tests/distributionmirror-views.txt 2019-08-29 17:15:53 +0000
@@ -283,6 +283,32 @@
False
+Resubmit distribution mirror
+----------------------------
+
+The mirror owner can resubmit a 'Broken' mirror for a new review.
+
+ >>> login('karl@xxxxxxxxxxxxx')
+ >>> review_form['field.status'] = 'BROKEN'
+ >>> review_form['field.whiteboard'] = 'This site is broken.'
+ >>> view = create_initialized_view(mirror, '+review', form=review_form)
+ >>> form['field.actions.resubmit'] = 'Resubmit'
+ >>> view = create_initialized_view(mirror, '+resubmit', form=form)
+ >>> print mirror.status.name
+ PENDING_REVIEW
+
+The resubmit view should only be available to people with launchpad.Edit.
+
+ >>> login('karl@xxxxxxxxxxxxx')
+ >>> view = create_initialized_view(mirror, '+resubmit')
+ >>> check_permission('launchpad.Edit', view)
+ True
+
+ >>> login('no-priv@xxxxxxxxxxxxx')
+ >>> check_permission('launchpad.Edit', view)
+ False
+
+
Delete distribution mirror
--------------------------
@@ -376,7 +402,7 @@
Antarctica
The page shows which kind of mirror a mirror is:
-
+
>>> print extract_text(find_tag_by_id(content, 'type'))
Type:
Archive
=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml 2018-04-22 23:30:37 +0000
+++ lib/lp/registry/configure.zcml 2019-08-29 17:15:53 +0000
@@ -2010,6 +2010,7 @@
getSummarizedMirroredArchSeries
getOverallFreshness
isOfficial
+ resubmitForReview
shouldDisable
disable
newProbeRecord
@@ -2027,7 +2028,8 @@
permission="launchpad.Edit"
set_attributes="name display_name description whiteboard
http_base_url ftp_base_url rsync_base_url enabled
- speed country content official_candidate owner"
+ speed country content official_candidate owner
+ resubmitForReview"
attributes="official_candidate whiteboard" />
<require
permission="launchpad.Admin"
=== modified file 'lib/lp/registry/interfaces/distributionmirror.py'
--- lib/lp/registry/interfaces/distributionmirror.py 2015-10-26 14:54:43 +0000
+++ lib/lp/registry/interfaces/distributionmirror.py 2019-08-29 17:15:53 +0000
@@ -244,6 +244,13 @@
the official mirrors for its distribution.
""")
+ BROKEN = DBItem(40, """
+ Broken
+
+ This mirror has been reviewed and seems to not respond or
+ is otherwise misconfigured.
+ """)
+
class DistributionMirrorNameField(ContentNameField):
errormessage = _("%s is already in use by another distribution mirror.")
@@ -502,6 +509,12 @@
previously enabled or if it was probed only once.
"""
+ def resubmitForReview():
+ """Allow the owner (launchpad.Edit) to resubmit for review.
+
+ Only allows the transition state from 'Broken' to 'Pending Review'.
+ """
+
def newProbeRecord(log_file):
"""Create and return a new MirrorProbeRecord for this mirror."""
=== modified file 'lib/lp/registry/model/distributionmirror.py'
--- lib/lp/registry/model/distributionmirror.py 2015-10-13 13:22:08 +0000
+++ lib/lp/registry/model/distributionmirror.py 2019-08-29 17:15:53 +0000
@@ -331,6 +331,12 @@
return (self.official_candidate
and self.status == MirrorStatus.OFFICIAL)
+ def resubmitForReview(self):
+ """See IDistributionMirror"""
+ if self.status != MirrorStatus.BROKEN:
+ raise AssertionError("DistributionMirror.status is not BROKEN")
+ self.status = MirrorStatus.PENDING_REVIEW
+
def shouldDisable(self, expected_file_count=None):
"""See IDistributionMirror"""
if self.content == MirrorContent.RELEASE:
=== added file 'lib/lp/registry/templates/distributionmirror-resubmit.pt'
--- lib/lp/registry/templates/distributionmirror-resubmit.pt 1970-01-01 00:00:00 +0000
+++ lib/lp/registry/templates/distributionmirror-resubmit.pt 2019-08-29 17:15:53 +0000
@@ -0,0 +1,18 @@
+<html
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:tal="http://xml.zope.org/namespaces/tal"
+ xmlns:metal="http://xml.zope.org/namespaces/metal"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n"
+ metal:use-macro="view/macro:page/main_only"
+ i18n:domain="launchpad">
+ <body>
+ <div metal:fill-slot="main">
+ <div metal:use-macro="context/@@launchpad_form/form">
+ <p metal:fill-slot="extra_top" class="documentDescription">
+ This will resubmit this archive to the review queue and set
+ the status to 'Pending Review'.
+ </p>
+ </div>
+ </div>
+ </body>
+</html>
Follow ups