webhooks: Rename UnexpectedWebhookEventType to UnsupportedWebhookEventType.

Any exception is an "unexpected event", which means talking about
having an "unexpected event logger" or "unexpected event exception" is
confusing.  As the error message in `exceptions.py` already explains,
this is about an _unsupported_ event type.

This also switches the path that these exceptions are written to,
accordingly.
This commit is contained in:
Alex Vandiver 2020-08-19 13:26:38 -07:00 committed by Tim Abbott
parent 8016769613
commit 9ea9752e0e
33 changed files with 95 additions and 95 deletions

View File

@ -622,11 +622,11 @@ webhook bot, notifying them of the missing header.
Many third-party services have dozens of different event types. In some cases, we Many third-party services have dozens of different event types. In some cases, we
may choose to explicitly ignore specific events. In other cases, there may be may choose to explicitly ignore specific events. In other cases, there may be
events that are new or events that we don't know about. In such cases, we events that are new or events that we don't know about. In such cases, we
recommend raising `UnexpectedWebhookEventType` (found in recommend raising `UnsupportedWebhookEventType` (found in
`zerver/lib/exceptions.py`), like so: `zerver/lib/exceptions.py`), like so:
``` ```
raise UnexpectedWebhookEventType(webhook_name, event_type) raise UnsupportedWebhookEventType(webhook_name, event_type)
``` ```
`webhook_name` is the name of the integration that raises the exception. `webhook_name` is the name of the integration that raises the exception.

View File

@ -12,7 +12,7 @@ exclude_lines =
# Don't require coverage for __str__ statements just used for printing # Don't require coverage for __str__ statements just used for printing
def __str__[(]self[)] -> .*: def __str__[(]self[)] -> .*:
# Don't require coverage for errors about unsupported webhook event types # Don't require coverage for errors about unsupported webhook event types
raise UnexpectedWebhookEventType raise UnsupportedWebhookEventType
# Don't require coverage for blocks only run when type-checking # Don't require coverage for blocks only run when type-checking
if TYPE_CHECKING: if TYPE_CHECKING:
# Don't require coverage for abstract methods; they're never called. # Don't require coverage for abstract methods; they're never called.

View File

@ -32,7 +32,7 @@ from zerver.lib.exceptions import (
OrganizationAdministratorRequired, OrganizationAdministratorRequired,
OrganizationMemberRequired, OrganizationMemberRequired,
OrganizationOwnerRequired, OrganizationOwnerRequired,
UnexpectedWebhookEventType, UnsupportedWebhookEventType,
) )
from zerver.lib.logging_util import log_to_file from zerver.lib.logging_util import log_to_file
from zerver.lib.queue import queue_json_publish from zerver.lib.queue import queue_json_publish
@ -52,9 +52,9 @@ if settings.ZILENCER_ENABLED:
webhook_logger = logging.getLogger("zulip.zerver.webhooks") webhook_logger = logging.getLogger("zulip.zerver.webhooks")
log_to_file(webhook_logger, settings.API_KEY_ONLY_WEBHOOK_LOG_PATH) log_to_file(webhook_logger, settings.API_KEY_ONLY_WEBHOOK_LOG_PATH)
webhook_unexpected_events_logger = logging.getLogger("zulip.zerver.lib.webhooks.common") webhook_unsupported_events_logger = logging.getLogger("zulip.zerver.lib.webhooks.common")
log_to_file(webhook_unexpected_events_logger, log_to_file(webhook_unsupported_events_logger,
settings.WEBHOOK_UNEXPECTED_EVENTS_LOG_PATH) settings.WEBHOOK_UNSUPPORTED_EVENTS_LOG_PATH)
FuncT = TypeVar('FuncT', bound=Callable[..., object]) FuncT = TypeVar('FuncT', bound=Callable[..., object])
@ -268,7 +268,7 @@ def log_exception_to_webhook_logger(
user_profile: UserProfile, user_profile: UserProfile,
summary: str, summary: str,
payload: str, payload: str,
unexpected_event: bool, unsupported_event: bool,
) -> None: ) -> None:
if request.content_type == 'application/json': if request.content_type == 'application/json':
try: try:
@ -309,8 +309,8 @@ body:
) )
message = message.strip(' ') message = message.strip(' ')
if unexpected_event: if unsupported_event:
webhook_unexpected_events_logger.exception(message, stack_info=True) webhook_unsupported_events_logger.exception(message, stack_info=True)
else: else:
webhook_logger.exception(message, stack_info=True) webhook_logger.exception(message, stack_info=True)
@ -352,7 +352,7 @@ def api_key_only_webhook_view(
user_profile=user_profile, user_profile=user_profile,
summary=str(err), summary=str(err),
payload=request.body, payload=request.body,
unexpected_event=isinstance(err, UnexpectedWebhookEventType), unsupported_event=isinstance(err, UnsupportedWebhookEventType),
) )
raise err raise err
@ -603,7 +603,7 @@ def authenticated_rest_api_view(
user_profile=profile, user_profile=profile,
summary=str(err), summary=str(err),
payload=request_body, payload=request_body,
unexpected_event=isinstance(err, UnexpectedWebhookEventType), unsupported_event=isinstance(err, UnsupportedWebhookEventType),
) )
raise err raise err

View File

@ -36,7 +36,7 @@ class ErrorCode(AbstractEnum):
MISSING_HTTP_EVENT_HEADER = () MISSING_HTTP_EVENT_HEADER = ()
STREAM_DOES_NOT_EXIST = () STREAM_DOES_NOT_EXIST = ()
UNAUTHORIZED_PRINCIPAL = () UNAUTHORIZED_PRINCIPAL = ()
UNEXPECTED_WEBHOOK_EVENT_TYPE = () UNSUPPORTED_WEBHOOK_EVENT_TYPE = ()
BAD_EVENT_QUEUE_ID = () BAD_EVENT_QUEUE_ID = ()
CSRF_FAILED = () CSRF_FAILED = ()
INVITATION_FAILED = () INVITATION_FAILED = ()
@ -257,8 +257,8 @@ class InvalidAPIKeyFormatError(InvalidAPIKeyError):
def msg_format() -> str: def msg_format() -> str:
return _("Malformed API key") return _("Malformed API key")
class UnexpectedWebhookEventType(JsonableError): class UnsupportedWebhookEventType(JsonableError):
code = ErrorCode.UNEXPECTED_WEBHOOK_EVENT_TYPE code = ErrorCode.UNSUPPORTED_WEBHOOK_EVENT_TYPE
data_fields = ['webhook_name', 'event_type'] data_fields = ['webhook_name', 'event_type']
def __init__(self, webhook_name: str, event_type: Optional[str]) -> None: def __init__(self, webhook_name: str, event_type: Optional[str]) -> None:

View File

@ -40,7 +40,7 @@ from zerver.lib.exceptions import (
InvalidAPIKeyError, InvalidAPIKeyError,
InvalidAPIKeyFormatError, InvalidAPIKeyFormatError,
JsonableError, JsonableError,
UnexpectedWebhookEventType, UnsupportedWebhookEventType,
) )
from zerver.lib.initial_password import initial_password from zerver.lib.initial_password import initial_password
from zerver.lib.request import ( from zerver.lib.request import (
@ -269,9 +269,9 @@ class DecoratorTestCase(ZulipTestCase):
raise Exception("raised by webhook function") raise Exception("raised by webhook function")
@api_key_only_webhook_view('ClientName') @api_key_only_webhook_view('ClientName')
def my_webhook_raises_exception_unexpected_event( def my_webhook_raises_exception_unsupported_event(
request: HttpRequest, user_profile: UserProfile) -> None: request: HttpRequest, user_profile: UserProfile) -> None:
raise UnexpectedWebhookEventType("helloworld", "test_event") raise UnsupportedWebhookEventType("helloworld", "test_event")
webhook_bot_email = 'webhook-bot@zulip.com' webhook_bot_email = 'webhook-bot@zulip.com'
webhook_bot_realm = get_realm('zulip') webhook_bot_realm = get_realm('zulip')
@ -361,14 +361,14 @@ body:
body=request.body, body=request.body,
), stack_info=True) ), stack_info=True)
# Test when an unexpected webhook event occurs # Test when an unsupported webhook event occurs
with mock.patch('zerver.decorator.webhook_unexpected_events_logger.exception') as mock_exception: with mock.patch('zerver.decorator.webhook_unsupported_events_logger.exception') as mock_exception:
exception_msg = "The 'test_event' event isn't currently supported by the helloworld webhook" exception_msg = "The 'test_event' event isn't currently supported by the helloworld webhook"
with self.assertRaisesRegex(UnexpectedWebhookEventType, exception_msg): with self.assertRaisesRegex(UnsupportedWebhookEventType, exception_msg):
request.body = "invalidjson" request.body = "invalidjson"
request.content_type = 'application/json' request.content_type = 'application/json'
request.META['HTTP_X_CUSTOM_HEADER'] = 'custom_value' request.META['HTTP_X_CUSTOM_HEADER'] = 'custom_value'
my_webhook_raises_exception_unexpected_event(request) my_webhook_raises_exception_unsupported_event(request)
message = """ message = """
summary: {summary} summary: {summary}
@ -540,10 +540,10 @@ body:
body=request.body, body=request.body,
), stack_info=True) ), stack_info=True)
def test_authenticated_rest_api_view_logging_unexpected_event(self) -> None: def test_authenticated_rest_api_view_logging_unsupported_event(self) -> None:
@authenticated_rest_api_view(webhook_client_name="ClientName") @authenticated_rest_api_view(webhook_client_name="ClientName")
def my_webhook_raises_exception(request: HttpRequest, user_profile: UserProfile) -> None: def my_webhook_raises_exception(request: HttpRequest, user_profile: UserProfile) -> None:
raise UnexpectedWebhookEventType("helloworld", "test_event") raise UnsupportedWebhookEventType("helloworld", "test_event")
webhook_bot_email = 'webhook-bot@zulip.com' webhook_bot_email = 'webhook-bot@zulip.com'
webhook_bot_realm = get_realm('zulip') webhook_bot_realm = get_realm('zulip')
@ -557,9 +557,9 @@ body:
request.POST['payload'] = '{}' request.POST['payload'] = '{}'
request.content_type = 'text/plain' request.content_type = 'text/plain'
with mock.patch('zerver.decorator.webhook_unexpected_events_logger.exception') as mock_exception: with mock.patch('zerver.decorator.webhook_unsupported_events_logger.exception') as mock_exception:
exception_msg = "The 'test_event' event isn't currently supported by the helloworld webhook" exception_msg = "The 'test_event' event isn't currently supported by the helloworld webhook"
with self.assertRaisesRegex(UnexpectedWebhookEventType, exception_msg): with self.assertRaisesRegex(UnsupportedWebhookEventType, exception_msg):
my_webhook_raises_exception(request) my_webhook_raises_exception(request)
message = """ message = """

View File

@ -5,7 +5,7 @@ from typing import Any, Dict
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message from zerver.lib.webhooks.common import check_send_webhook_message
@ -30,7 +30,7 @@ def api_basecamp_webhook(request: HttpRequest, user_profile: UserProfile,
event = get_event_type(payload) event = get_event_type(payload)
if event not in SUPPORT_EVENTS: if event not in SUPPORT_EVENTS:
raise UnexpectedWebhookEventType('Basecamp', event) raise UnsupportedWebhookEventType('Basecamp', event)
subject = get_project_name(payload) subject = get_project_name(payload)
if event.startswith('document_'): if event.startswith('document_'):
@ -48,7 +48,7 @@ def api_basecamp_webhook(request: HttpRequest, user_profile: UserProfile,
elif event.startswith('comment_'): elif event.startswith('comment_'):
body = get_comment_body(event, payload) body = get_comment_body(event, payload)
else: else:
raise UnexpectedWebhookEventType('Basecamp', event) raise UnsupportedWebhookEventType('Basecamp', event)
check_send_webhook_message(request, user_profile, subject, body) check_send_webhook_message(request, user_profile, subject, body)
return json_success() return json_success()

View File

@ -8,7 +8,7 @@ from typing import Any, Dict, List, Optional
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import ( from zerver.lib.webhooks.common import (
@ -161,7 +161,7 @@ def get_type(request: HttpRequest, payload: Dict[str, Any]) -> str:
if event_key == 'repo:updated': if event_key == 'repo:updated':
return event_key return event_key
raise UnexpectedWebhookEventType('BitBucket2', event_key) raise UnsupportedWebhookEventType('BitBucket2', event_key)
def get_body_based_on_type(type: str) -> Any: def get_body_based_on_type(type: str) -> Any:
fn = GET_SINGLE_MESSAGE_BODY_DEPENDING_ON_TYPE_MAPPER.get(type) fn = GET_SINGLE_MESSAGE_BODY_DEPENDING_ON_TYPE_MAPPER.get(type)

View File

@ -6,7 +6,7 @@ from typing import Any, Callable, Dict, List, Optional
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message from zerver.lib.webhooks.common import check_send_webhook_message
@ -134,7 +134,7 @@ def repo_push_branch_data(payload: Dict[str, Any], change: Dict[str, Any]) -> Di
body = get_remove_branch_event_message(user_name, branch_name) body = get_remove_branch_event_message(user_name, branch_name)
else: else:
message = "{}.{}".format(payload["eventKey"], event_type) # nocoverage message = "{}.{}".format(payload["eventKey"], event_type) # nocoverage
raise UnexpectedWebhookEventType("BitBucket Server", message) raise UnsupportedWebhookEventType("BitBucket Server", message)
subject = TOPIC_WITH_BRANCH_TEMPLATE.format(repo=repo_name, branch=branch_name) subject = TOPIC_WITH_BRANCH_TEMPLATE.format(repo=repo_name, branch=branch_name)
return {"subject": subject, "body": body} return {"subject": subject, "body": body}
@ -150,7 +150,7 @@ def repo_push_tag_data(payload: Dict[str, Any], change: Dict[str, Any]) -> Dict[
action = "removed" action = "removed"
else: else:
message = "{}.{}".format(payload["eventKey"], event_type) # nocoverage message = "{}.{}".format(payload["eventKey"], event_type) # nocoverage
raise UnexpectedWebhookEventType("BitBucket Server", message) raise UnsupportedWebhookEventType("BitBucket Server", message)
subject = BITBUCKET_TOPIC_TEMPLATE.format(repository_name=repo_name) subject = BITBUCKET_TOPIC_TEMPLATE.format(repository_name=repo_name)
body = get_push_tag_event_message(get_user_name(payload), tag_name, action=action) body = get_push_tag_event_message(get_user_name(payload), tag_name, action=action)
@ -171,7 +171,7 @@ def repo_push_handler(payload: Dict[str, Any], branches: Optional[str]=None,
data.append(repo_push_tag_data(payload, change)) data.append(repo_push_tag_data(payload, change))
else: else:
message = "{}.{}".format(payload["eventKey"], event_target_type) # nocoverage message = "{}.{}".format(payload["eventKey"], event_target_type) # nocoverage
raise UnexpectedWebhookEventType("BitBucket Server", message) raise UnsupportedWebhookEventType("BitBucket Server", message)
return data return data
def get_assignees_string(pr: Dict[str, Any]) -> Optional[str]: def get_assignees_string(pr: Dict[str, Any]) -> Optional[str]:
@ -351,7 +351,7 @@ def get_event_handler(eventkey: str) -> Callable[..., List[Dict[str, str]]]:
# The main reason for this function existence is because of mypy # The main reason for this function existence is because of mypy
handler: Any = EVENT_HANDLER_MAP.get(eventkey) handler: Any = EVENT_HANDLER_MAP.get(eventkey)
if handler is None: if handler is None:
raise UnexpectedWebhookEventType("BitBucket Server", eventkey) raise UnsupportedWebhookEventType("BitBucket Server", eventkey)
return handler return handler
@api_key_only_webhook_view("Bitbucket3") @api_key_only_webhook_view("Bitbucket3")

View File

@ -4,7 +4,7 @@ from typing import Any, Dict, Optional
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message from zerver.lib.webhooks.common import check_send_webhook_message
@ -534,7 +534,7 @@ def api_clubhouse_webhook(
body_func: Any = EVENT_BODY_FUNCTION_MAPPER.get(event) body_func: Any = EVENT_BODY_FUNCTION_MAPPER.get(event)
topic_func = get_topic_function_based_on_type(payload) topic_func = get_topic_function_based_on_type(payload)
if body_func is None or topic_func is None: if body_func is None or topic_func is None:
raise UnexpectedWebhookEventType('Clubhouse', event) raise UnsupportedWebhookEventType('Clubhouse', event)
topic = topic_func(payload) topic = topic_func(payload)
body = body_func(payload) body = body_func(payload)

View File

@ -439,7 +439,7 @@ A temporary team so that I can get some webhook fixtures!
), ),
) )
log_mock = patch("zerver.decorator.webhook_unexpected_events_logger.exception") log_mock = patch("zerver.decorator.webhook_unsupported_events_logger.exception")
with log_mock as m: with log_mock as m:
stream_message = self.send_webhook_payload( stream_message = self.send_webhook_payload(

View File

@ -5,7 +5,7 @@ from typing import Any, Callable, Dict, Optional
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view, log_exception_to_webhook_logger from zerver.decorator import api_key_only_webhook_view, log_exception_to_webhook_logger
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import ( from zerver.lib.webhooks.common import (
@ -42,7 +42,7 @@ class Helper:
self._request = request self._request = request
self._user_profile = user_profile self._user_profile = user_profile
def log_unexpected(self, event: str) -> None: def log_unsupported(self, event: str) -> None:
summary = f"The '{event}' event isn't currently supported by the GitHub webhook" summary = f"The '{event}' event isn't currently supported by the GitHub webhook"
request = self._request request = self._request
log_exception_to_webhook_logger( log_exception_to_webhook_logger(
@ -50,7 +50,7 @@ class Helper:
user_profile=self._user_profile, user_profile=self._user_profile,
summary=summary, summary=summary,
payload=request.body, payload=request.body,
unexpected_event=True, unsupported_event=True,
) )
def get_opened_or_update_pull_request_body(helper: Helper) -> str: def get_opened_or_update_pull_request_body(helper: Helper) -> str:
@ -301,7 +301,7 @@ def get_team_body(helper: Helper) -> str:
return f"Team visibility changed to `{new_visibility}`" return f"Team visibility changed to `{new_visibility}`"
missing_keys = "/".join(sorted(list(changes.keys()))) missing_keys = "/".join(sorted(list(changes.keys())))
helper.log_unexpected(f"team/edited (changes: {missing_keys})") helper.log_unsupported(f"team/edited (changes: {missing_keys})")
# Do our best to give useful info to the customer--at least # Do our best to give useful info to the customer--at least
# if they know something changed, they can go to GitHub for # if they know something changed, they can go to GitHub for
@ -620,7 +620,7 @@ def api_github_webhook(
""" """
header_event = validate_extract_webhook_http_header(request, "X_GITHUB_EVENT", "GitHub") header_event = validate_extract_webhook_http_header(request, "X_GITHUB_EVENT", "GitHub")
if header_event is None: if header_event is None:
raise UnexpectedWebhookEventType("GitHub", "no header provided") raise UnsupportedWebhookEventType("GitHub", "no header provided")
event = get_zulip_event_name(header_event, payload, branches) event = get_zulip_event_name(header_event, payload, branches)
if event is None: if event is None:
@ -691,11 +691,11 @@ def get_zulip_event_name(
else: else:
# this means GH has actually added new actions since September 2020, # this means GH has actually added new actions since September 2020,
# so it's a bit more cause for alarm # so it's a bit more cause for alarm
raise UnexpectedWebhookEventType("GitHub", f"unexpected team action {action}") raise UnsupportedWebhookEventType("GitHub", f"unsupported team action {action}")
elif header_event in list(EVENT_FUNCTION_MAPPER.keys()): elif header_event in list(EVENT_FUNCTION_MAPPER.keys()):
return header_event return header_event
elif header_event in IGNORED_EVENTS: elif header_event in IGNORED_EVENTS:
return None return None
complete_event = "{}:{}".format(header_event, payload.get("action", "???")) # nocoverage complete_event = "{}:{}".format(header_event, payload.get("action", "???")) # nocoverage
raise UnexpectedWebhookEventType('GitHub', complete_event) raise UnsupportedWebhookEventType('GitHub', complete_event)

View File

@ -6,7 +6,7 @@ from typing import Any, Dict, Optional
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.validator import check_bool from zerver.lib.validator import check_bool
@ -452,4 +452,4 @@ def get_event(request: HttpRequest, payload: Dict[str, Any], branches: Optional[
if event in list(EVENT_FUNCTION_MAPPER.keys()): if event in list(EVENT_FUNCTION_MAPPER.keys()):
return event return event
raise UnexpectedWebhookEventType('GitLab', event) raise UnsupportedWebhookEventType('GitLab', event)

View File

@ -4,7 +4,7 @@ from typing import Any, Callable, Dict, Optional
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import ( from zerver.lib.webhooks.common import (
@ -197,7 +197,7 @@ def gogs_webhook_main(integration_name: str, http_header_name: str,
) )
else: else:
raise UnexpectedWebhookEventType('Gogs', event) raise UnsupportedWebhookEventType('Gogs', event)
check_send_webhook_message(request, user_profile, topic, body) check_send_webhook_message(request, user_profile, topic, body)
return json_success() return json_success()

View File

@ -3,7 +3,7 @@ from typing import Any, Dict
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message from zerver.lib.webhooks.common import check_send_webhook_message
@ -55,6 +55,6 @@ def api_gosquared_webhook(request: HttpRequest, user_profile: UserProfile,
) )
check_send_webhook_message(request, user_profile, topic, body) check_send_webhook_message(request, user_profile, topic, body)
else: else:
raise UnexpectedWebhookEventType('GoSquared', 'unknown_event') raise UnsupportedWebhookEventType('GoSquared', 'unknown_event')
return json_success() return json_success()

View File

@ -5,7 +5,7 @@ from typing import Any, Callable, Dict, Optional
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import ( from zerver.lib.webhooks.common import (
@ -79,7 +79,7 @@ def get_event_handler(event: str) -> Callable[..., str]:
# The main reason for this function existence is because of mypy # The main reason for this function existence is because of mypy
handler: Any = EVENTS_FUNCTION_MAPPER.get(event) handler: Any = EVENTS_FUNCTION_MAPPER.get(event)
if handler is None: if handler is None:
raise UnexpectedWebhookEventType("Groove", event) raise UnsupportedWebhookEventType("Groove", event)
return handler return handler
@api_key_only_webhook_view('Groove') @api_key_only_webhook_view('Groove')

View File

@ -5,7 +5,7 @@ from django.db.models import Q
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message from zerver.lib.webhooks.common import check_send_webhook_message
@ -107,7 +107,7 @@ def api_harbor_webhook(request: HttpRequest, user_profile: UserProfile,
content_func = EVENT_FUNCTION_MAPPER.get(event) content_func = EVENT_FUNCTION_MAPPER.get(event)
if content_func is None: if content_func is None:
raise UnexpectedWebhookEventType('Harbor', event) raise UnsupportedWebhookEventType('Harbor', event)
content: str = content_func(payload, user_profile, operator_username) content: str = content_func(payload, user_profile, operator_username)

View File

@ -5,7 +5,7 @@ from typing import Any, Callable, Dict, List, Tuple
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message from zerver.lib.webhooks.common import check_send_webhook_message
@ -279,7 +279,7 @@ EVENT_TO_FUNCTION_MAPPER = {
def get_event_handler(event_type: str) -> Callable[..., Tuple[str, str]]: def get_event_handler(event_type: str) -> Callable[..., Tuple[str, str]]:
handler: Any = EVENT_TO_FUNCTION_MAPPER.get(event_type) handler: Any = EVENT_TO_FUNCTION_MAPPER.get(event_type)
if handler is None: if handler is None:
raise UnexpectedWebhookEventType("Intercom", event_type) raise UnsupportedWebhookEventType("Intercom", event_type)
return handler return handler
@api_key_only_webhook_view('Intercom') @api_key_only_webhook_view('Intercom')

View File

@ -7,7 +7,7 @@ from django.db.models import Q
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message from zerver.lib.webhooks.common import check_send_webhook_message
@ -328,7 +328,7 @@ def api_jira_webhook(request: HttpRequest, user_profile: UserProfile,
content_func = get_event_handler(event) content_func = get_event_handler(event)
if content_func is None: if content_func is None:
raise UnexpectedWebhookEventType('Jira', event) raise UnsupportedWebhookEventType('Jira', event)
subject = get_issue_subject(payload) subject = get_issue_subject(payload)
content: str = content_func(payload, user_profile) content: str = content_func(payload, user_profile)

View File

@ -3,7 +3,7 @@ from typing import Any, Dict, Iterable
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import ( from zerver.lib.webhooks.common import (
@ -51,4 +51,4 @@ def get_template(request: HttpRequest, payload: Dict[str, Any]) -> str:
elif event in EVENTS: elif event in EVENTS:
return message_template + 'is now {state}.'.format(state=payload['state']) return message_template + 'is now {state}.'.format(state=payload['state'])
else: else:
raise UnexpectedWebhookEventType('Netlify', event) raise UnsupportedWebhookEventType('Netlify', event)

View File

@ -4,7 +4,7 @@ from typing import Any, Dict, Optional
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.validator import check_dict from zerver.lib.validator import check_dict
@ -43,7 +43,7 @@ def api_newrelic_webhook(request: HttpRequest, user_profile: UserProfile,
subject = "{} deploy".format(deployment['application_name']) subject = "{} deploy".format(deployment['application_name'])
content = DEPLOY_TEMPLATE.format(**deployment) content = DEPLOY_TEMPLATE.format(**deployment)
else: else:
raise UnexpectedWebhookEventType('New Relic', 'Unknown Event Type') raise UnsupportedWebhookEventType('New Relic', 'Unknown Event Type')
check_send_webhook_message(request, user_profile, subject, content) check_send_webhook_message(request, user_profile, subject, content)
return json_success() return json_success()

View File

@ -4,7 +4,7 @@ from typing import Any, Dict, Iterable
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message from zerver.lib.webhooks.common import check_send_webhook_message
@ -172,7 +172,7 @@ def api_pagerduty_webhook(
break break
if message_type not in PAGER_DUTY_EVENT_NAMES: if message_type not in PAGER_DUTY_EVENT_NAMES:
raise UnexpectedWebhookEventType('Pagerduty', message_type) raise UnsupportedWebhookEventType('Pagerduty', message_type)
format_dict = build_pagerduty_formatdict(message) format_dict = build_pagerduty_formatdict(message)
send_formated_pagerduty(request, user_profile, message_type, format_dict) send_formated_pagerduty(request, user_profile, message_type, format_dict)
@ -186,7 +186,7 @@ def api_pagerduty_webhook(
break break
if event not in PAGER_DUTY_EVENT_NAMES_V2: if event not in PAGER_DUTY_EVENT_NAMES_V2:
raise UnexpectedWebhookEventType('Pagerduty', event) raise UnsupportedWebhookEventType('Pagerduty', event)
format_dict = build_pagerduty_formatdict_v2(message) format_dict = build_pagerduty_formatdict_v2(message)
send_formated_pagerduty(request, user_profile, event, format_dict) send_formated_pagerduty(request, user_profile, event, format_dict)

View File

@ -4,7 +4,7 @@ from typing import Any, Dict
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message from zerver.lib.webhooks.common import check_send_webhook_message
@ -47,7 +47,7 @@ def api_pingdom_webhook(request: HttpRequest, user_profile: UserProfile,
subject = get_subject_for_http_request(payload) subject = get_subject_for_http_request(payload)
body = get_body_for_http_request(payload) body = get_body_for_http_request(payload)
else: else:
raise UnexpectedWebhookEventType('Pingdom', check_type) raise UnsupportedWebhookEventType('Pingdom', check_type)
check_send_webhook_message(request, user_profile, subject, body) check_send_webhook_message(request, user_profile, subject, body)
return json_success() return json_success()

View File

@ -8,7 +8,7 @@ from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import has_request_variables from zerver.lib.request import has_request_variables
from zerver.lib.response import json_error, json_success from zerver.lib.response import json_error, json_success
from zerver.lib.webhooks.common import check_send_webhook_message from zerver.lib.webhooks.common import check_send_webhook_message
@ -152,7 +152,7 @@ def api_pivotal_webhook_v5(request: HttpRequest, user_profile: UserProfile) -> T
# Known but unsupported Pivotal event types # Known but unsupported Pivotal event types
pass pass
else: else:
raise UnexpectedWebhookEventType('Pivotal Tracker', event_type) raise UnsupportedWebhookEventType('Pivotal Tracker', event_type)
return subject, content return subject, content

View File

@ -4,7 +4,7 @@ from typing import Any, Dict
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message from zerver.lib.webhooks.common import check_send_webhook_message
@ -31,7 +31,7 @@ def api_raygun_webhook(request: HttpRequest, user_profile: UserProfile,
elif event == 'error_activity': elif event == 'error_activity':
message = compose_activity_message(payload) message = compose_activity_message(payload)
else: else:
raise UnexpectedWebhookEventType('Raygun', event) raise UnsupportedWebhookEventType('Raygun', event)
topic = 'test' topic = 'test'
@ -220,7 +220,7 @@ def compose_notification_message(payload: Dict[str, Any]) -> str:
elif "FollowUp" in event_type: elif "FollowUp" in event_type:
return notification_message_follow_up(payload) return notification_message_follow_up(payload)
else: else:
raise UnexpectedWebhookEventType('Raygun', event_type) raise UnsupportedWebhookEventType('Raygun', event_type)
def activity_message(payload: Dict[str, Any]) -> str: def activity_message(payload: Dict[str, Any]) -> str:
@ -276,7 +276,7 @@ def compose_activity_message(payload: Dict[str, Any]) -> str:
or event_type == "CommentAdded": or event_type == "CommentAdded":
return activity_message(payload) return activity_message(payload)
else: else:
raise UnexpectedWebhookEventType('Raygun', event_type) raise UnsupportedWebhookEventType('Raygun', event_type)
def parse_time(timestamp: str) -> str: def parse_time(timestamp: str) -> str:

View File

@ -3,7 +3,7 @@ from typing import Any, Dict, Iterable
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import ( from zerver.lib.webhooks.common import (
@ -180,6 +180,6 @@ def api_reviewboard_webhook(
topic = get_review_request_repo_title(payload) topic = get_review_request_repo_title(payload)
check_send_webhook_message(request, user_profile, topic, body) check_send_webhook_message(request, user_profile, topic, body)
else: else:
raise UnexpectedWebhookEventType('ReviewBoard', event_type) raise UnsupportedWebhookEventType('ReviewBoard', event_type)
return json_success() return json_success()

View File

@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Tuple
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message from zerver.lib.webhooks.common import check_send_webhook_message
@ -92,7 +92,7 @@ def handle_event_payload(event: Dict[str, Any]) -> Tuple[str, str]:
# We shouldn't support the officially deprecated Raven series of SDKs. # We shouldn't support the officially deprecated Raven series of SDKs.
if int(event["version"]) < 7: if int(event["version"]) < 7:
raise UnexpectedWebhookEventType("Sentry", "Raven SDK") raise UnsupportedWebhookEventType("Sentry", "Raven SDK")
platform_name = event["platform"] platform_name = event["platform"]
syntax_highlight_as = syntax_highlight_as_map.get(platform_name, "") syntax_highlight_as = syntax_highlight_as_map.get(platform_name, "")
@ -155,7 +155,7 @@ def handle_event_payload(event: Dict[str, Any]) -> Tuple[str, str]:
body = MESSAGE_EVENT_TEMPLATE.format(**context) body = MESSAGE_EVENT_TEMPLATE.format(**context)
else: else:
raise UnexpectedWebhookEventType("Sentry", "unknown-event type") raise UnsupportedWebhookEventType("Sentry", "unknown-event type")
return (subject, body) return (subject, body)
@ -205,7 +205,7 @@ def handle_issue_payload(action: str, issue: Dict[str, Any], actor: Dict[str, An
body = ISSUE_IGNORED_MESSAGE_TEMPLATE.format(**context) body = ISSUE_IGNORED_MESSAGE_TEMPLATE.format(**context)
else: else:
raise UnexpectedWebhookEventType("Sentry", "unknown-issue-action type") raise UnsupportedWebhookEventType("Sentry", "unknown-issue-action type")
return (subject, body) return (subject, body)
@ -233,7 +233,7 @@ def api_sentry_webhook(request: HttpRequest, user_profile: UserProfile,
elif "issue" in data: elif "issue" in data:
subject, body = handle_issue_payload(payload["action"], data["issue"], payload["actor"]) subject, body = handle_issue_payload(payload["action"], data["issue"], payload["actor"])
else: else:
raise UnexpectedWebhookEventType("Sentry", str(list(data.keys()))) raise UnsupportedWebhookEventType("Sentry", str(list(data.keys())))
else: else:
subject, body = handle_deprecated_payload(payload) subject, body = handle_deprecated_payload(payload)

View File

@ -5,7 +5,7 @@ from typing import Any, Dict, Optional, Sequence, Tuple
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.timestamp import timestamp_to_datetime from zerver.lib.timestamp import timestamp_to_datetime
@ -191,7 +191,7 @@ def topic_and_body(payload: Dict[str, Any]) -> Tuple[str, str]:
raise NotImplementedEventType() raise NotImplementedEventType()
if body is None: if body is None:
raise UnexpectedWebhookEventType('Stripe', event_type) raise UnsupportedWebhookEventType('Stripe', event_type)
return (topic, body) return (topic, body)
def amount_string(amount: int, currency: str) -> str: def amount_string(amount: int, currency: str) -> str:

View File

@ -4,7 +4,7 @@ from typing import Optional
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.validator import check_int from zerver.lib.validator import check_int
@ -29,6 +29,6 @@ def api_transifex_webhook(
elif reviewed: elif reviewed:
body = f"Resource {resource} fully reviewed." body = f"Resource {resource} fully reviewed."
else: else:
raise UnexpectedWebhookEventType('Transifex', 'Unknown Event Type') raise UnsupportedWebhookEventType('Transifex', 'Unknown Event Type')
check_send_webhook_message(request, user_profile, subject, body) check_send_webhook_message(request, user_profile, subject, body)
return json_success() return json_success()

View File

@ -5,7 +5,7 @@ import orjson
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view, return_success_on_head_request from zerver.decorator import api_key_only_webhook_view, return_success_on_head_request
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message from zerver.lib.webhooks.common import check_send_webhook_message
@ -40,4 +40,4 @@ def get_subject_and_body(payload: Mapping[str, Any], action_type: str) -> Option
if action_type in SUPPORTED_BOARD_ACTIONS: if action_type in SUPPORTED_BOARD_ACTIONS:
return process_board_action(payload, action_type) return process_board_action(payload, action_type)
raise UnexpectedWebhookEventType("Trello", action_type) raise UnsupportedWebhookEventType("Trello", action_type)

View File

@ -1,6 +1,6 @@
from typing import Any, Mapping, Optional, Tuple from typing import Any, Mapping, Optional, Tuple
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
SUPPORTED_BOARD_ACTIONS = [ SUPPORTED_BOARD_ACTIONS = [
'removeMemberFromBoard', 'removeMemberFromBoard',
@ -39,7 +39,7 @@ def get_proper_action(payload: Mapping[str, Any], action_type: Optional[str]) ->
return None return None
elif data['old']['name']: elif data['old']['name']:
return CHANGE_NAME return CHANGE_NAME
raise UnexpectedWebhookEventType("Trello", action_type) raise UnsupportedWebhookEventType("Trello", action_type)
return action_type return action_type
def get_subject(payload: Mapping[str, Any]) -> str: def get_subject(payload: Mapping[str, Any]) -> str:

View File

@ -1,6 +1,6 @@
from typing import Any, Mapping, Optional, Tuple from typing import Any, Mapping, Optional, Tuple
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
SUPPORTED_CARD_ACTIONS = [ SUPPORTED_CARD_ACTIONS = [
'updateCard', 'updateCard',
@ -115,7 +115,7 @@ def get_proper_action(payload: Mapping[str, Any], action_type: str) -> Optional[
for field in ignored_fields: for field in ignored_fields:
if old_data.get(field): if old_data.get(field):
return None return None
raise UnexpectedWebhookEventType("Trello", action_type) raise UnsupportedWebhookEventType("Trello", action_type)
return action_type return action_type

View File

@ -5,7 +5,7 @@ from typing import Any, Dict, List
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view from zerver.decorator import api_key_only_webhook_view
from zerver.lib.exceptions import UnexpectedWebhookEventType from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.webhooks.common import check_send_webhook_message from zerver.lib.webhooks.common import check_send_webhook_message
@ -75,4 +75,4 @@ def get_event_type(event: Dict[str, Any]) -> str:
event_type = event_type_match.group(1) event_type = event_type_match.group(1)
if event_type in EVENT_TYPE_BODY_MAPPER: if event_type in EVENT_TYPE_BODY_MAPPER:
return event_type return event_type
raise UnexpectedWebhookEventType('Updown', event['event']) raise UnsupportedWebhookEventType('Updown', event['event'])

View File

@ -685,7 +685,7 @@ DIGEST_LOG_PATH = zulip_path("/var/log/zulip/digest.log")
ANALYTICS_LOG_PATH = zulip_path("/var/log/zulip/analytics.log") ANALYTICS_LOG_PATH = zulip_path("/var/log/zulip/analytics.log")
ANALYTICS_LOCK_DIR = zulip_path("/home/zulip/deployments/analytics-lock-dir") ANALYTICS_LOCK_DIR = zulip_path("/home/zulip/deployments/analytics-lock-dir")
API_KEY_ONLY_WEBHOOK_LOG_PATH = zulip_path("/var/log/zulip/webhooks_errors.log") API_KEY_ONLY_WEBHOOK_LOG_PATH = zulip_path("/var/log/zulip/webhooks_errors.log")
WEBHOOK_UNEXPECTED_EVENTS_LOG_PATH = zulip_path("/var/log/zulip/webhooks_unexpected_events.log") WEBHOOK_UNSUPPORTED_EVENTS_LOG_PATH = zulip_path("/var/log/zulip/webhooks_unsupported_events.log")
SOFT_DEACTIVATION_LOG_PATH = zulip_path("/var/log/zulip/soft_deactivation.log") SOFT_DEACTIVATION_LOG_PATH = zulip_path("/var/log/zulip/soft_deactivation.log")
TRACEMALLOC_DUMP_DIR = zulip_path("/var/log/zulip/tracemalloc") TRACEMALLOC_DUMP_DIR = zulip_path("/var/log/zulip/tracemalloc")
SCHEDULED_MESSAGE_DELIVERER_LOG_PATH = zulip_path("/var/log/zulip/scheduled_message_deliverer.log") SCHEDULED_MESSAGE_DELIVERER_LOG_PATH = zulip_path("/var/log/zulip/scheduled_message_deliverer.log")