Skip to content

Commit

Permalink
Merge pull request #4867 from ehelms/fixes-8668
Browse files Browse the repository at this point in the history
Fixes #8668: Hide 'Server' kickstart repositories from enablement.
  • Loading branch information
ehelms committed Dec 15, 2014
2 parents 1cfa24f + 9c6f26b commit 0957647
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
16 changes: 13 additions & 3 deletions app/controllers/katello/api/v2/repository_sets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,20 @@ def show
param :product_id, :number, :required => true, :desc => N_("ID of a product to list repository sets from")
def available_repositories
scan_cdn = sync_task(::Actions::Katello::RepositorySet::ScanCdn, @product, @product_content.content.id)
repos = scan_cdn.output[:results]

repos = repos.select do |repo|
if repo[:path].include?('kickstart')
repo[:substitutions][:releasever].include?('Server') ? repo[:enabled] : true
else
true
end
end

collection = {
:results => scan_cdn.output[:results],
:subtotal => scan_cdn.output[:results].size,
:total => scan_cdn.output[:results].size
:results => repos,
:subtotal => repos.size,
:total => repos.size
}
respond_for_index :collection => collection
end
Expand Down
12 changes: 11 additions & 1 deletion app/controllers/katello/products_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,17 @@ def available_repositories
if task.result == 'warning'
render :partial => 'katello/providers/redhat/errors', :locals => { :error_message => task_error(task), :task => task}
else
render :partial => 'katello/providers/redhat/repos', :locals => { :scan_cdn => task }
repos = task.output[:results]

repos = repos.select do |repo|
if repo[:path].include?('kickstart')
repo[:substitutions][:releasever].include?('Server') ? repo[:enabled] : true
else
true
end
end

render :partial => 'katello/providers/redhat/repos', :locals => {:scan_cdn => task, :repos => repos}
end
end
end
Expand Down
5 changes: 4 additions & 1 deletion app/helpers/katello/providers_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module ProvidersHelper
def redhat_repo_tabs
[
{:id => :rpms, :name => _('RPMs'), :products => {}},
{:id => :kickstarts, :name => _('Kickstarts'), :products => {}},
{:id => :srpms, :name => _('Source RPMs'), :products => {}},
{:id => :debug, :name => _('Debug RPMs'), :products => {}},
{:id => :beta, :name => _('Beta'), :products => {}},
Expand All @@ -44,8 +45,10 @@ def redhat_repo_tab(provider, tab_id)
key = :debug
elsif name.include?("(ISOs)") || name.include?("Source ISOs")
key = :isos
elsif name.include?("(RPMs)") || name.include?("(Kickstart)")
elsif name.include?("(RPMs)")
key = :rpms
elsif name.include?("(Kickstart)")
key = :kickstarts
else
key = :other
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/katello/providers/redhat/_repos.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
%th
= _('Repository')
%tbody
- scan_cdn.output[:results].each do |result|
- repos.each do |result|
%tr.repo{:id=>"repo_#{result[:pulp_id]}"}
%td
%label
Expand Down

0 comments on commit 0957647

Please sign in to comment.