Merge pull request #1326 from coreos-inc/secworkererror

Make analyzer handle images without features or vulnerabilities
This commit is contained in:
josephschorr 2016-03-29 15:24:37 -04:00
commit 2c7aae10a9

View file

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