Remove container registry on project removal

This commit is contained in:
Kamil Trzcinski 2016-05-04 14:35:18 +02:00
parent d85b88962b
commit 7168493e8a
2 changed files with 10 additions and 1 deletions

View file

@ -28,6 +28,10 @@ module Projects
Project.transaction do
project.destroy!
unless remove_registry_tags
raise_error('Failed to remove project image registry. Please try again or contact administrator')
end
unless remove_repository(repo_path)
raise_error('Failed to remove project repository. Please try again or contact administrator')
end
@ -61,6 +65,10 @@ module Projects
end
end
def remove_registry_tags
project.image_registry.delete_tags
end
def raise_error(message)
raise DestroyError.new(message)
end

View file

@ -31,7 +31,8 @@ module ImageRegistry
end
end
def delete
def delete_tags
return unless tags
tags.each(:delete)
end
end