[Python-modules-team] Bug#863267: Bug#863267: Miscalculates MigrationHistory dependencies between multiple django apps - regression from 1.8

Senthil Kumaran S stylesen at gmail.com
Tue May 30 16:11:00 UTC 2017



On Tuesday 30 May 2017 08:39 PM, Raphael Hertzog wrote:
> On Tue, 30 May 2017, Senthil Kumaran S wrote:
>> I tested the new version ie., test2 and got a traceback as shown here -
>>   File "/usr/lib/python2.7/dist-packages/django/db/migrations/state.py",
>> line 249, in __init__
>>     raise ValueError("\n".join(error.msg for error in errors))
>> ValueError: The field lava_scheduler_app.TestJob.submit_token was
>> declared with a lazy reference to 'linaro_django_xmlrpc.authtoken', but
>> app 'linaro_django_xmlrpc' isn't installed.
> 
> Is that actually true? linaro_django_xmlrpc seems to be listed in
> INSTALLED_APPS, no?

Yes it is listed in INSTALLED_APPS. From the code:

<snip>
INSTALLED_APPS = [
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.humanize',
    'django.contrib.staticfiles',
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:

    # 'django.contrib.admindocs',

    # Add LAVA applications

    'lava_server',
    'dashboard_app',
    'lava_results_app',
    'lava_scheduler_daemon',
    'lava_scheduler_app',
    # Needed applications

    'django_tables2',
    'linaro_django_xmlrpc',
    'google_analytics',
]
</snip>

> Do you have any idea why it would give this error?

Since I am not very proficient with django core / migration code, I do
not know the exact reason. But following is what I understand.

linaro_django_xmlrpc is listed as a dependency in lava_scheduler_app's
initial migration. But it is not honored by the dependency graph that is
generated, where lava_scheduler_app will already be marked as migrated.
linaro_django_xmlrpc should be faked during this migration which we are
unable to do due to the check introduced in 1.10.

To give more background. The migration for linaro_django_xmlrpc was
introduced in November 2015 -
https://git.linaro.org/lava/lava-server.git/commit/?id=02a7c3508c01b89c7efb5d59e79b6880a229ff14

linaro_django_xmlrpc will already be available in the database, but it
was not recorded in the migrations table which should be faked now,
since this migration was introduced after creating the necessary tables
in the database.

> Your patch is a work-around and it works without my patch, so it's
> expected that it would also work with mine... but I would like a Django
> fix that would not require any further change in lava.

I agree.

Thank You.
-- 
Senthil Kumaran
http://www.stylesen.org/
http://www.sasenthilkumaran.com/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20170530/37cfc85c/attachment.sig>


More information about the Python-modules-team mailing list