Make analyzer handle images without features or vulnerabilities
This commit is contained in:
parent
685dd1a925
commit
0e84a94146
1 changed files with 2 additions and 2 deletions
|
@ -113,7 +113,7 @@ class LayerAnalyzer(object):
|
|||
if layer_data is not None:
|
||||
# Dispatch events for any detected vulnerabilities
|
||||
logger.debug('Got data for layer %s: %s', layer.id, layer_data)
|
||||
found_features = layer_data['Layer']['Features']
|
||||
found_features = layer_data['Layer'].get('Features', [])
|
||||
for repository_id in repository_map:
|
||||
tags = repository_map[repository_id]
|
||||
|
||||
|
@ -121,7 +121,7 @@ class LayerAnalyzer(object):
|
|||
if 'Vulnerabilities' not in feature:
|
||||
continue
|
||||
|
||||
for vulnerability in feature['Vulnerabilities']:
|
||||
for vulnerability in feature.get('Vulnerabilities', []):
|
||||
event_data = {
|
||||
'tags': [tag.name for tag in tags],
|
||||
'vulnerability': {
|
||||
|
|
Reference in a new issue