0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-30 22:34:13 -05:00

sync: cleanup the orphaned private download dir on failure, closes 282

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
Petu Eusebiu 2021-11-18 14:52:32 +02:00 committed by Ramkumar Chinchani
parent 7ada50e9c8
commit f0ef10fa50
2 changed files with 4 additions and 0 deletions

View file

@ -87,6 +87,8 @@ func OneImage(cfg Config, log log.Logger,
return err
}
defer os.RemoveAll(path.Join(imageStore.RootDir(), imageName, SyncBlobUploadDir, uuid.String()))
localTaggedRepo := fmt.Sprintf("%s:%s", localRepo, tag)
localRef, err := layout.ParseReference(localTaggedRepo)

View file

@ -382,6 +382,8 @@ func syncRegistry(regCfg RegistryConfig, storeController storage.StoreController
return err
}
defer os.RemoveAll(path.Join(imageStore.RootDir(), imageName, SyncBlobUploadDir, uuid))
upstreamTaggedRef := getTagFromRef(upstreamRef, log)
localTaggedRepo := fmt.Sprintf("%s:%s", localRepo, upstreamTaggedRef.Tag())