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 <hweiwei@vmware.com>
This commit is contained in:
He Weiwei 2020-09-03 11:11:16 +08:00 committed by GitHub
parent 262f22f5ef
commit f4938ca966
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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