notifications: another switch to repo attrdict

Fixes #1919.
This commit is contained in:
Jimmy Zelinskie 2016-10-01 16:42:10 -04:00
parent 6359cb31da
commit fae9538467
2 changed files with 11 additions and 3 deletions

View file

@ -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': {

View file

@ -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)