If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Migration 226 doesn't work without a DB dump.

RESOLVED FIXED

Status

support.mozilla.org
Code Quality
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: mythmon, Assigned: willkg)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: p=0 u=dev c=codequality s=2013.16)

(Reporter)

Description

4 years ago
Migration 226 was written assuming a production-like database was loaded, and this causes problems for code contributors, because it errors out if that is not true. This migration should be made more robust.

This is probably some simple try/catching => 1pt.

This is the traceback fxa got when he tried to run the migrations:

    Running .py migation 226:
    /root/workspace/kitsune/venv/bin/python -B manage.py runscript migrations.226-retopic-questions
    Error: Had trouble running this: /root/workspace/kitsune/venv/bin/python -B manage.py runscript migrations.226-retopic-questions
    stdout: Exception while running run() in 'migrations.226-retopic-questions'
    Traceback (most recent call last):
      File "manage.py", line 47, in <module>
        execute_manager(settings)
      File "/root/workspace/kitsune/vendor/src/django/django/core/management/__init__.py", line 459, in execute_manager
        utility.execute()
      File "/root/workspace/kitsune/vendor/src/django/django/core/management/__init__.py", line 382, in execute
        self.fetch_command(subcommand).run_from_argv(self.argv)
      File "/root/workspace/kitsune/vendor/src/django/django/core/management/base.py", line 196, in run_from_argv
        self.execute(*args, **options.__dict__)
      File "/root/workspace/kitsune/vendor/src/django/django/core/management/base.py", line 232, in execute
        output = self.handle(*args, **options)
      File "/root/workspace/kitsune/vendor/src/django-extensions/django_extensions/management/commands/runscript.py", line 158, in handle
        run_script(mod, *script_args)
      File "/root/workspace/kitsune/vendor/src/django-extensions/django_extensions/management/commands/runscript.py", line 83, in run_script
        mod.run(*script_args)
      File "/root/workspace/kitsune/migrations/226-retopic-questions.py", line 14, in run
        product = Product.objects.get(slug=product_slug)
      File "/root/workspace/kitsune/vendor/src/django/django/db/models/manager.py", line 131, in get
        return self.get_query_set().get(*args, **kwargs)
      File "/root/workspace/kitsune/vendor/src/django/django/db/models/query.py", line 366, in get
        % self.model._meta.object_name)
    kitsune.products.models.DoesNotExist: Product matching query does not exist.
     
    stderr: None
    returncode: 1
(Reporter)

Updated

4 years ago
Duplicate of this bug: 905862

Updated

4 years ago
Blocks: 905834
(Reporter)

Comment 2

4 years ago
This keeps popping up. Sticking it in the next sprint.
Whiteboard: p=1 u=dev c=kb s=2013.backlog → p=1 u=dev c=kb s=2013.17
I keep meaning to fix this and write some scaffolding so I can test migrations against empty databases going forward. I'll grab this and do it now.

Making it 0 points because I was looking at it last week when I bumped into it. Pretty sure it's an easy fix.
Assignee: nobody → willkg
Whiteboard: p=1 u=dev c=kb s=2013.17 → p=0 u=dev c=kb s=2013.16
In a PR: https://github.com/mozilla/kitsune/pull/1572
Landed in master: https://github.com/mozilla/kitsune/commit/a3f08a6

This doesn't need to be pushed so I'm closing it now.
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Whiteboard: p=0 u=dev c=kb s=2013.16 → p=0 u=dev c=codequality s=2013.16
You need to log in before you can comment on or make changes to this bug.