diff --git a/util/secscan/analyzer.py b/util/secscan/analyzer.py index 141144ed6..3f0309a1e 100644 --- a/util/secscan/analyzer.py +++ b/util/secscan/analyzer.py @@ -64,6 +64,8 @@ class LayerAnalyzer(object): except AnalyzeLayerException: # Something went wrong when trying to analyze the layer and we cannot retry, so mark the # layer as invalid. + logger.exception('Got exception when trying to analyze layer %s via security scanner', + layer.id) if not set_secscan_status(layer, False, self._target_version): raise PreemptedException diff --git a/util/secscan/api.py b/util/secscan/api.py index 4dec14a7f..48b5d84f2 100644 --- a/util/secscan/api.py +++ b/util/secscan/api.py @@ -280,6 +280,7 @@ class ImplementedSecurityScannerAPI(SecurityScannerAPIInterface): request = self._new_analyze_request(layer) if not request: + logger.error('Could not build analyze request for layer %s', layer.id) raise AnalyzeLayerException logger.info('Analyzing layer %s', request['Layer']['Name']) @@ -303,12 +304,14 @@ class ImplementedSecurityScannerAPI(SecurityScannerAPIInterface): if message == UNKNOWN_PARENT_LAYER_ERROR_MSG: raise MissingParentLayerException('Bad request to security scanner: %s' % message) else: + logger.exception('Got non-200 response for analyze of layer %s', layer.id) raise AnalyzeLayerException('Bad request to security scanner: %s' % message) # 422 means that the layer could not be analyzed: # - the layer could not be extracted (might be a manifest or an invalid .tar.gz) # - the layer operating system / package manager is unsupported elif ex.response.status_code == 422: raise InvalidLayerException + # Otherwise, it is some other error and we should retry. raise AnalyzeLayerRetryException