Bug 2053421 - Installer --reset-data fails on an external DB setup
Summary: Installer --reset-data fails on an external DB setup
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Installation
Version: 6.10.3
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: 6.14.0
Assignee: Evgeni Golov
QA Contact: Griffin Sullivan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-11 09:26 UTC by Vladimír Sedmík
Modified: 2023-11-08 14:18 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2242906 (view as bug list)
Environment:
Last Closed: 2023-11-08 14:17:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 36238 0 Normal New Installer --reset-data fails on an external DB setup 2023-03-28 07:43:20 UTC
Red Hat Issue Tracker SAT-17451 0 None None None 2023-05-01 17:49:21 UTC
Red Hat Product Errata RHSA-2023:6818 0 None None None 2023-11-08 14:18:04 UTC

Description Vladimír Sedmík 2022-02-11 09:26:16 UTC
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

Comment 5 Eric Helms 2022-03-22 14:04:50 UTC
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:


@

Comment 7 Ian Ballou 2022-03-22 15:04:21 UTC
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.

Comment 8 Evgeni Golov 2022-03-23 07:36:59 UTC
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.

Comment 10 Evgeni Golov 2023-03-28 07:43:19 UTC
Created redmine issue https://projects.theforeman.org/issues/36238 from this bug

Comment 11 Bryan Kearney 2023-03-28 16:02:33 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36238 has been resolved.

Comment 12 Griffin Sullivan 2023-08-03 19:18:18 UTC
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

Comment 15 errata-xmlrpc 2023-11-08 14:17:47 UTC
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


Note You need to log in before you can comment on or make changes to this bug.