← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] ~pappacena/launchpad:snap-pillar into launchpad:master

 

Pushed the requested change. 

I've also removed the XXX comment about validating (project + private) attributes at model level. It would break old snaps if we've added that validation in the future.

Diff comments:

> diff --git a/lib/lp/snappy/interfaces/snap.py b/lib/lp/snappy/interfaces/snap.py
> index 3835b23..c1b2240 100644
> --- a/lib/lp/snappy/interfaces/snap.py
> +++ b/lib/lp/snappy/interfaces/snap.py
> @@ -215,6 +217,15 @@ class SnapPrivacyMismatch(Exception):
>              "Snap contains private information and cannot be public.")
>  
>  
> +@error_status(http_client.BAD_REQUEST)
> +class SnapPrivacyPillarError(Exception):
> +    """Private Snaps should be based in a pillar."""
> +
> +    def __init__(self, message=None):
> +        super(SnapPrivacyPillarError, self).__init__(
> +            message or "Private Snaps should have a pillar.")

Ok!

> +
> +
>  class BadSnapSearchContext(Exception):
>      """The context is not valid for a snap package search."""
>  
> @@ -868,7 +884,7 @@ class ISnapSet(Interface):
>              "git_repository", "git_repository_url", "git_path", "git_ref",
>              "auto_build", "auto_build_archive", "auto_build_pocket",
>              "private", "store_upload", "store_series", "store_name",
> -            "store_channels"])
> +            "store_channels", "project"])

Ok!

>      @operation_for_version("devel")
>      def new(registrant, owner, distro_series, name, description=None,
>              branch=None, git_repository=None, git_repository_url=None,
> diff --git a/lib/lp/snappy/model/snap.py b/lib/lp/snappy/model/snap.py
> index 7e3d14c..4864cf8 100644
> --- a/lib/lp/snappy/model/snap.py
> +++ b/lib/lp/snappy/model/snap.py
> @@ -461,6 +471,21 @@ class Snap(Storm, WebhookTargetMixin):
>              return None
>  
>      @property
> +    def pillar(self):
> +        """See `ISnap`."""
> +        return self.project if self.project_id else None

Right!

> +
> +    @pillar.setter
> +    def pillar(self, pillar):
> +        if pillar is None:
> +            self.project = None
> +        elif IProduct.providedBy(pillar):
> +            self.project = pillar
> +        else:
> +            raise ValueError(
> +                'The pillar of a Snap must be an IProduct instance.')
> +
> +    @property
>      def available_processors(self):
>          """See `ISnap`."""
>          clauses = [Processor.id == DistroArchSeries.processor_id]


-- 
https://code.launchpad.net/~pappacena/launchpad/+git/launchpad/+merge/397458
Your team Launchpad code reviewers is subscribed to branch ~pappacena/launchpad:snap-pillar.


References