mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-18 22:57:38 +01:00
Merge pull request #11558 from danielpacak/fix/issue_11310/preserve_default_scanner
fix(scanner): Do not override the default scanner on init
This commit is contained in:
commit
6986af6e74
@ -73,8 +73,8 @@ func EnsureDefaultScanner(scannerURL string) (err error) {
|
||||
err = errors.Errorf("getting default scanner: %v", err)
|
||||
return
|
||||
}
|
||||
if defaultScanner != nil && defaultScanner.URL == scannerURL {
|
||||
log.Infof("The default scanner is already set: %s", defaultScanner.URL)
|
||||
if defaultScanner != nil {
|
||||
log.Infof("Skipped setting %s as the default scanner. The default scanner is already set to %s", scannerURL, defaultScanner.URL)
|
||||
return
|
||||
}
|
||||
scanners, err := scannerManager.List(&q.Query{
|
||||
|
@ -95,7 +95,7 @@ func TestEnsureDefaultScanner(t *testing.T) {
|
||||
scannerManager = mgr
|
||||
|
||||
mgr.On("GetDefault").Return(&scanner.Registration{
|
||||
URL: "http://trivy:8080",
|
||||
URL: "http://clair:8080",
|
||||
}, nil)
|
||||
|
||||
err := EnsureDefaultScanner("http://trivy:8080")
|
||||
|
Loading…
Reference in New Issue
Block a user