From f4938ca966566a7a14d41f3e30b24b42802ca254 Mon Sep 17 00:00:00 2001 From: He Weiwei Date: Thu, 3 Sep 2020 11:11:16 +0800 Subject: [PATCH] fix(scanner): move RemoveImmutableScanners before EnsureScanners (#12957) RemoveImmutableScanners may delete the default scanner, so move it before the EnsureScanners. Closes #12938 Signed-off-by: He Weiwei --- src/core/main.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/core/main.go b/src/core/main.go index 58be2f631..e83abe6c5 100755 --- a/src/core/main.go +++ b/src/core/main.go @@ -259,6 +259,10 @@ func registerScanners() { uninstallScannerNames = append(uninstallScannerNames, clairScanner) } + if err := scan.RemoveImmutableScanners(uninstallScannerNames); err != nil { + log.Warningf("failed to remove scanners: %v", err) + } + if err := scan.EnsureScanners(wantedScanners); err != nil { log.Fatalf("failed to register scanners: %v", err) } @@ -269,11 +273,6 @@ func registerScanners() { log.Fatalf("failed to set default scanner: %v", err) } } - - if err := scan.RemoveImmutableScanners(uninstallScannerNames); err != nil { - log.Warningf("failed to remove scanners: %v", err) - } - } func getDefaultScannerName() string {