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. Expected results: Successfull reset
The error I see in the logs is: 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 2022-02-11 03:11:53 [INFO ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[migrate --noinput]/Exec[pulpcore-manager migrate --noinput]/returns: @
This issue might be caused by the Pulpcore DB not being fully dropped for external DBs. Justin found this bit of code that drops tables: https://github.com/theforeman/foreman-installer/blob/8411f367ce5cb9e185523a42ac3bac54d7379eb9/hooks/pre/10-reset_data.rb#L69-L75 If the whole DB isn't dropped, the types won't get removed, causing the duplicate error.
Yeah, 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.
Created redmine issue https://projects.theforeman.org/issues/36238 from this bug
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36238 has been resolved.
Verified in 6.14 snap 10 satellite-installer --reset-data runs normally with an external DB Steps to Reproduce: 1. Have an external DB setup (SAT + DB host) 2. On the Satellite, run `satellite-installer --reset-data` Results: Installer runs successfully
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Important: Satellite 6.14 security and bug fix update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2023:6818