From 882683ae6feae8a23fd372483c74de25547d9472 Mon Sep 17 00:00:00 2001 From: Tan Jiang Date: Thu, 10 Aug 2017 17:25:34 +0800 Subject: [PATCH] Do not throw error if the scan result is unchanged --- src/common/dao/scan_job.go | 4 ++-- src/jobservice/scan/handlers.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/dao/scan_job.go b/src/common/dao/scan_job.go index 099964953..d3bf1c982 100644 --- a/src/common/dao/scan_job.go +++ b/src/common/dao/scan_job.go @@ -147,8 +147,8 @@ func UpdateImgScanOverview(digest, detailsKey string, sev models.Severity, compO rec.DetailsKey = detailsKey rec.UpdateTime = time.Now() - n, err := o.Update(rec, "Sev", "CompOverviewStr", "DetailsKey", "UpdateTime") - if n == 0 || err != nil { + _, err = o.Update(rec, "Sev", "CompOverviewStr", "DetailsKey", "UpdateTime") + if err != nil { return fmt.Errorf("Failed to update scan overview record with digest: %s, error: %v", digest, err) } return nil diff --git a/src/jobservice/scan/handlers.go b/src/jobservice/scan/handlers.go index 6c788a66b..0850ce6c8 100644 --- a/src/jobservice/scan/handlers.go +++ b/src/jobservice/scan/handlers.go @@ -135,7 +135,7 @@ func (sh *SummarizeHandler) Enter() (string, error) { layerName := sh.Context.layers[len(sh.Context.layers)-1].Name logger.Infof("Top layer's name: %s, will use it to get the vulnerability result of image", layerName) if err := clair.UpdateScanOverview(sh.Context.Digest, layerName); err != nil { - return "", nil + return "", err } return models.JobFinished, nil }