Project

Profile

Help

Issue #5361

Installer can fail if run a second time on a system due to the installer producing migrations

Added by sajha 5 months ago. Updated 5 months ago.

Status:
CLOSED - DUPLICATE
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Severity:
2. Medium
Version:
Platform Release:
Blocks Release:
OS:
Backwards Incompatible:
No
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Katello-P2, Pulp 3 installer
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
Sprint:

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

Duplicates Pulp - Issue #5321: Stop having the installer call makemigrations (scheduled to merge Sept 3rd) CLOSED - CURRENTRELEASE Actions

History

#1 Updated by bmbouter 5 months ago

  • Project changed from Ansible Plugin to Pulp
  • Tags Pulp 3 installer added

Moving to core since this is an installer issue.

#2 Updated by bmbouter 5 months ago

  • Subject changed from makemigration failed for pulp_ansible to installer can fail if run a second time on a system due to the installer producing migrations

retitling to reflect the root cause.

#3 Updated by bmbouter 5 months ago

  • Subject changed from installer can fail if run a second time on a system due to the installer producing migrations to Installer can fail if run a second time on a system due to the installer producing migrations
  • Description updated (diff)

#4 Updated by amacdona@redhat.com 5 months ago

  • Duplicates Issue #5321: Stop having the installer call makemigrations (scheduled to merge Sept 3rd) added

#5 Updated by amacdona@redhat.com 5 months ago

  • Status changed from NEW to CLOSED - DUPLICATE

You are correct that the installer should not make migrations-- this was a step to aid in the early development process, but we have outgrown it. We have another issue that covers this: https://pulp.plan.io/issues/5321 so I am closing as a dupe.

Please register to edit this issue

Also available in: Atom PDF