From 35d074e849c2ff716e6ee79bb808b3003d5fa5ff Mon Sep 17 00:00:00 2001 From: Steven Zou Date: Tue, 29 Oct 2019 13:19:47 +0800 Subject: [PATCH] fix bug found in the pluggable scanner - fix #9632 - fix #9633 Signed-off-by: Steven Zou --- src/jobservice/job/impl/scan/all.go | 2 +- src/pkg/scan/event/init.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/jobservice/job/impl/scan/all.go b/src/jobservice/job/impl/scan/all.go index 01761cec9..812ea0ac9 100644 --- a/src/jobservice/job/impl/scan/all.go +++ b/src/jobservice/job/impl/scan/all.go @@ -95,7 +95,7 @@ func (sa *All) Run(ctx job.Context, params job.Parameters) error { data, err := ioutil.ReadAll(resp.Body) if err != nil { logger.Errorf("Failed to read response, error: %v", err) - } else if resp.StatusCode != http.StatusOK { + } else if resp.StatusCode != http.StatusAccepted { logger.Errorf("Unexpected response code: %d, data: %v", resp.StatusCode, data) } resp.Body.Close() diff --git a/src/pkg/scan/event/init.go b/src/pkg/scan/event/init.go index 0e63fbc85..83deb9e84 100644 --- a/src/pkg/scan/event/init.go +++ b/src/pkg/scan/event/init.go @@ -26,5 +26,7 @@ func Init() { log.Debugf("Subscribe topic %s for cascade deletion of scan reports", model.DeleteImageTopic) err := notifier.Subscribe(model.DeleteImageTopic, NewOnDelImageHandler()) - log.Error(errors.Wrap(err, "register on delete image handler: init: scan")) + if err != nil { + log.Error(errors.Wrap(err, "register on delete image handler: init: scan")) + } }