parent
6359cb31da
commit
fae9538467
2 changed files with 11 additions and 3 deletions
|
@ -4,8 +4,9 @@ import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from datetime import datetime
|
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.jinjautil import get_template_env
|
||||||
|
from util.morecollections import AttrDict
|
||||||
from util.secscan import PRIORITY_LEVELS, get_priority_for_index
|
from util.secscan import PRIORITY_LEVELS, get_priority_for_index
|
||||||
|
|
||||||
template_env = get_template_env("events")
|
template_env = get_template_env("events")
|
||||||
|
@ -121,7 +122,13 @@ class VulnerabilityFoundEvent(NotificationEvent):
|
||||||
def get_sample_data(self, notification):
|
def get_sample_data(self, notification):
|
||||||
event_config = json.loads(notification.event_config_json)
|
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'],
|
'tags': ['latest', 'prod'],
|
||||||
'image': 'some-image-id',
|
'image': 'some-image-id',
|
||||||
'vulnerability': {
|
'vulnerability': {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
import json
|
||||||
|
|
||||||
from app import app, notification_queue
|
from app import app, notification_queue
|
||||||
from data import model
|
from data import model
|
||||||
from auth.auth_context import get_authenticated_user, get_validated_oauth_token
|
from auth.auth_context import get_authenticated_user, get_validated_oauth_token
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
def build_event_data(repo, extra_data={}, subpage=None):
|
def build_event_data(repo, extra_data={}, subpage=None):
|
||||||
repo_string = '%s/%s' % (repo.namespace_name, repo.name)
|
repo_string = '%s/%s' % (repo.namespace_name, repo.name)
|
||||||
|
|
Reference in a new issue