[Pulp-list] pulp 3.3 db migration

Dennis Kliban dkliban at redhat.com
Mon May 4 20:29:58 UTC 2020


You could manually add null=True (keyword argument) to the definition of
the last_sync_revision_number here[0].

[0]
https://github.com/pulp/pulp_rpm/blob/3.3.0/pulp_rpm/app/migrations/0005_optimize_sync.py#L28

On Mon, May 4, 2020 at 4:19 PM Bin Li (BLOOMBERG/ 120 PARK) <
bli111 at bloomberg.net> wrote:

> Is there a workaround or I cannot upgrade before this is fixed?
>
> Thanks
>
> From: dkliban at redhat.com At: 05/04/20 15:52:16
> To: Bin Li (BLOOMBERG/ 120 PARK ) <bli111 at bloomberg.net>
> Cc: pulp-list at redhat.com
> Subject: Re: [Pulp-list] pulp 3.3 db migration
>
> Please file a bug.
>
> This is a problem with a migration that adds the ability to track when an
> RPM repository can skip syncing from the remote repository because the
> metadata is the same as it was during the previous sync. The migration is
> failing to provide a default value for databases that are being upgraded.
>
> On Mon, May 4, 2020 at 3:09 PM Bin Li (BLOOMBERG/ 120 PARK) <
> bli111 at bloomberg.net> wrote:
>
>> Hi,
>>
>> Keep getting this error from ansible_install to upgrade from 3.2 to 3.3.
>> What could cause this and how can we fix it?
>>
>> Thanks
>>
>>
>> TASK [pulp-database : Run database migrations]
>> **********************************************
>> fatal: [pulp3-1]: FAILED! => {"changed": true, "cmd":
>> ["/opt/utils/venv/pulp/3.7.3/bin/django -admin", "migrate", "--no-input"],
>> "delta": "0:00:03.879347", "end": "2020-05-04 14:54:18.580 273", "msg":
>> "non-zero return code", "rc": 1, "start": "2020-05-04 14:54:14.700926",
>> "stderr" : "Traceback (most recent call last):\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/si
>> te-packages/django/db/backends/utils.py\", line 84, in _execute\n return
>> self.cursor.execu te(sql, params)\npsycopg2.errors.NotNullViolation: column
>> \"last_sync_revision_number\" conta ins null values\n\n\nThe above
>> exception was the direct cause of the following exception:\n\n Traceback
>> (most recent call last):\n File
>> \"/opt/utils/venv/pulp/3.7.3/bin/django-admin\", l ine 8, in <module>\n
>> sys.exit(execute_from_command_line())\n File \"/opt/utils/venv/pulp/
>> 3.7.3/lib64/python3.7/site-packages/django/core/management/__init__.py\",
>> line 381, in execut e_from_command_line\n utility.execute()\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3
>> .7/site-packages/django/core/management/__init__.py\", line 375, in
>> execute\n self.fetch_c ommand(subcommand).run_from_argv(self.argv)\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python
>> 3.7/site-packages/django/core/management/base.py\", line 323, in
>> run_from_argv\n self.exec ute(*args, **cmd_options)\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/
>> django/core/management/base.py\", line 364, in execute\n output =
>> self.handle(*args, **opt ions)\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/core/manageme
>> nt/base.py\", line 83, in wrapped\n res = handle_func(*args, **kwargs)\n
>> File \"/opt/util
>> s/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/core/management/commands/migrate.py\",
>> line 234, in handle\n fake_initial=fake_initial,\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib
>> 64/python3.7/site-packages/django/db/migrations/executor.py\", line 117, in
>> migrate\n stat e = self._migrate_all_forwards(state, plan, full_plan,
>> fake=fake, fake_initial=fake_initial)\ n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/migrations/execu
>> tor.py\", line 147, in _migrate_all_forwards\n state =
>> self.apply_migration(state, migrati on, fake=fake,
>> fake_initial=fake_initial)\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.
>> 7/site-packages/django/db/migrations/executor.py\", line 245, in
>> apply_migration\n state = migration.apply(state, schema_editor)\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/s
>> ite-packages/django/db/migrations/migration.py\", line 124, in apply\n
>> operation.database_ forwards(self.app_label, schema_editor, old_state,
>> project_state)\n File \"/opt/utils/venv/p
>> ulp/3.7.3/lib64/python3.7/site-packages/django/db/migrations/operations/fields.py\",
>> line 112 , in database_forwards\n field,\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-
>> packages/django/db/backends/base/schema.py\", line 447, in add_field\n
>> self.execute(sql, p arams)\n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/
>> base/schema.py\", line 137, in execute\n cursor.execute(sql, params)\n File
>> \"/opt/utils/
>> venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.py\",
>> line 67, in exec ute\n return self._execute_with_wrappers(sql, params,
>> many=False, executor=self._execute)\ n File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.p
>> y\", line 76, in _execute_with_wrappers\n return executor(sql, params,
>> many, context)\n F ile
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.py\",
>> line 84, in _execute\n return self.cursor.execute(sql, params)\n File
>> \"/opt/utils/venv/
>> pulp/3.7.3/lib64/python3.7/site-packages/django/db/utils.py\", line 89, in
>> __exit__\n rais e dj_exc_value.with_traceback(traceback) from exc_value\n
>> File \"/opt/utils/venv/pulp/3.7.3/
>> lib64/python3.7/site-packages/django/db/backends/utils.py\", line 84, in
>> _execute\n return self.cursor.execute(sql,
>> params)\ndjango.db.utils.IntegrityError: column \"last_sync_revisio
>> n_number\" contains null values", "stderr_lines": ["Traceback (most recent
>> call last):", " F ile
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backends/utils.py\",
>> line 84, in _execute", " return self.cursor.execute(sql, params)",
>> "psycopg2.errors.NotNu llViolation: column \"last_sync_revision_number\"
>> contains null values", "", "", "The above e xception was the direct cause
>> of the following exception:", "", "Traceback (most recent call last):", "
>> File \"/opt/utils/venv/pulp/3.7.3/bin/django-admin\", line 8, in <module>",
>> " sys.exit(execute_from_command_line())", " File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/
>> site-packages/django/core/management/__init__.py\", line 381, in
>> execute_from_command_line", " utility.execute()", " File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/d
>> jango/core/management/__init__.py\", line 375, in execute", "
>> self.fetch_command(subcomman d).run_from_argv(self.argv)", " File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packa
>> ges/django/core/management/base.py\", line 323, in run_from_argv", "
>> self.execute(*args, * *cmd_options)", " File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/cor
>> e/management/base.py\", line 364, in execute", " output =
>> self.handle(*args, **options)", " File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/core/management/bas
>> e.py\", line 83, in wrapped", " res = handle_func(*args, **kwargs)", " File
>> \"/opt/utils/
>> venv/pulp/3.7.3/lib64/python3.7/site-packages/django/core/management/commands/migrate.py\",
>> l ine 234, in handle", " fake_initial=fake_initial,", " File
>> \"/opt/utils/venv/pulp/3.7.3/l
>> ib64/python3.7/site-packages/django/db/migrations/executor.py\", line 117,
>> in migrate", " state = self._migrate_all_forwards(state, plan, full_plan,
>> fake=fake, fake_initial=fake_initi al)", " File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/migrations
>> /executor.py\", line 147, in _migrate_all_forwards", " state =
>> self.apply_migration(state, migration, fake=fake,
>> fake_initial=fake_initial)", " File \"/opt/utils/venv/pulp/3.7.3/lib6
>> 4/python3.7/site-packages/django/db/migrations/executor.py\", line 245, in
>> apply_migration", " state = migration.apply(state, schema_editor)", " File
>> \"/opt/utils/venv/pulp/3.7.3/lib
>> 64/python3.7/site-packages/django/db/migrations/migration.py\", line 124,
>> in apply", " ope ration.database_forwards(self.app_label, schema_editor,
>> old_state, project_state)", " File \
>> "/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/migrations/operations/fie
>> lds.py\", line 112, in database_forwards", " field,", " File
>> \"/opt/utils/venv/pulp/3.7.3
>> /lib64/python3.7/site-packages/django/db/backends/base/schema.py\", line
>> 447, in add_field", " self.execute(sql, params)", " File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-pa
>> ckages/django/db/backends/base/schema.py\", line 137, in execute", "
>> cursor.execute(sql, p arams)", " File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backend
>> s/utils.py\", line 67, in execute", " return
>> self._execute_with_wrappers(sql, params, many =False,
>> executor=self._execute)", " File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-p
>> ackages/django/db/backends/utils.py\", line 76, in _execute_with_wrappers",
>> " return execu tor(sql, params, many, context)", " File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-p
>> ackages/django/db/backends/utils.py\", line 84, in _execute", " return
>> self.cursor.execute (sql, params)", " File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/
>> utils.py\", line 89, in __exit__", " raise
>> dj_exc_value.with_traceback(traceback) from exc _value", " File
>> \"/opt/utils/venv/pulp/3.7.3/lib64/python3.7/site-packages/django/db/backend
>> s/utils.py\", line 84, in _execute", " return self.cursor.execute(sql,
>> params)", "django.d b.utils.IntegrityError: column
>> \"last_sync_revision_number\" contains null values"], "stdout" :
>> "Operations to perform:\n Apply all migrations: admin, auth, contenttypes,
>> core, file, rpm , sessions\nRunning migrations:\n Applying
>> core.0023_change_exporter_models... OK\n Applyin g
>> core.0024_use_local_storage_for_uploads... OK\n Applying
>> core.0025_task_parent_task... OK\ n Applying core.0026_task_group... OK\n
>> Applying core.0027_export_backend... OK\n Applying
>> core.0028_import_importer_pulpimporter_pulpimporterrepository... OK\n
>> Applying file.0006_de lete_filefilesystemexporter... OK\n Applying
>> file.0007_filefilesystemexporter... OK\n Apply ing
>> rpm.0004_add_metadata_signing_service_fk... OK\n Applying
>> rpm.0005_optimize_sync...", "s tdout_lines": ["Operations to perform:", "
>> Apply all migrations: admin, auth, contenttypes, core, file, rpm,
>> sessions", "Running migrations:", " Applying core.0023_change_exporter_mode
>> ls... OK", " Applying core.0024_use_local_storage_for_uploads... OK", "
>> Applying core.0025_ task_parent_task... OK", " Applying
>> core.0026_task_group... OK", " Applying core.0027_expor t_backend... OK", "
>> Applying core.0028_import_importer_pulpimporter_pulpimporterrepository.. .
>> OK", " Applying file.0006_delete_filefilesystemexporter... OK", " Applying
>> file.0007_file filesystemexporter... OK", " Applying
>> rpm.0004_add_metadata_signing_service_fk... OK", " Ap plying
>> rpm.0005_optimize_sync..."]}
>>
>> _______________________________________________
>> Pulp-list mailing list
>> Pulp-list at redhat.com
>> https://www.redhat.com/mailman/listinfo/pulp-list
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pulp-list/attachments/20200504/88f6b18c/attachment.htm>


More information about the Pulp-list mailing list