mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-24 09:38:09 +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)
|
err = errors.Errorf("getting default scanner: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if defaultScanner != nil && defaultScanner.URL == scannerURL {
|
if defaultScanner != nil {
|
||||||
log.Infof("The default scanner is already set: %s", defaultScanner.URL)
|
log.Infof("Skipped setting %s as the default scanner. The default scanner is already set to %s", scannerURL, defaultScanner.URL)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
scanners, err := scannerManager.List(&q.Query{
|
scanners, err := scannerManager.List(&q.Query{
|
||||||
|
@ -95,7 +95,7 @@ func TestEnsureDefaultScanner(t *testing.T) {
|
|||||||
scannerManager = mgr
|
scannerManager = mgr
|
||||||
|
|
||||||
mgr.On("GetDefault").Return(&scanner.Registration{
|
mgr.On("GetDefault").Return(&scanner.Registration{
|
||||||
URL: "http://trivy:8080",
|
URL: "http://clair:8080",
|
||||||
}, nil)
|
}, nil)
|
||||||
|
|
||||||
err := EnsureDefaultScanner("http://trivy:8080")
|
err := EnsureDefaultScanner("http://trivy:8080")
|
||||||
|
Loading…
Reference in New Issue
Block a user