Issue #5361
Updated by bmbouter about 5 years ago
h3. Problem
1. Assume a user has a plugin installed that contains migrations up to 10, but there are a few code changes that the developer didn't make another migration for.
2. The user runs the installer which due to the "this section":https://github.com/pulp/ansible-pulp/tree/45e3979cf34d403e84a69b371b6d7ee4e8d73ec0/roles/pulp-database/tasks will create migration 11 for the user.
3. Then later the developer commits migration 11 and the user who upgrades receives at upgrade time.
4. Pulp will refuse to start saying there are two migrations 11 now (one from the installer, one from the developer post-upgrade).
h3. Solution
The installer should not auto-create migrations. Django expects migrations to be made by developers and not on end-user systems at install time.
h3. plugin specific encounter of this issue
Makemigration step for pulp_ansible plugin failed with the below error:
<pre>
failed: [ansible-demo] (item=pulp-ansible) => changed=true
cmd:
- /usr/local/lib/pulp/bin/django-admin
- makemigrations
- ansible
delta: '0:00:01.427656'
end: '2019-08-27 16:35:49.892049'
item: pulp-ansible
msg: non-zero return code
rc: 1
start: '2019-08-27 16:35:48.464393'
stderr: |-
CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0011_collectionimport, 0011_auto_20190821_1848 in ansible).
To fix them run 'python manage.py makemigrations --merge'
stderr_lines:
- 'CommandError: Conflicting migrations detected; multiple leaf nodes in the migration graph: (0011_collectionimport, 0011_auto_20190821_1848 in ansible).'
- To fix them run 'python manage.py makemigrations --merge'
stdout: ''
stdout_lines: <omitted>
to retry, use: --limit @/home/sajha/.ansible/retry-files/katello_pulp3.retry
</pre>
The contents of the 0011_auto_20190821_1848 were:
<pre>
# Generated by Django 2.2.3 on 2019-08-21 18:48
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ansible', '0010_ansible_related_names'),
]
operations = [
migrations.AlterModelOptions(
name='collectionimport',
options={'ordering': ['_created']},
),
]
</pre>
Deleting the autogenerated 011 migration file and re-running the playbook fixes the problem.