Browse Source

migrations(plugins): move Slack and PagerDuty plugins from test_only_plugins to new_plugins (#15582)

Stephen Cefali 5 years ago
parent
commit
3160afb979

+ 0 - 1
.travis.yml

@@ -245,7 +245,6 @@ matrix:
 
   allow_failures:
     - name: 'Storybook Deploy'
-    - name: 'Plugins'
 
 notifications:
   webhooks:

+ 1 - 1
conftest.py

@@ -36,7 +36,7 @@ def install_sentry_plugins():
 
     from sentry.runner.initializer import register_plugins
 
-    register_plugins(settings, test_plugins=True)
+    register_plugins(settings)
 
     settings.ASANA_CLIENT_ID = "abc"
     settings.ASANA_CLIENT_SECRET = "123"

+ 2 - 4
setup.py

@@ -155,19 +155,17 @@ setup(
             "heroku = new_sentry_plugins.heroku.plugin:HerokuPlugin",
             "jira = new_sentry_plugins.jira.plugin:JiraPlugin",
             "jira_ac = new_sentry_plugins.jira_ac.plugin:JiraACPlugin",
+            "pagerduty = new_sentry_plugins.pagerduty.plugin:PagerDutyPlugin",
             "phabricator = new_sentry_plugins.phabricator.plugin:PhabricatorPlugin",
             "pivotal = new_sentry_plugins.pivotal.plugin:PivotalPlugin",
             "pushover = new_sentry_plugins.pushover.plugin:PushoverPlugin",
             "segment = new_sentry_plugins.segment.plugin:SegmentPlugin",
             "sessionstack = new_sentry_plugins.sessionstack.plugin:SessionStackPlugin",
+            "slack = new_sentry_plugins.slack.plugin:SlackPlugin",
             "splunk = new_sentry_plugins.splunk.plugin:SplunkPlugin",
             "victorops = new_sentry_plugins.victorops.plugin:VictorOpsPlugin",
             "vsts = new_sentry_plugins.vsts.plugin:VstsPlugin",
         ],
-        "sentry.test_only_plugins": [
-            "pagerduty = test_only_plugins.pagerduty.plugin:PagerDutyPlugin",
-            "slack = test_only_plugins.slack.plugin:SlackPlugin",
-        ],
     },
     classifiers=[
         "Framework :: Django",

+ 1 - 1
src/test_only_plugins/pagerduty/__init__.py → src/new_sentry_plugins/pagerduty/__init__.py

@@ -1,5 +1,5 @@
 from __future__ import absolute_import
 
-from test_only_plugins.base import assert_package_not_installed
+from new_sentry_plugins.base import assert_package_not_installed
 
 assert_package_not_installed("sentry-pagerduty")

+ 1 - 1
src/test_only_plugins/pagerduty/client.py → src/new_sentry_plugins/pagerduty/client.py

@@ -1,7 +1,7 @@
 from __future__ import absolute_import
 
 from sentry.utils.http import absolute_uri
-from test_only_plugins.client import ApiClient
+from new_sentry_plugins.client import ApiClient
 
 # https://v2.developer.pagerduty.com/docs/events-api
 INTEGRATION_API_URL = "https://events.pagerduty.com/generic/2010-04-15/create_event.json"

+ 2 - 2
src/test_only_plugins/pagerduty/plugin.py → src/new_sentry_plugins/pagerduty/plugin.py

@@ -5,8 +5,8 @@ import six
 from sentry.plugins.bases.notify import NotifyPlugin
 from sentry.utils.http import absolute_uri
 
-from test_only_plugins.base import CorePluginMixin
-from test_only_plugins.utils import get_secret_field_config
+from new_sentry_plugins.base import CorePluginMixin
+from new_sentry_plugins.utils import get_secret_field_config
 
 from .client import PagerDutyClient
 

+ 0 - 0
src/test_only_plugins/slack/README.rst → src/new_sentry_plugins/slack/README.rst


+ 1 - 1
src/test_only_plugins/slack/__init__.py → src/new_sentry_plugins/slack/__init__.py

@@ -1,5 +1,5 @@
 from __future__ import absolute_import
 
-from test_only_plugins.base import assert_package_not_installed
+from new_sentry_plugins.base import assert_package_not_installed
 
 assert_package_not_installed("sentry-slack")

+ 1 - 1
src/test_only_plugins/slack/plugin.py → src/new_sentry_plugins/slack/plugin.py

@@ -5,7 +5,7 @@ from sentry.plugins.bases import notify
 from sentry.utils import json
 from sentry.utils.http import absolute_uri
 
-from test_only_plugins.base import CorePluginMixin
+from new_sentry_plugins.base import CorePluginMixin
 
 LEVEL_TO_COLOR = {
     "debug": "cfd3da",

+ 11 - 17
src/sentry/runner/initializer.py

@@ -11,7 +11,7 @@ from sentry.utils.sdk import configure_sdk
 from sentry.utils.warnings import DeprecatedSettingWarning
 
 
-def register_plugins(settings, test_plugins=False):
+def register_plugins(settings):
     from pkg_resources import iter_entry_points
     from sentry.plugins.base import plugins
 
@@ -20,23 +20,17 @@ def register_plugins(settings, test_plugins=False):
     #         'phabricator = sentry_phabricator.plugins:PhabricatorPlugin'
     #     ],
     # },
-    entry_points = [
-        "sentry.new_plugins",
-        "sentry.test_only_plugins" if test_plugins else "sentry.plugins",
-    ]
-
-    for entry_point in entry_points:
-        for ep in iter_entry_points(entry_point):
-            try:
-                plugin = ep.load()
-            except Exception:
-                import traceback
+    for ep in iter_entry_points("sentry.new_plugins"):
+        try:
+            plugin = ep.load()
+        except Exception:
+            import traceback
 
-                click.echo(
-                    "Failed to load plugin %r:\n%s" % (ep.name, traceback.format_exc()), err=True
-                )
-            else:
-                plugins.register(plugin)
+            click.echo(
+                "Failed to load plugin %r:\n%s" % (ep.name, traceback.format_exc()), err=True
+            )
+        else:
+            plugins.register(plugin)
 
     for plugin in plugins.all(version=None):
         init_plugin(plugin)

Some files were not shown because too many files changed in this diff