← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] lp:~wgrant/launchpad/recipe-cancel into lp:launchpad

 

Review: Approve

Very nice, thanks.

Diff comments:

> 
> === modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py'
> --- lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py	2015-08-03 12:59:18 +0000
> +++ lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py	2015-09-11 12:41:23 +0000
> @@ -107,12 +108,10 @@
>              build_url)
>  
>          login(ANONYMOUS)
> -        self.assertEqual(
> -            BuildStatus.SUPERSEDED,
> -            build.status)
> +        self.assertEqual(BuildStatus.CANCELLED, build.status)
>  
>      def test_cancel_build_not_admin(self):

Maybe rename that test now.

> -        """No one but an admin can cancel a build."""
> +        """A normal user can't cancel a build."""
>          queue = self.factory.makeSourcePackageRecipeBuild().queueBuild()
>          build = queue.specific_build
>          transaction.commit()
> 
> === modified file 'lib/lp/code/interfaces/sourcepackagerecipebuild.py'
> --- lib/lp/code/interfaces/sourcepackagerecipebuild.py	2015-05-14 08:50:41 +0000
> +++ lib/lp/code/interfaces/sourcepackagerecipebuild.py	2015-09-11 12:41:23 +0000
> @@ -70,13 +82,34 @@
>      def getFileByName(filename):
>          """Return the file under +files with specified name."""
>  
> -    def cancelBuild():
> -        """Cancel the build."""
> +
> +class ISourcePackageRecipeBuildEdit(Interface):
> +
> +    def cancel():

If you're going to export can_be_cancelled, this should probably be exported as well.

> +        """Cancel the build if it is either pending or in progress.
> +
> +        Check the can_be_cancelled property prior to calling this method to
> +        find out if cancelling the build is possible.
> +
> +        If the build is in progress, it is marked as CANCELLING until the
> +        buildd manager terminates the build and marks it CANCELLED.  If the
> +        build is not in progress, it is marked CANCELLED immediately and is
> +        removed from the build queue.
> +
> +        If the build is not in a cancellable state, this method is a no-op.
> +        """
>  
>      def destroySelf():
>          """Delete the build itself."""
>  
>  
> +class ISourcePackageRecipeBuild(ISourcePackageRecipeBuildView,
> +                                ISourcePackageRecipeBuildEdit):
> +    """A build of a source package."""
> +
> +    export_as_webservice_entry()
> +
> +
>  class ISourcePackageRecipeBuildSource(ISpecificBuildFarmJobSource):
>      """A utility of this interface be used to create source package builds."""
>  


-- 
https://code.launchpad.net/~wgrant/launchpad/recipe-cancel/+merge/270810
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.


References