From 11659f73bf2ecd10cd03e3f130ef0973d27bc5d7 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 27 Jun 2017 15:26:40 +0300 Subject: [PATCH] Fix log for reenabling a notification We forgot to log the event and method names --- data/model/notification.py | 3 ++- endpoints/api/repositorynotification.py | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/data/model/notification.py b/data/model/notification.py index ef8f40aec..3769d52cd 100644 --- a/data/model/notification.py +++ b/data/model/notification.py @@ -139,8 +139,9 @@ def reset_notification_number_of_failures(namespace_name, repository_name, uuid) notification.repository.name != repository_name): raise InvalidNotificationException('No repository notification found with uuid: %s' % uuid) reset_number_of_failures_to_zero(notification.id) + return notification except RepositoryNotification.DoesNotExist: - pass + return None def reset_number_of_failures_to_zero(notification_id): diff --git a/endpoints/api/repositorynotification.py b/endpoints/api/repositorynotification.py index 9b3e5ae30..ab81d2c5b 100644 --- a/endpoints/api/repositorynotification.py +++ b/endpoints/api/repositorynotification.py @@ -161,10 +161,12 @@ class RepositoryNotification(RepositoryParamResource): @disallow_for_app_repositories def post(self, namespace, repository, uuid): """ Resets repository notification to 0 failures. """ - model.notification.reset_notification_number_of_failures(namespace, repository, uuid) - log_action('reset_repo_notification', namespace, - {'repo': repository, 'namespace': namespace, 'notification_id': uuid}, - repo=model.repository.get_repository(namespace, repository)) + reset = model.notification.reset_notification_number_of_failures(namespace, repository, uuid) + if reset is not None: + log_action('reset_repo_notification', namespace, + {'repo': repository, 'namespace': namespace, 'notification_id': uuid, + 'event': reset.event.name, 'method': reset.method.name}, + repo=model.repository.get_repository(namespace, repository)) return 'No Content', 204