Bug 2119120

Summary: ACS create fails when same name used with "PG::UniqueViolation: ERROR: duplicate key value violates unique constraint"
Product: Red Hat Satellite Reporter: Gaurav Talreja <gtalreja>
Component: Alternate Content SourcesAssignee: Samir Jha <sajha>
Status: CLOSED ERRATA QA Contact: Gaurav Talreja <gtalreja>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.12.0CC: iballou, pcreech, sajha, satellite6-bugs
Target Milestone: 6.12.0Keywords: Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-4.5.0.14-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-16 13:35:21 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 Gaurav Talreja 2022-08-17 15:16:09 UTC
Description of problem:


Version-Release number of selected component (if applicable):
Satellite 6.12.0 Snap 6.1

How reproducible:
Always

Steps to Reproduce:
1. Enable ACS lab feature
2. # hammer alternate-content-source create --name test_repo_acs --base-url http://reposerver.example.com:33333/ --subpaths fake_yum0/ --smart-proxy-ids 1
Alternate Content Source created.

3. # hammer alternate-content-source create --name test_repo_acs --base-url http://reposerver.example.com:33333/ --subpaths fake_yum0/
Could not create the Alternate Content Source.:
  PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "index_katello_alternate_content_sources_on_name"
  DETAIL:  Key (name)=(test_repo_acs) already exists.

Actual results:


Expected results:


Additional info:

Comment 1 Ian Ballou 2022-08-17 16:01:42 UTC
This is likely fixed upstream in code that won't be back-portable to 6.12

Comment 2 Ian Ballou 2022-08-17 17:49:56 UTC
Never mind, it's the same in upstream!

Comment 3 Samir Jha 2022-09-02 16:16:14 UTC
Created redmine issue https://projects.theforeman.org/issues/35482 from this bug

Comment 4 Bryan Kearney 2022-09-06 16:04:59 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/35482 has been resolved.

Comment 7 Gaurav Talreja 2022-09-23 21:57:36 UTC
Verified.

Tested on Satellite 6.12.0 Snap 12.0

Steps:
1. # hammer alternate-content-source create --name test_repo_acs --base-url http://reposerver.example.com:33333/ --subpaths fake_yum0/ --smart-proxy-ids 1

Observation:
Above command ran twice as mentioned in comment 1, and the validation included for the name says "Validation failed: Name has already been taken" and there were no DB errors returned.

Comment 11 errata-xmlrpc 2022-11-16 13:35:21 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.12 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:8506

Comment 12 Red Hat Bugzilla 2023-09-18 04:44:59 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days