ubuntu: remove dir if clone/pull fails halfway (#79)
* ubuntu: remove dir if clone/pull fails halfway * ubuntu: remove dir if clone/pull fails halfway (nit) https://github.com/aquasecurity/vuln-list-update/pull/79#discussion_r592879762
This commit is contained in:
parent
dae5f0ef64
commit
e75006e8cd
@ -78,12 +78,15 @@ func Update() error {
|
||||
dir := filepath.Join(utils.CacheDir(), cveTrackerDir)
|
||||
for _, url := range repoURLs {
|
||||
_, err = gc.CloneOrPull(url, dir, "master", false)
|
||||
if err != nil {
|
||||
log.Printf("failed to clone or pull: %s: %v", url, err)
|
||||
continue
|
||||
}
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
log.Printf("failed to clone or pull: %s: %v", url, err)
|
||||
log.Printf("removing %s directory", cveTrackerDir)
|
||||
if err := os.RemoveAll(dir); err != nil {
|
||||
return xerrors.Errorf("failed to remove %s directory: %w", cveTrackerDir, err)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to clone or pull: %w", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user