Merge lp:~jtv/launchpad/bug-818032 into lp:launchpad

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Jeroen T. Vermeulen
Approved revision: no longer in the source branch.
Merged at revision: 13563
Proposed branch: lp:~jtv/launchpad/bug-818032
Merge into: lp:launchpad
Diff against target: 83 lines (+16/-5)
3 files modified
lib/lp/registry/browser/distroseries.py (+1/-1)
lib/lp/registry/browser/tests/test_distroseries.py (+11/-4)
lib/lp/services/features/flags.py (+4/-0)
To merge this branch: bzr merge lp:~jtv/launchpad/bug-818032
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Approve
Review via email: mp+69791@code.launchpad.net

Commit message

[r=bac][bug=818032] Disable Upgrade Packages button.

Description of the change

= Summary =

Disable the Upgrade Packages button for now. It's too dangerous and, in a few nasty corner cases, does not do what we want.

== Proposed fix ==

The mass-upgrade is behind the same feature flag as package sync. The flag name mentions "sync" but not "upgrade." Give the mass upgrade its own feature flag, which will be disabled by default.

== Pre-implementation notes ==

We may still want to enable the button for derived distributions later; for now, we can't have it in Ubuntu. Removing the code (as I originally wanted to do) would cut pretty deep, and dispose of things we hope the able to use again.

== Tests ==

{{{
./bin/test -vvc lp.registry.browser.tests.test_distroseries
}}}

== Demo and Q/A ==

The DistroSeries:+localpackagediffs page will no longer have the Upgrade Packages button, even if you are privileged and do see the Sync button.

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/registry/browser/tests/test_distroseries.py
  lib/lp/services/features/flags.py
  lib/lp/registry/browser/distroseries.py

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :

This change looks good Jeroen.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/browser/distroseries.py'
2--- lib/lp/registry/browser/distroseries.py 2011-07-28 18:35:44 +0000
3+++ lib/lp/registry/browser/distroseries.py 2011-07-29 13:42:35 +0000
4@@ -1190,7 +1190,7 @@
5
6 def canUpgrade(self, action=None):
7 """Should the form offer a packages upgrade?"""
8- if getFeatureFlag("soyuz.derived_series_sync.enabled") is None:
9+ if getFeatureFlag("soyuz.derived_series_upgrade.enabled") is None:
10 return False
11 elif self.context.status not in UPGRADABLE_SERIES_STATUSES:
12 # A feature freeze precludes blanket updates.
13
14=== modified file 'lib/lp/registry/browser/tests/test_distroseries.py'
15--- lib/lp/registry/browser/tests/test_distroseries.py 2011-07-28 18:35:44 +0000
16+++ lib/lp/registry/browser/tests/test_distroseries.py 2011-07-29 13:42:35 +0000
17@@ -1386,10 +1386,17 @@
18 self.assertContentEqual([dsd], view.getUpgrades())
19
20 def enableDerivedSeriesSyncFeature(self):
21+ """Enable the feature flag for derived-series sync."""
22 self.useFixture(
23 FeatureFixture(
24 {u'soyuz.derived_series_sync.enabled': u'on'}))
25
26+ def enableDerivedSeriesUpgradeFeature(self):
27+ """Enable the feature flag for derived-series upgrade."""
28+ self.useFixture(
29+ FeatureFixture(
30+ {u'soyuz.derived_series_upgrade.enabled': u'on'}))
31+
32 @with_celebrity_logged_in("admin")
33 def test_upgrades_offered_only_with_feature_flag(self):
34 # The "Upgrade Packages" button will only be shown when a specific
35@@ -1397,13 +1404,13 @@
36 view = self.makeView()
37 self.makePackageUpgrade(view.context)
38 self.assertFalse(view.canUpgrade())
39- self.enableDerivedSeriesSyncFeature()
40+ self.enableDerivedSeriesUpgradeFeature()
41 self.assertTrue(view.canUpgrade())
42
43 def test_upgrades_are_offered_if_appropriate(self):
44 # The "Upgrade Packages" button will only be shown to privileged
45 # users.
46- self.enableDerivedSeriesSyncFeature()
47+ self.enableDerivedSeriesUpgradeFeature()
48 dsd = self.makePackageUpgrade()
49 view = self.makeView(dsd.derived_series)
50 with celebrity_logged_in("admin"):
51@@ -1417,7 +1424,7 @@
52 def test_upgrades_offered_only_if_available(self):
53 # If there are no upgrades, the "Upgrade Packages" button won't
54 # be shown.
55- self.enableDerivedSeriesSyncFeature()
56+ self.enableDerivedSeriesUpgradeFeature()
57 view = self.makeView()
58 self.assertFalse(view.canUpgrade())
59 self.makePackageUpgrade(view.context)
60@@ -1428,7 +1435,7 @@
61 # There won't be an "Upgrade Packages" button once feature
62 # freeze has occurred. Mass updates would not make sense after
63 # that point.
64- self.enableDerivedSeriesSyncFeature()
65+ self.enableDerivedSeriesUpgradeFeature()
66 upgradeable = {}
67 for status in SeriesStatus.items:
68 dsd = self.makePackageUpgrade()
69
70=== modified file 'lib/lp/services/features/flags.py'
71--- lib/lp/services/features/flags.py 2011-07-21 03:13:36 +0000
72+++ lib/lp/services/features/flags.py 2011-07-29 13:42:35 +0000
73@@ -88,6 +88,10 @@
74 'boolean',
75 'Enables syncing of packages on derivative distributions pages.',
76 ''),
77+ ('soyuz.derived_series_upgrade.enabled',
78+ 'boolean',
79+ 'Enables mass-upgrade of packages on derivative distributions pages.',
80+ ''),
81 ('soyuz.derived_series_jobs.enabled',
82 'boolean',
83 "Compute package differences for derived distributions.",