Bug 1327055

Summary: Publishing multiple custom yum repos with same URL throws error
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: Content ViewsAssignee: Partha Aji <paji>
Status: CLOSED ERRATA QA Contact: Sachin Ghai <sghai>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: bbuckingham, cwelton, ehelms, mmccune
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/14257
Whiteboard:
Fixed In Version: rubygem-katello-3.0.0.22-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:35:49 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: 1318743    
Bug Blocks:    
Attachments:
Description Flags
error on publishing repos with same URL
none
successfully published/promoted custom repos with same URL
none
promoted capsule and tools repos of snap9.1 and 9.2 (having same URL's for both repos) none

Description Sachin Ghai 2016-04-14 07:52:13 UTC
Created attachment 1147062 [details]
error on publishing repos with same URL

Description of problem:
I was trying to upgrade sat62 box from snap7 to snap8. So I added seperate repos for snap8 instead of re-syncing existing one. And added them to existing CV and tried publish the CV but cv publish failed with error:

2016-04-14 03:33:17 [app] [D] With body: {"displayMessage":"Content Views cannot contain multiple Kickstart trees with the same version and architecture. Multiple Kickstart trees of 6.2.0 x86_64 were found in Repositories: [\"sat6tool7\", \"tools_snap81\", \"capsule7\", \"capsule_snap81\"]","errors":["Content Views cannot contain multiple Kickstart trees with the same version and architecture. Multiple Kickstart trees of 6.2.0 x86_64 were found in Repositories: [\"sat6tool7\", \"tools_snap81\", \"capsule7\", \"capsule_snap81\"]"]}


here you can see, there are no kickstart trees, only custom yum repos related to capsule and sat tools of snap7 and snap8. In any case error is misleading. 

Version-Release number of selected component (if applicable):
upgrade sat6.2 beta snap 7 to snap8

How reproducible:
always

Steps to Reproduce:
1. Add two repos with same url and add them to cv
2. publish cv
3.

Actual results:

2016-04-14 03:33:17 [app] [D] With body: {"displayMessage":"Content Views cannot contain multiple Kickstart trees with the same version and architecture. Multiple Kickstart trees of 6.2.0 x86_64 were found in Repositories: [\"sat6tool7\", \"tools_snap81\", \"capsule7\", \"capsule_snap81\"]","errors":["Content Views cannot contain multiple Kickstart trees with the same version and architecture. Multiple Kickstart trees of 6.2.0 x86_64 were found in Repositories: [\"sat6tool7\", \"tools_snap81\", \"capsule7\", \"capsule_snap81\"]"]}

Expected results:
User should be able to publish the CV, since the repos are not kickstart repos or  atleast we should update the error

Additional info:
2016-04-14 03:50:56 [app] [I] Processing by Katello::Api::V2::ContentViewsController#publish as JSON
2016-04-14 03:50:56 [app] [I]   Parameters: {"id"=>"2", "organization_id"=>"1", "api_version"=>"v2", "content_view"=>{"id"=>"2"}}
2016-04-14 03:50:56 [app] [D] Setting current user thread-local variable to admin
2016-04-14 03:50:57 [foreman-tasks/action] [E] Content Views cannot contain multiple Kickstart trees with the same version and architecture. Multiple Kickstart trees of 6.2.0 x86_64 were found in Repositories: ["sat6tool7", "tools_snap81", "capsule7", "capsule_snap81"] (RuntimeError)
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.15/app/models/katello/content_view.rb:527:in `check_distribution_conflicts!'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.15/app/models/katello/content_view.rb:457:in `check_ready_to_publish!'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.15/app/lib/actions/katello/content_view/publish.rb:10:in `plan'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.10/lib/dynflow/action.rb:461:in `block (3 levels) in execute_plan'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.10/lib/dynflow/middleware/stack.rb:26:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.10/lib/dynflow/middleware/stack.rb:26:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.10/lib/dynflow/middleware.rb:17:in `pass'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.2/app/lib/actions/middleware/keep_current_user.rb:25:in `block in plan'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.2/app/lib/actions/middleware/keep_current_user.rb:41:in `with_current_user'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.2/app/lib/actions/middleware/keep_current_user.rb:24:in `plan'

Comment 3 Brad Buckingham 2016-04-18 19:00:47 UTC
I was able to reproduce the behavior described using the sat-tools repository.  I also found that the logic that is causing the error is being eliminated upstream as part of the solution to bug 1318743.  Since the description of the 2 bugs is quite different, but this scenario is impacted by the other solution, I am going to triage this one through and we can take it through verification along with bug 1318743.

Comment 5 Sachin Ghai 2016-04-25 06:45:33 UTC
Verified with sat62 beta snap9.2

I created multiple custom repos with same URL and successfully published and promoted to next environment.

Please see the attached screenshot for verification.

Comment 6 Sachin Ghai 2016-04-25 06:48:30 UTC
Created attachment 1150260 [details]
successfully published/promoted custom repos with same URL

Comment 7 Sachin Ghai 2016-04-25 06:49:27 UTC
Created attachment 1150261 [details]
promoted capsule and tools repos of snap9.1 and 9.2 (having same URL's for both repos)

Comment 8 Bryan Kearney 2016-07-27 11:35:49 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, 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/RHBA-2016:1501