Merge lp:~sinzui/launchpad/uncommercial-projects into lp:launchpad

Proposed by Curtis Hovey
Status: Merged
Approved by: Graham Binns
Approved revision: no longer in the source branch.
Merged at revision: 15402
Proposed branch: lp:~sinzui/launchpad/uncommercial-projects
Merge into: lp:launchpad
Diff against target: 0 lines
To merge this branch: bzr merge lp:~sinzui/launchpad/uncommercial-projects
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Benji York (community) code Approve
Review via email: mp+109404@code.launchpad.net

Commit message

Do not send expiration messages to project that have become noncommercial.

Description of the change

Pre-implementation: jcsackett

Testing on QA staging revealed that Launchpad does not know how to
handle project that *had* a commercial subscription, but allowed it
to expire. The project is open source and it does not have any
commercial features enabled. Projects like /swift will get an
expiration notice every day.

--------------------------------------------------------------------

RULES

    * Add a delete method to CommercialSubscription that ensures you
      cannot delete an active subscription.
    * At the end of the expiration job's cleanup, it deletes the
      commercial subscription if the project is open source.
      * The project will be ignored by subsequent runs of commercial jobs
        because they only search for projects with commercial subscriptions.
      * This also ensures users do not see the expired commercial subscription
        message on the project page.

    ADDENDUM
    * The jobs runner was not setup to run the jobs when they are created.
    * The configuration overlaps with the daily_product_jobs script.
      Update the schema so that the job runner and the cronscript share
      information.

QA

    * Prepare and run a clean up script that deletes the expired commercial
      subscriptions of noncommercial projects.
      * This is a separate task that will also be run on production.

    * Ask a WebOps to run ./cronscripts/daily_product_jobs.py -vvv
    * Verify that the script reports that 14 or more jobs were created.
    * Verify that a ThirtyDay... job were created for numerink.
    * Verify that an Expired... job were created for sausalito.
    * Verify that sausalito is deactivated.
    * Verify swift did not get a job created.

LINT

    cronscripts/daily_product_jobs.py
    database/schema/security.cfg
    lib/lp/registry/errors.py
    lib/lp/registry/interfaces/commercialsubscription.py
    lib/lp/registry/model/commercialsubscription.py
    lib/lp/registry/model/productjob.py
    lib/lp/registry/tests/test_commercial_subscription.py
    lib/lp/registry/tests/test_productjob.py
    lib/lp/services/config/schema-lazr.conf

TEST

    ./bin/test -vvc lp.registry.tests.test_productjob
    ./bin/test -vvc lp.registry.tests.test_commercial_subscription

IMPLEMENTATION

Added the three commercial subscription jobs to run in the job source groups.
Updated the cronscript to share the config section.
    cronscripts/daily_product_jobs.py
    lib/lp/services/config/schema-lazr.conf

Updated Commercial subscription to support delete when the subscription is
expired.
    lib/lp/registry/errors.py
    lib/lp/registry/interfaces/commercialsubscription.py
    lib/lp/registry/model/commercialsubscription.py
    lib/lp/registry/tests/test_commercial_subscription.py

Updated the CommercialExpiredJob to delete the subscription if the project
is not proprietary. This is a case were a non-proprietary project is no
longer needs commercial features. I also removed some duplication in the tests.
    database/schema/security.cfg
    lib/lp/registry/model/productjob.py
    lib/lp/registry/tests/test_productjob.py

To post a comment you must log in.
Revision history for this message
Benji York (benji) wrote :

The code looks good. I asked Graham to do some follow-up during his review rotation. That should show up momentarily.

review: Approve (code)
Revision history for this message
Graham Binns (gmb) wrote :

Benji asked me to take a look at this:

    * At the end of the expiration job's cleanup, it deletes the
      commercial subscription if the project is open source.
      * The project will be ignored by subsequent runs of commercial jobs
        because they only search for projects with commercial subscriptions.

I think that this is safe enough, given that the project isn't being switched to an OS license at this point (IIUC, anyway); it's just a cleanup-if-this-happens-to-be-the-case clause so I'm happy with it.

review: Approve (code)

Preview Diff

Empty