diff --git a/endpoints/notificationevent.py b/endpoints/notificationevent.py index 2f7fb34fb..b550d76b0 100644 --- a/endpoints/notificationevent.py +++ b/endpoints/notificationevent.py @@ -4,8 +4,9 @@ import json import re from datetime import datetime -from notificationhelper import build_event_data +from endpoints.notificationhelper import build_event_data from util.jinjautil import get_template_env +from util.morecollections import AttrDict from util.secscan import PRIORITY_LEVELS, get_priority_for_index template_env = get_template_env("events") @@ -121,7 +122,13 @@ class VulnerabilityFoundEvent(NotificationEvent): def get_sample_data(self, notification): event_config = json.loads(notification.event_config_json) - return build_event_data(notification.repository, { + # TODO(jzelinskie): remove when more endpoints have been converted to using + # interfaces + repo = AttrDict({ + 'namespace_name': notification.repository.namespace_user.username, + 'name': notification.repository.name, + }) + return build_event_data(repo, { 'tags': ['latest', 'prod'], 'image': 'some-image-id', 'vulnerability': { diff --git a/endpoints/notificationhelper.py b/endpoints/notificationhelper.py index 8640d741d..3ec7c16eb 100644 --- a/endpoints/notificationhelper.py +++ b/endpoints/notificationhelper.py @@ -1,8 +1,9 @@ +import json + from app import app, notification_queue from data import model from auth.auth_context import get_authenticated_user, get_validated_oauth_token -import json def build_event_data(repo, extra_data={}, subpage=None): repo_string = '%s/%s' % (repo.namespace_name, repo.name)