Closed Bug 1244853 Opened 8 years ago Closed 8 years ago

cleanup product-details usage

Categories

(developer.mozilla.org Graveyard :: Code Cleanup, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: willkg, Assigned: willkg)

Details

MDN uses django-mozilla-product-details 0.7.1 <https://pypi.python.org/pypi/django-mozilla-product-details> for maintaining details about Mozilla products (locales, versions, etc). It has a Django management command which is kicked off via cron.

In bug #1238696, we looked into how Kuma uses it and determined that there's no reason we should be updating product-details via cron.

This work blocks the transition to AWS. It shouldn't otherwise affect anything.

This bug covers:

1. Changing the deploy script to update product-details as part of the deploy process.

2. Nixing the cron job.

3. Figure out what to do about kuma/languages.json, settings.LANGUAGES and kuma/core/apps.py:CoreConfig which both use product-details languages are probably out of sync currently, but have bootstrapping requirements so we probably can't just fix them both to look at product-details.
Summary: move update_product_details cron job to celery → cleanup product-details usage
Step 2 is covered in bug #1245616.

Step 1 is pretty straight-forward.

Step 3 is nuanced. I'm thinking of doing this:

1. Nix kuma/languages.json since at best it's a copy of what's in product-details and at worst, it's an out-of-date copy of product-details.

2. Fix settings.LANGUAGES. I think there are two options:

   2.1. change the code in settings.LANGUAGES to open the product-details languages.json file directly
        rather than the kuma/languages.json file

   2.2. change the code to use code they suggest in the README:

        class LazyLangs(list):
            def __new__(self):
                from product_details import product_details
                return [(lang.lower(), product_details.languages[lang]['native'])
                        for lang in MY_LANGUAGES]
        LANGUAGES = lazy(LazyLangs, list)()

        Course, that won't work if LANGUAGES gets used before bootstrap is finished.

Then we leave kuma/core/apps.py:CoreConfig as it is.


I think I want to go with item 2.1.

Jannis: Do you have a preference for either 2.1 or 2.2? Other better ideas?
Flags: needinfo?(jezdez)
I decided to go with item 2.1 since it's close to the existing behavior without the possibility of going out-of-date. Fewer changes good. Figured I'd just move that forward, so tossing it in a PR.

In a PR: https://github.com/mozilla/kuma/pull/3774
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/2fd870fcbc353ace7eabcc75b03996a6f8137f76
Fix bug 1244853: Add update_product_details to deploy

This adds updating product details to the deploy script. It'll update
the files, then push all the files out to all the servers in the
system.

https://github.com/mozilla/kuma/commit/11752ca1030c8dbbd2238b2f3a8780285928fc1b
Fix bug 1244853: Nix languages.json

This nixes kuma/languages.json and the thing that was using it.

At best, kuma/languages.json was a copy of the file in product-details
which we now pull down during deploys. At worst, it's an out-of-date
copy of the file in product-details which means that
settings.LANGUAGES and kuma/core/apps.py:CoreConfig.language_mapping()
could be out of sync causing who knows what mischief and mayhem.

https://github.com/mozilla/kuma/commit/af35e3b133ea226389af4a1f4f2503542ecfc4d9
Fix bug 1244853: Tweak provisioning for product-details

This adds the -f flag for updating product-details during
provisioning. It forces the creation of things without asking.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Flags: needinfo?(jezdez)
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/c9aca7cd9cefdfa95183b391bb71f5f0d99ec01f
bug 1244853: Remove PROD_DETAILS_DIR

https://github.com/mozilla/kuma/commit/783f1949749a7ca13035c31ac8e634461a4a8f4d
Merge pull request #4459 from jwhitlock/rm-prod-details-1244853

bug 1244853: Remove PROD_DETAILS_DIR
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.