Problem:
During the upgrade of foreman 3.7.1/4.9 to 3.8.0/4.10 pulpcore-manager migrate --noinput fails with:
ValueError: Found wrong number (0) of constraints for rpm_package(name, epoch, version, release, arch, checksum_type, pkgId)
I tried to regenerate all repositories and content views but no luck. The only thing which is special at that Foreman is that it has two content views which are imported from another foreman (import only)
I also wanted to turn off the “import only” feature that I am able to publish a new version from an upstream repo before upgrading, but the setting is read only in the web ui.
Any help is highly appreciated
Expected outcome:
Upgrade success
Foreman and Proxy versions:
3.7.1
Foreman and Proxy plugin versions:
foreman-tasks 8.1.4
foreman_ansible 12.0.6
foreman_remote_execution 10.1.1
foreman_virt_who_configure 0.5.13
katello 4.9.2
Distribution and version:
rhel 8.9
Other relevant data:
stack trace from foreman-installer:
Error 1: Puppet Exec resource 'pulpcore-manager migrate --noinput' failed. Logs:
/Stage[main]/Pulpcore::Database/Pulpcore::Admin[migrate --noinput]/Exec[pulpcore-manager migrate --noinput]
Adding autorequire relationship with File[/var/lib/pulp]
Adding autorequire relationship with User[pulp]
Starting to evaluate the resource (1194 of 1340)
Evaluated in 6.46 seconds
Exec[pulpcore-manager migrate --noinput](provider=posix)
Executing check 'pulpcore-manager migrate --plan | grep "No planned migration operations"'
Executing 'pulpcore-manager migrate --noinput'
/Stage[main]/Pulpcore::Database/Pulpcore::Admin[migrate --noinput]/Exec[pulpcore-manager migrate --noinput]/returns
Operations to perform:
Apply all migrations: ansible, auth, certguard, container, contenttypes, core, deb, file, python, rpm, sessions
Running migrations:
Applying rpm.0051_alter_distributiontree_unique_together_and_more...Traceback (most recent call last):
File "/usr/bin/pulpcore-manager", line 33, in <module>
sys.exit(load_entry_point('pulpcore==3.28.19', 'console_scripts', 'pulpcore-manager')())
File "/usr/lib/python3.9/site-packages/pulpcore/app/manage.py", line 11, in manage
execute_from_command_line(sys.argv)
File "/usr/lib/python3.9/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/usr/lib/python3.9/site-packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python3.9/site-packages/django/core/management/base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/lib/python3.9/site-packages/django/core/management/base.py", line 458, in execute
output = self.handle(*args, **options)
File "/usr/lib/python3.9/site-packages/django/core/management/base.py", line 106, in wrapper
res = handle_func(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/django/core/management/commands/migrate.py", line 356, in handle
post_migrate_state = executor.migrate(
File "/usr/lib/python3.9/site-packages/django/db/migrations/executor.py", line 135, in migrate
state = self._migrate_all_forwards(
File "/usr/lib/python3.9/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
state = self.apply_migration(
File "/usr/lib/python3.9/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
state = migration.apply(state, schema_editor)
File "/usr/lib/python3.9/site-packages/django/db/migrations/migration.py", line 132, in apply
operation.database_forwards(
File "/usr/lib/python3.9/site-packages/django/db/migrations/operations/models.py", line 659, in database_forwards
alter_together(
File "/usr/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 554, in alter_unique_together
self._delete_composed_index(
File "/usr/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 610, in _delete_composed_index
raise ValueError(
ValueError: Found wrong number (0) of constraints for rpm_package(name, epoch, version, release, arch, checksum_type, pkgId)
change from 'notrun' to ['0'] failed: 'pulpcore-manager migrate --noinput' returned 1 instead of one of [0]
and from manual run:
root@foreman /etc/yum.repos.d (git)-[master] # PULP_SETTINGS=/etc/pulp/settings.py pulpcore-manager migrate --noinput :(
Operations to perform:
Apply all migrations: ansible, auth, certguard, container, contenttypes, core, deb, file, python, rpm, sessions
Running migrations:
Applying rpm.0051_alter_distributiontree_unique_together_and_more...Traceback (most recent call last):
File "/bin/pulpcore-manager", line 33, in <module>
sys.exit(load_entry_point('pulpcore==3.28.19', 'console_scripts', 'pulpcore-manager')())
File "/usr/lib/python3.9/site-packages/pulpcore/app/manage.py", line 11, in manage
execute_from_command_line(sys.argv)
File "/usr/lib/python3.9/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
utility.execute()
File "/usr/lib/python3.9/site-packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python3.9/site-packages/django/core/management/base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/lib/python3.9/site-packages/django/core/management/base.py", line 458, in execute
output = self.handle(*args, **options)
File "/usr/lib/python3.9/site-packages/django/core/management/base.py", line 106, in wrapper
res = handle_func(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/django/core/management/commands/migrate.py", line 356, in handle
post_migrate_state = executor.migrate(
File "/usr/lib/python3.9/site-packages/django/db/migrations/executor.py", line 135, in migrate
state = self._migrate_all_forwards(
File "/usr/lib/python3.9/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
state = self.apply_migration(
File "/usr/lib/python3.9/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
state = migration.apply(state, schema_editor)
File "/usr/lib/python3.9/site-packages/django/db/migrations/migration.py", line 132, in apply
operation.database_forwards(
File "/usr/lib/python3.9/site-packages/django/db/migrations/operations/models.py", line 659, in database_forwards
alter_together(
File "/usr/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 554, in alter_unique_together
self._delete_composed_index(
File "/usr/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 610, in _delete_composed_index
raise ValueError(
ValueError: Found wrong number (0) of constraints for rpm_package(name, epoch, version, release, arch, checksum_type, pkgId)