Add repo purge callbacks and register TUF metadata deletion as one

This commit is contained in:
Evan Cordell 2017-04-12 15:47:24 -04:00
parent 883692345b
commit ec63e495fc
5 changed files with 23 additions and 4 deletions

View file

@ -111,9 +111,13 @@ class Config(object):
self.app_config = None
self.store = None
self.image_cleanup_callbacks = []
self.repo_cleanup_callbacks = []
def register_image_cleanup_callback(self, callback):
self.image_cleanup_callbacks.append(callback)
def register_repo_cleanup_callback(self, callback):
self.repo_cleanup_callbacks.append(callback)
config = Config()

View file

@ -105,6 +105,10 @@ def purge_repository(namespace_name, repository_name):
return False
fetched.delete_instance(recursive=True, delete_nullable=False)
# Run callbacks
for callback in config.repo_cleanup_callbacks:
callback(namespace_name, repository_name)
return True