Bug 1539095

Summary: spacecmd softwarechannel_clonetree aborts with duplicate key value violates unique constraint "rhn_ce_ce_uq"
Product: [Community] Spacewalk Reporter: Ben Roberts <ben.roberts>
Component: ServerAssignee: Tomáš Kašpárek <tkasparek>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.7CC: michele.bologna
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: spacewalk-java-2.9.23-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-01-15 07:59:27 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: 1653216    

Description Ben Roberts 2018-01-26 16:00:38 UTC
Description of problem:
spacecmd softwarechannel_clonetree aborts part way through the tree with error:

ERROR: redstone.xmlrpc.XmlRpcFault: unhandled internal exception: ERROR: duplicate key value violates unique constraint "rhn_ce_ce_uq"
  Detail: Key (channel_id, errata_id)=(1731, 25865) already exists.

Here, channel_id=1731 is the channel in the process of being cloned, and I suspect this is done inside a transaction which is rolled back after this error is encountered since there is no channel with that ID visible through the webui).
errata_id refers to a cloned errata, present in two children (fedora-26-updates and fedora26-updates-testing) of the base channel. In this case, the channel tree being cloned is already a clone of the "head" tree, i.e. head-fedora -(already cloned to)-> 201801-fedora -(being cloned to)-> qa-fedora.

Version-Release number of selected component (if applicable):
spacecmd-2.7.16-1.el7.noarch
spacewalk-backend-server-2.7.139-1.el7.noarch

How reproducible:
Every time this base channel is cloned


Steps to Reproduce:
1. spacecmd softwarechannel_clonetree -s '201801-fedora' -x '/^201801-/qa-/' --gpg-copy
2. 
3.

Actual results:
Child channels that are before the failing channel are cloned. The failing channel and subsequent channels are not cloned. The above error is printed

Expected results:
The full tree of channels should be cloned without error

Additional info:

Comment 1 michele.bologna 2018-07-31 15:55:00 UTC
Workaround/fix: https://github.com/spacewalkproject/spacewalk/pull/666

Comment 2 Tomáš Kašpárek 2018-07-31 19:26:38 UTC
spacewalk.git(master): d4b470419df236abb61f9e5689d828923abc9a33

Comment 3 Michael Mráka 2018-11-26 09:44:03 UTC
Move Spacewalk 2.9 bugs ON_QA.

Comment 4 Michael Mráka 2019-01-15 07:59:27 UTC
Spacewalk 2.9 has been released.
https://github.com/spacewalkproject/spacewalk/wiki/ReleaseNotes29