Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 1007416

Summary: API calls client.errata.clone and client.errata.cloneAsync do not add packages
Product: Red Hat Satellite 5 Reporter: Matej Kollar <mkollar>
Component: APIAssignee: Stephen Herr <sherr>
Status: CLOSED NOTABUG QA Contact: Red Hat Satellite QA List <satellite-qa-list>
Severity: high Docs Contact:
Priority: high    
Version: 560CC: cperry, mkollar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-07 15:58:05 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:
Bug Depends On:    
Bug Blocks: 924189    

Description Matej Kollar 2013-09-12 12:51:42 UTC
Description of problem:

   When cloning erratas into cloned channel using API calls
     * client.errata.clone
     * client.errata.cloneAsync
   packages associated with errata are not added to
   channel the erratum is cloned to.

Version-Release number of selected component:


How reproducible: always/deterministic

Steps to Reproduce:
1. create channel $x with some packages
2. clone channel (as original) $x into clone-$x (creates empty clone)
3. create erratum, containing packages from $x
4. using client.errata.clone, clone erratum into clone-$x

Actual results:

  channel is still empty

Expected results:

  packages associated with erratum shall appear in clone-$x

Comment 2 Matej Kollar 2013-09-12 13:47:20 UTC
Just a note: similar calls client.errata.cloneAsOriginal{,Async} adds packages to channel.

Comment 5 Clifford Perry 2013-10-11 16:21:56 UTC
Note: bug 905259 may be related to this, if this issue existed within the 5.5 code as well.

Comment 6 Stephen Herr 2013-11-07 14:00:10 UTC
I cannot reproduce. I have tried on all of Sat 5.5 (embedded oracle), Sat 5.6 (embedded postgres), and Spacewalk nightly. It works as expected every time. My process:

1) create a custom channel named sherr-test-1
2) add a couple packages to sherr-test-1, in this case I've added:
  a) kernel-2.6.32-131.0.15.el6.x86_64
  b) kernel-2.6.32-131.12.1.el6.x86_64
3) create an "original state" clone of sherr-test-1 named sherr-test-2
  a) sherr-test-2 now contains 1 package, kernel-2.6.32-131.0.15.el6.x86_64
4) go back to sherr-test-1, create custom erratum named sherr-1
  a) fill out all required fields
  b) add package kernel-2.6.32-131.12.1.el6.x86_64 to erratum
  c) publish erratum into sherr-test-1 channel
5) clone sherr-1 erratum into sherr-test-2 via the errata.clone api
  a) sherr-test-2 now contains both kernel packages, as expected.

Clearly one of us is missing something. Can you explain your reproducer in more detail? Is there maybe a architecture mismatch between your cloned channel and the package in the erratum?

Comment 7 Stephen Herr 2013-11-07 14:17:06 UTC
Oh, I see that you have provided a reproducer script. Excellent. Let me look at that.

Comment 8 Stephen Herr 2013-11-07 15:58:05 UTC
Okay, I see the confusion.

It's important to realize a couple things.

1) cloning an erratum into a channel only adds updates to packages that already exist in the channel (they have to have the same package name). If the erratum contains 'kernel-...' and 'vim-enhanced-...', but the channel you are cloning the erratum to only currently contains an old kernel package and no vim package, then only the kernel package will be cloned into the channel. This is by design, and not a bug.

2) cloning a channel "as original" will clone "original packages" into the new clone. "Original packages" are defined as packages that:
 a) are not contained in an erratum in that channel
 b) if multiple packages with the same name pass check a, then the oldest (by version) is the "original package"

So in your script you are populating the two test channels with the "no channel" packages. You then add all of them to the erratum, and publish the erratum to both channels.

Then when you clone the test channel, the clone will have 0 packages in it since there are no packages that are not in an erratum in the original channel. Finally, when you clone the erratum into the cloned channel, none of the packages are cloned because none of them are updates to packages that already exist in the channel.

There is no bug here, everything is working as designed. I will close as NOTABUG. If you disagree you can re-open. Thanks for the reproducer script, it was very helpful in figuring out what exactly was wrong.