Add -force-drop to aptly publish drop, ?force=1 to DELETE publish/... to drop

published repositories even if cleanup fails. #153
This commit is contained in:
Andrey Smirnov
2015-03-11 22:02:11 +03:00
parent d5c6f0b623
commit f8bca463bb
3 changed files with 11 additions and 4 deletions
+5 -2
View File
@@ -1000,7 +1000,8 @@ func (collection *PublishedRepoCollection) CleanupPrefixComponentFiles(prefix st
// Remove removes published repository, cleaning up directories, files
func (collection *PublishedRepoCollection) Remove(publishedStorageProvider aptly.PublishedStorageProvider,
storage, prefix, distribution string, collectionFactory *CollectionFactory, progress aptly.Progress) error {
storage, prefix, distribution string, collectionFactory *CollectionFactory, progress aptly.Progress,
force bool) error {
repo, err := collection.ByStoragePrefixDistribution(storage, prefix, distribution)
if err != nil {
return err
@@ -1041,7 +1042,9 @@ func (collection *PublishedRepoCollection) Remove(publishedStorageProvider aptly
err = collection.CleanupPrefixComponentFiles(repo.Prefix, cleanComponents,
publishedStorageProvider.GetPublishedStorage(storage), collectionFactory, progress)
if err != nil {
return err
if !force {
return fmt.Errorf("cleanup failed, use -force-drop to override: %s", err)
}
}
}