Bug #36238
closedInstaller --reset-data fails on an external DB setup
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=2053421
Description of problem:
Installer reset on an external DB setup fails, effectively blocking backup restore on that setup.
Version-Release number of selected component (if applicable):
6.10.3 snap 1
How reproducible:
always
Steps to Reproduce:
1. Have an external DB setup (SAT + DB host)
2. On the Satellite, run `satellite-installer --reset-data`
Actual results:
Installer fails:
2022-02-11 04:12:08 [NOTICE] [configure] 1250 configuration steps out of 1850 steps complete.
2022-02-11 04:13:37 [NOTICE] [configure] 1500 configuration steps out of 1850 steps complete.
2022-02-11 04:14:49 [ERROR ] [configure] 'pulpcore-manager migrate --noinput' returned 1 instead of one of [0]
2022-02-11 04:14:49 [ERROR ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[migrate --noinput]/Exec[pulpcore-manager migrate --noinput]/returns: change from 'notrun' to ['0'] failed: 'pulpcore-manager migrate --noinput' returned 1 instead of one of [0]
2022-02-11 04:14:49 [NOTICE] [configure] 1750 configuration steps out of 1850 steps complete.
2022-02-11 04:14:52 [NOTICE] [configure] System configuration has finished.
There were errors detected during install.
Looking at the installer log, the real error is:
2022-02-11 03:11:53 [INFO ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[migrate --noinput]/Exec[pulpcore-manager migrate --noinput]/returns: Applying rpm.0013_RAW_rpm_evr_extension...Traceback (most recent call last):
2022-02-11 03:11:53 [INFO ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[migrate --noinput]/Exec[pulpcore-manager migrate --noinput]/returns: File "/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 82, in _execute
2022-02-11 03:11:53 [INFO ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[migrate --noinput]/Exec[pulpcore-manager migrate --noinput]/returns: return self.cursor.execute(sql)
2022-02-11 03:11:53 [INFO ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[migrate --noinput]/Exec[pulpcore-manager migrate --noinput]/returns: psycopg2.errors.DuplicateObject: type "pulp_evr_array_item" already exists
And looking at the migration (https://github.com/pulp/pulp_rpm/blob/main/pulp_rpm/app/migrations/0013_RAW_rpm_evr_extension.py), it creates types and functions, not tables. So it's never deleted by https://github.com/theforeman/foreman-installer/blob/416f45216493f9ad4d331a54d7cc92e42b8dbfd5/hooks/pre/10-reset_data.rb#L68-L76
Expected results:
Successfull reset