launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #28893
[Merge] ~cjwatson/launchpad:remove-webhooks-new-enabled-flag into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:remove-webhooks-new-enabled-flag into launchpad:master.
Commit message:
Remove webhooks.new.enabled feature rule
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/427431
It's been enabled on all our environments for some time.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:remove-webhooks-new-enabled-flag into launchpad:master.
diff --git a/lib/lp/charms/browser/charmrecipe.py b/lib/lp/charms/browser/charmrecipe.py
index 72321f9..f80aebb 100644
--- a/lib/lp/charms/browser/charmrecipe.py
+++ b/lib/lp/charms/browser/charmrecipe.py
@@ -144,10 +144,7 @@ class CharmRecipeNavigationMenu(NavigationMenu):
"+webhooks",
"Manage webhooks",
icon="edit",
- enabled=(
- bool(getFeatureFlag(CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG))
- and bool(getFeatureFlag("webhooks.new.enabled"))
- ),
+ enabled=bool(getFeatureFlag(CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG)),
)
@enabled_with_permission("launchpad.Edit")
diff --git a/lib/lp/code/browser/branch.py b/lib/lp/code/browser/branch.py
index 1442323..1ecf228 100644
--- a/lib/lp/code/browser/branch.py
+++ b/lib/lp/code/browser/branch.py
@@ -238,12 +238,7 @@ class BranchEditMenu(NavigationMenu):
@enabled_with_permission("launchpad.Edit")
def webhooks(self):
text = "Manage webhooks"
- return Link(
- "+webhooks",
- text,
- icon="edit",
- enabled=bool(getFeatureFlag("webhooks.new.enabled")),
- )
+ return Link("+webhooks", text, icon="edit")
class BranchContextMenu(ContextMenu, HasRecipesMenuMixin, HasSnapsMenuMixin):
diff --git a/lib/lp/code/browser/gitrepository.py b/lib/lp/code/browser/gitrepository.py
index 8fa17b5..da7dc76 100644
--- a/lib/lp/code/browser/gitrepository.py
+++ b/lib/lp/code/browser/gitrepository.py
@@ -301,12 +301,7 @@ class GitRepositoryEditMenu(NavigationMenu):
@enabled_with_permission("launchpad.Edit")
def webhooks(self):
text = "Manage webhooks"
- return Link(
- "+webhooks",
- text,
- icon="edit",
- enabled=bool(getFeatureFlag("webhooks.new.enabled")),
- )
+ return Link("+webhooks", text, icon="edit")
@enabled_with_permission("launchpad.Edit")
def delete(self):
diff --git a/lib/lp/oci/tests/test_ocirecipebuildjob.py b/lib/lp/oci/tests/test_ocirecipebuildjob.py
index 07a60ce..9722ae4 100644
--- a/lib/lp/oci/tests/test_ocirecipebuildjob.py
+++ b/lib/lp/oci/tests/test_ocirecipebuildjob.py
@@ -215,7 +215,6 @@ class TestOCIRegistryUploadJob(
self.useFixture(
FeatureFixture(
{
- "webhooks.new.enabled": "true",
OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
OCI_RECIPE_ALLOW_CREATE: "on",
}
@@ -642,7 +641,6 @@ class TestOCIRegistryUploadJobViaCelery(
self.useFixture(
FeatureFixture(
{
- "webhooks.new.enabled": "true",
OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
OCI_RECIPE_ALLOW_CREATE: "on",
"jobs.celery.enabled_classes": "OCIRegistryUploadJob",
diff --git a/lib/lp/services/webhooks/interfaces.py b/lib/lp/services/webhooks/interfaces.py
index 7a546c3..b31f29d 100644
--- a/lib/lp/services/webhooks/interfaces.py
+++ b/lib/lp/services/webhooks/interfaces.py
@@ -16,17 +16,13 @@ __all__ = [
"WEBHOOK_EVENT_TYPES",
"WebhookDeliveryFailure",
"WebhookDeliveryRetry",
- "WebhookFeatureDisabled",
"ValidWebhookEventTypeVocabulary",
]
-import http.client
-
from lazr.lifecycle.snapshot import doNotSnapshot
from lazr.restful.declarations import (
REQUEST_USER,
call_with,
- error_status,
export_destructor_operation,
export_factory_operation,
export_write_operation,
@@ -62,14 +58,6 @@ WEBHOOK_EVENT_TYPES = {
}
-@error_status(http.client.UNAUTHORIZED)
-class WebhookFeatureDisabled(Exception):
- """Only certain users can create new webhooks."""
-
- def __init__(self):
- Exception.__init__(self, "This webhook feature is not available yet.")
-
-
class WebhookDeliveryFailure(Exception):
"""A webhook delivery failed and should not be retried."""
diff --git a/lib/lp/services/webhooks/model.py b/lib/lp/services/webhooks/model.py
index c2127da..2cff028 100644
--- a/lib/lp/services/webhooks/model.py
+++ b/lib/lp/services/webhooks/model.py
@@ -38,7 +38,6 @@ from lp.services.database.decoratedresultset import DecoratedResultSet
from lp.services.database.enumcol import DBEnum
from lp.services.database.interfaces import IMasterStore, IStore
from lp.services.database.stormbase import StormBase
-from lp.services.features import getFeatureFlag
from lp.services.job.model.job import EnumeratedSubclass, Job
from lp.services.job.runner import BaseRunnableJob
from lp.services.memoizer import memoize
@@ -55,7 +54,6 @@ from lp.services.webhooks.interfaces import (
IWebhookSet,
WebhookDeliveryFailure,
WebhookDeliveryRetry,
- WebhookFeatureDisabled,
)
@@ -301,8 +299,6 @@ class WebhookTargetMixin:
def newWebhook(
self, registrant, delivery_url, event_types, active=True, secret=None
):
- if not getFeatureFlag("webhooks.new.enabled"):
- raise WebhookFeatureDisabled()
return getUtility(IWebhookSet).new(
self, registrant, delivery_url, event_types, active, secret
)
diff --git a/lib/lp/services/webhooks/tests/test_browser.py b/lib/lp/services/webhooks/tests/test_browser.py
index 938671c..fa282fc 100644
--- a/lib/lp/services/webhooks/tests/test_browser.py
+++ b/lib/lp/services/webhooks/tests/test_browser.py
@@ -100,13 +100,6 @@ class SnapTestHelpers:
]
def makeTarget(self):
- self.useFixture(
- FeatureFixture(
- {
- "webhooks.new.enabled": "true",
- }
- )
- )
owner = self.factory.makePerson()
return self.factory.makeSnap(registrant=owner, owner=owner)
@@ -127,7 +120,6 @@ class LiveFSTestHelpers:
self.useFixture(
FeatureFixture(
{
- "webhooks.new.enabled": "true",
LIVEFS_FEATURE_FLAG: "on",
LIVEFS_WEBHOOKS_FEATURE_FLAG: "on",
}
@@ -153,7 +145,6 @@ class OCIRecipeTestHelpers:
self.useFixture(
FeatureFixture(
{
- "webhooks.new.enabled": "true",
OCI_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
OCI_RECIPE_ALLOW_CREATE: "on",
}
@@ -180,7 +171,6 @@ class CharmRecipeTestHelpers:
self.useFixture(
FeatureFixture(
{
- "webhooks.new.enabled": "true",
CHARM_RECIPE_ALLOW_CREATE: "on",
CHARM_RECIPE_WEBHOOKS_FEATURE_FLAG: "on",
}
@@ -196,7 +186,6 @@ class CharmRecipeTestHelpers:
class WebhookTargetViewTestHelpers:
def setUp(self):
super().setUp()
- self.useFixture(FeatureFixture({"webhooks.new.enabled": "true"}))
self.target = self.makeTarget()
self.owner = self.target.owner
login_person(self.owner)
@@ -515,7 +504,6 @@ class TestWebhookAddViewCharmRecipe(
class WebhookViewTestHelpers:
def setUp(self):
super().setUp()
- self.useFixture(FeatureFixture({"webhooks.new.enabled": "true"}))
self.target = self.makeTarget()
self.owner = self.target.owner
self.webhook = self.factory.makeWebhook(
diff --git a/lib/lp/services/webhooks/tests/test_webservice.py b/lib/lp/services/webhooks/tests/test_webservice.py
index 89bc6b0..fed30a0 100644
--- a/lib/lp/services/webhooks/tests/test_webservice.py
+++ b/lib/lp/services/webhooks/tests/test_webservice.py
@@ -401,7 +401,6 @@ class TestWebhookTargetBase:
self.assertThat(recorder2, HasQueryCount.byEquality(recorder1))
def test_newWebhook(self):
- self.useFixture(FeatureFixture({"webhooks.new.enabled": "true"}))
response = self.webservice.named_post(
self.target_url,
"newWebhook",
@@ -423,7 +422,6 @@ class TestWebhookTargetBase:
)
def test_newWebhook_secret(self):
- self.useFixture(FeatureFixture({"webhooks.new.enabled": "true"}))
response = self.webservice.named_post(
self.target_url,
"newWebhook",
@@ -443,7 +441,6 @@ class TestWebhookTargetBase:
self.assertNotIn("secret", representation["entries"][0])
def test_newWebhook_permissions(self):
- self.useFixture(FeatureFixture({"webhooks.new.enabled": "true"}))
webservice = webservice_for_person(None)
response = webservice.named_post(
self.target_url,
@@ -455,19 +452,6 @@ class TestWebhookTargetBase:
self.assertEqual(401, response.status)
self.assertIn(b"launchpad.Edit", response.body)
- def test_newWebhook_feature_flag_guard(self):
- response = self.webservice.named_post(
- self.target_url,
- "newWebhook",
- delivery_url="http://example.com/ep",
- event_types=[self.event_type],
- api_version="devel",
- )
- self.assertEqual(401, response.status)
- self.assertEqual(
- b"This webhook feature is not available yet.", response.body
- )
-
class TestWebhookTargetGitRepository(
TestWebhookTargetBase, TestCaseWithFactory
diff --git a/lib/lp/snappy/browser/snap.py b/lib/lp/snappy/browser/snap.py
index 13fbe82..3ed5c9c 100644
--- a/lib/lp/snappy/browser/snap.py
+++ b/lib/lp/snappy/browser/snap.py
@@ -255,12 +255,7 @@ class SnapNavigationMenu(NavigationMenu):
@enabled_with_permission("launchpad.Edit")
def webhooks(self):
- return Link(
- "+webhooks",
- "Manage webhooks",
- icon="edit",
- enabled=bool(getFeatureFlag("webhooks.new.enabled")),
- )
+ return Link("+webhooks", "Manage webhooks", icon="edit")
@enabled_with_permission("launchpad.Edit")
def authorize(self):