Skip to content

Commit 0a55cd2

Browse files
authored
🔧 chore(integrations): remove disabled integration logic (#92210)
this logic has been broken and disabled for year+ now. deleting the code for it. if we rebuild it, we can checkout this commit in the future Contributes to ECO-542
1 parent c606f7a commit 0a55cd2

File tree

15 files changed

+5
-1090
lines changed

15 files changed

+5
-1090
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ module = [
255255
"sentry.integrations.source_code_management.repository",
256256
"sentry.integrations.vsts.actions.*",
257257
"sentry.integrations.vsts.tasks.*",
258-
"sentry.integrations.web.debug.*",
259258
"sentry.issues",
260259
"sentry.issues.analytics",
261260
"sentry.issues.apps",

src/sentry/integrations/base.py

Lines changed: 2 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,17 @@
1212
from rest_framework.exceptions import NotFound
1313
from rest_framework.request import Request
1414

15-
from sentry import audit_log, features
16-
from sentry.constants import ObjectStatus
15+
from sentry import audit_log
1716
from sentry.exceptions import InvalidIdentity
1817
from sentry.identity.services.identity import identity_service
1918
from sentry.identity.services.identity.model import RpcIdentity
2019
from sentry.integrations.errors import OrganizationIntegrationNotFound
2120
from sentry.integrations.models.external_actor import ExternalActor
2221
from sentry.integrations.models.integration import Integration
23-
from sentry.integrations.notify_disable import notify_disable
2422
from sentry.integrations.pipeline_types import (
2523
IntegrationPipelineProviderT,
2624
IntegrationPipelineViewT,
2725
)
28-
from sentry.integrations.request_buffer import IntegrationRequestBuffer
2926
from sentry.integrations.types import IntegrationProviderSlug
3027
from sentry.models.team import Team
3128
from sentry.organizations.services.organization import (
@@ -48,7 +45,7 @@
4845
UnsupportedResponseType,
4946
)
5047
from sentry.users.models.identity import Identity
51-
from sentry.utils.audit import create_audit_entry, create_system_audit_entry
48+
from sentry.utils.audit import create_audit_entry
5249

5350
if TYPE_CHECKING:
5451
from django.utils.functional import _StrPromise
@@ -540,69 +537,6 @@ def is_response_error(resp: Any) -> bool:
540537
return resp.status_code >= 400 and resp.status_code != 429 and resp.status_code < 500
541538

542539

543-
def disable_integration(
544-
buffer: IntegrationRequestBuffer, redis_key: str, integration_id: int | None = None
545-
) -> None:
546-
from sentry.integrations.services.integration import integration_service
547-
548-
result = integration_service.organization_contexts(integration_id=integration_id)
549-
rpc_integration = result.integration
550-
rpc_org_integrations = result.organization_integrations
551-
if rpc_integration and rpc_integration.status == ObjectStatus.DISABLED:
552-
return None
553-
554-
org = None
555-
if len(rpc_org_integrations) > 0:
556-
org_context = organization_service.get_organization_by_id(
557-
id=rpc_org_integrations[0].organization_id,
558-
include_projects=False,
559-
include_teams=False,
560-
)
561-
if org_context:
562-
org = org_context.organization
563-
564-
extra = {
565-
"integration_id": integration_id,
566-
"buffer_record": buffer._get_all_from_buffer(),
567-
}
568-
extra["provider"] = "unknown" if rpc_integration is None else rpc_integration.provider
569-
extra["organization_id"] = (
570-
"unknown" if len(rpc_org_integrations) == 0 else rpc_org_integrations[0].organization_id
571-
)
572-
573-
logger.info(
574-
"integration.disabled",
575-
extra=extra,
576-
)
577-
578-
if not rpc_integration:
579-
return None
580-
581-
if org and (
582-
(
583-
rpc_integration.provider == IntegrationProviderSlug.SLACK
584-
and buffer.is_integration_fatal_broken()
585-
)
586-
or (rpc_integration.provider == IntegrationProviderSlug.GITHUB)
587-
or (
588-
features.has("organizations:gitlab-disable-on-broken", org)
589-
and rpc_integration.provider == IntegrationProviderSlug.GITLAB.value
590-
)
591-
):
592-
integration_service.update_integration(
593-
integration_id=rpc_integration.id, status=ObjectStatus.DISABLED
594-
)
595-
notify_disable(org, rpc_integration.provider, redis_key)
596-
buffer.clear()
597-
create_system_audit_entry(
598-
organization_id=org.id,
599-
target_object=org.id,
600-
event=audit_log.get_event_id("INTEGRATION_DISABLED"),
601-
data={"provider": rpc_integration.provider},
602-
)
603-
return None
604-
605-
606540
def get_integration_types(provider: str):
607541
types = []
608542
for integration_type, providers in INTEGRATION_TYPE_TO_PROVIDER.items():

src/sentry/integrations/notify_disable.py

Lines changed: 0 additions & 101 deletions
This file was deleted.

src/sentry/integrations/request_buffer.py

Lines changed: 0 additions & 156 deletions
This file was deleted.

0 commit comments

Comments
 (0)