Issue #5361
closedInstaller can fail if run a second time on a system due to the installer producing migrations
Description
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 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).
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.
plugin specific encounter of this issue¶
Makemigration step for pulp_ansible plugin failed with the below error:
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
The contents of the 0011_auto_20190821_1848 were:
# 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']},
),
]
Deleting the autogenerated 011 migration file and re-running the playbook fixes the problem.
Related issues