- Add web hook queue code back in. We'll remove it and turn it off after this CL goes to prod

- Make notification lookup always be by repo and its UUID, rather than the internal DB ID
- Add the init script for the notification worker
This commit is contained in:
Joseph Schorr 2014-07-31 13:30:54 -04:00
parent 1c7d72914b
commit 49801bc2c4
11 changed files with 37 additions and 56 deletions

View file

@ -56,10 +56,6 @@ class InvalidRepositoryBuildException(DataModelException):
pass
class InvalidWebhookException(DataModelException):
pass
class InvalidNotificationException(DataModelException):
pass
@ -1552,13 +1548,6 @@ def create_repo_notification(repo, event_name, method_name, config):
config_json=json.dumps(config))
def lookup_repo_notification(notification_id):
try:
return RepositoryNotification.get(RepositoryNotification.id == notification_id)
except RepositoryNotification.DoesNotExist:
return None
def get_repo_notification(namespace_name, repository_name, uuid):
joined = RepositoryNotification.select().join(Repository)
found = list(joined.where(Repository.namespace == namespace_name,
@ -1588,34 +1577,6 @@ def list_repo_notifications(namespace_name, repository_name, event_name=None):
return where
# TODO: remove webhook methods when no longer used.
def create_webhook(repo, params_obj):
return Webhook.create(repository=repo, parameters=json.dumps(params_obj))
def get_webhook(namespace_name, repository_name, public_id):
joined = Webhook.select().join(Repository)
found = list(joined.where(Repository.namespace == namespace_name,
Repository.name == repository_name,
Webhook.public_id == public_id))
if not found:
raise InvalidWebhookException('No webhook found with id: %s' % public_id)
return found[0]
def list_webhooks(namespace_name, repository_name):
joined = Webhook.select().join(Repository)
return joined.where(Repository.namespace == namespace_name,
Repository.name == repository_name)
def delete_webhook(namespace_name, repository_name, public_id):
webhook = get_webhook(namespace_name, repository_name, public_id)
webhook.delete_instance()
return webhook
def list_logs(start_time, end_time, performer=None, repository=None, namespace=None):
joined = LogEntry.select().join(User)