← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] ~pappacena/launchpad:delete-oci-project into launchpad:master

 

Review: Needs Information

What about bugs?  Now that those are landing, I guess this will need to handle those too (maybe just refusing if the OCI project has any bug tasks).

Diff comments:

> diff --git a/lib/lp/registry/model/ociproject.py b/lib/lp/registry/model/ociproject.py
> index e98b3ea..da0bb98 100644
> --- a/lib/lp/registry/model/ociproject.py
> +++ b/lib/lp/registry/model/ociproject.py
> @@ -297,6 +298,28 @@ class OCIProject(BugTargetBase, StormBase):
>          namespace = getUtility(IGitNamespaceSet).get(person, oci_project=self)
>          return namespace.name
>  
> +    def destroySelf(self):
> +        """See `IOCIProject`."""
> +        from lp.oci.model.ocirecipe import OCIRecipe
> +        from lp.code.model.gitrepository import GitRepository
> +
> +        exists_recipes = not IStore(OCIRecipe).find(
> +            OCIRecipe,
> +            OCIRecipe.oci_project == self).is_empty()
> +        if exists_recipes:
> +            raise CannotDeleteOCIProject("This OCI recipe contains recipes.")

Maybe "This OCI project contains recipes."?

> +
> +        git_repos = IStore(GitRepository).find(
> +            GitRepository, GitRepository.oci_project == self)
> +        if not git_repos.is_empty():
> +            repos = ", ".join(repo.display_name for repo in git_repos)
> +            raise CannotDeleteOCIProject(
> +                "There are git repositories associated with this OCI project: "
> +                + repos)
> +        for series in self.series:
> +            series.destroySelf()
> +        IStore(self).remove(self)
> +
>  
>  @implementer(IOCIProjectSet)
>  class OCIProjectSet:


-- 
https://code.launchpad.net/~pappacena/launchpad/+git/launchpad/+merge/401424
Your team Launchpad code reviewers is subscribed to branch ~pappacena/launchpad:delete-oci-project.


References