Bug 2058905

Summary: Content Import does not delete version on failure
Product: Red Hat Satellite Reporter: Partha Aji <paji>
Component: Inter Satellite SyncAssignee: Partha Aji <paji>
Status: CLOSED ERRATA QA Contact: Radek Mynar <rmynar>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.11.0CC: jpasqual, pcreech, sadas, vsedmik, zhunting
Target Milestone: 6.11.0Keywords: Triaged, UserExperience
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2075031 (view as bug list) Environment:
Last Closed: 2022-07-05 14:34:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Partha Aji 2022-02-26 20:06:10 UTC
During content-import the importing server creates a content-view-version and then tries to import the content into pulp. If the pulp import fails the task errors out. The user then has to remove the content view version and try importing again. Generated content views like repo import based content views will not be visible to the user. So it is not possible for the user to delete the version even if they want to.

On import failure we should instead be just deleting the useless content view version automatically.

Steps to Reproduce:
1. Start a content-view version import task
2. make the import task fail unexpectedly (kill the worker importing it, for example)
3. Notice that the task errors out with a warning
4. Go to Content => Content Views - Content View details of the importing content view


Actual:
5. Notice that a new content view version got created even though it has no content
6. Try importing again and you notice an error message along the lines of
"""
Content View Version specified in the metadata - '<my content view> 2.0' already exists. If you wish to replace the existing version, delete '<my content view> 2.0' and try import again.
"""

Expected:
No version created. Since the import did not succeed the generate version should automatically get deleted. Re-import should work with no errors.

Comment 1 Partha Aji 2022-02-26 20:09:34 UTC
Connecting redmine issue https://projects.theforeman.org/issues/34518 from this bug

Comment 2 Bryan Kearney 2022-02-27 00:05:47 UTC
Upstream bug assigned to paji

Comment 3 Bryan Kearney 2022-02-27 00:05:49 UTC
Upstream bug assigned to paji

Comment 5 Radek Mynar 2022-04-29 14:14:35 UTC
I prepared complete and incremental exports of few Content View versions. Then I tried to import them and killed the import task (kill pulpcore-worker). Approptiate CV version was created when import started and removed after import task failed. Re-import of CVs was successful. 

VERIFIED with Satellite 6.11 SNAP 17.0 @ RHEL8.5

Comment 8 errata-xmlrpc 2022-07-05 14:34:01 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 (Moderate: Satellite 6.11 Release), 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-2022:5498