Bug 1191752

Summary: Duplicate Resource Error When Promoting Content
Product: Red Hat Satellite Reporter: Mike McCune <mmccune>
Component: Content ManagementAssignee: Justin Sherrill <jsherril>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: high Docs Contact:
Priority: urgent    
Version: 6.0.8CC: andrew.schofield, bbuckingham, bkearney, chrobert, fdacunha, greg-bz, jsherril, kabbott, lzap, mtaru, sthirugn
Target Milestone: UnspecifiedKeywords: Reopened, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1202790 (view as bug list) Environment:
Last Closed: 2017-01-16 23:44:22 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:
Bug Depends On:    
Bug Blocks: 1202790    

Description Mike McCune 2015-02-11 21:43:02 UTC
Getting an errror the Web UI when trying to promote a content view from my Dev lifecycle environment to my Staging lifecycle environment.


 Duplicate resource: Acme-Staging-Test_View-Acme-Acme_Example_RPMs

We need a way to:

1) prevent this from happening in the future

2) method for cleaning up conflicting records in Pulp to assist when customers get into this situation.

Comment 1 Justin Sherrill 2015-02-11 21:48:22 UTC
Some notes:



Various actions in katello:

Content View Publish
Content View Promote
Enable Repo

end up creating a repo in pulp.  Due to a change that was made for 6.0.4, there is an opportunity for another error to cause a repository to be created in pulp but not katello. 

This only occurs when something else goes wrong, but due to this issue the user is unable to re-attempt the same action, becuase they will get a "Duplicate Resource" error. (the repo has been created in pulp).



To reproduce we need to get Katello into an error state.  To do so we will exploit a known bug:

Steps to Reproduce:
1. Create a content view
2. Publish the content view
3. Go to the puppet environments page
4. Delete the puppet environment
5. Publish a new version of the content view
       you will get an error: ' Validation failed: Puppet environment can't be blank'
6. Try to publish again:
       Duplicate Resource SOME_PULP_ID

You should be able to continuously try to publish and get the same "Puppet environment can't be black error", it should not cause a duplicate resource issue.


I'm sure there are many ways to exploit this duplicate resource problem, as i have seen many customers hit it.

Comment 4 Justin Sherrill 2015-02-12 16:01:01 UTC
Sorry, missed a step in the steps above:


Steps to Reproduce:
1. Create a custom repo
2. Create a content view
3. Add a custom repo to the content view
4. Publish the content view
5. Go to the puppet environments page
6. Delete the puppet environment
7. Publish a new version of the content view
       you will get an error: ' Validation failed: Puppet environment can't be blank'
8. Try to publish again:
       Duplicate Resource SOME_PULP_ID

Comment 5 Mike McCune 2015-02-12 17:39:39 UTC
Cleanup Procedure if you are hit by this bug:

1) Download duplicate detection and cleanup script:

# curl http://people.redhat.com/~mmccune/duplicate_repos.rake > /usr/share/foreman/lib/tasks/duplicate_repos.rake

2) Get list of duplicate repositories

# foreman-rake katello:duplicate_repos

List of repository IDs that exist only in Pulp that need to get deleted:

  * Default_Organization-dupe-resource-test-2-Custom_DEMO-demo1

3) If the above output lists the repos that are blocking a publish or promote then run:

# foreman-rake katello:duplicate_repos delete=true

List of repository IDs that exist only in Pulp that need to get deleted:

  * Default_Organization-dupe-resource-test-2-Custom_DEMO-demo1
Deleting duplicate repositories

Done deleting.

At this point attempt to republish your Content View.  Depending on the root cause of the duplicate repository this may or may not resolve the error during Content View publish

Comment 7 Bryan Kearney 2015-06-30 16:45:34 UTC
This bug is planned to be resolved in the Satellite 6.1 code base in bug https://bugzilla.redhat.com/show_bug.cgi?id=1202790. We are not planning to backport this to 6.0, and are therefore closing out this bug. Please feel free to contact bkearney and dcaplan with any issues.

Comment 8 Greg West 2015-09-04 17:59:32 UTC
I have the same issue with Satellite 6.1.1. The same steps to reproduce are valid.
Unfortunately Mike's cleanup procedure did not work in this case.

Comment 9 Mike McCune 2015-10-13 18:02:45 UTC
re-opening this as it appears to occur in certain circumstances in 6.1.X