Class: Katello::Api::V2::RepositorySetsController
Constant Summary
Concerns::FilteredAutoCompleteSearch::PAGE_SIZE
Instance Method Summary
collapse
#auto_complete_search
#check_katello_agent_not_disabled, #deprecate_katello_agent, #empty_search_query?, #full_result_response, #katello_agent_removal_release, #scoped_search, #skip_session
Methods included from Rendering
#respond_for_async, #respond_for_bulk_async, #respond_for_create, #respond_for_destroy, #respond_for_index, #respond_for_show, #respond_for_status, #respond_for_update, #respond_with_template, #respond_with_template_collection, #respond_with_template_resource, #try_specific_collection_template, #try_specific_resource_template
#api_version
Instance Method Details
#available_repositories ⇒ Object
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'app/controllers/katello/api/v2/repository_sets_controller.rb', line 63
def available_repositories
scan_cdn = sync_task(::Actions::Katello::RepositorySet::ScanCdn, @product, @product_content.content.cp_content_id)
repos = scan_cdn.output[:results]
repos = repos.select do |repo|
if repo[:path].include?('kickstart') && repo[:substitutions][:releasever].present?
repo[:substitutions][:releasever].include?('.') || repo[:enabled]
else
true
end
end
sorted_repos = repos.sort_by do |repo|
major, minor = repo[:substitutions][:releasever].nil? ? [1000, 1000] : repo[:substitutions][:releasever].split('.').map(&:to_i)
major = major == 0 ? 1000 : major
minor = minor.nil? ? 1000 : minor
arch = repo[:substitutions][:basearch].nil? ? "" : repo[:substitutions][:basearch]
[arch, major, minor]
end
collection = {
:results => sorted_repos.reverse,
:subtotal => repos.size,
:total => repos.size
}
respond_for_index :collection => collection
end
|
#disable ⇒ Object
113
114
115
116
|
# File 'app/controllers/katello/api/v2/repository_sets_controller.rb', line 113
def disable
task = sync_task(::Actions::Katello::RepositorySet::DisableRepository, @product, @product_content.content, substitutions)
respond_for_async :resource => task
end
|
#enable ⇒ Object
100
101
102
103
|
# File 'app/controllers/katello/api/v2/repository_sets_controller.rb', line 100
def enable
task = sync_task(::Actions::Katello::RepositorySet::EnableRepository, @product, @product_content.content, substitutions)
respond_for_async :resource => task
end
|
#index ⇒ Object
40
41
42
43
44
45
46
47
|
# File 'app/controllers/katello/api/v2/repository_sets_controller.rb', line 40
def index
collection = scoped_search(index_relation, :name, :asc, :resource_class => Katello::ProductContent, :custom_sort => ->(relation) { custom_sort_results(relation) })
pcf = ProductContentFinder.wrap_with_overrides(
product_contents: collection[:results],
overrides: @consumable&.content_overrides)
collection[:results] = pcf
respond(:collection => collection)
end
|
#show ⇒ Object
54
55
56
|
# File 'app/controllers/katello/api/v2/repository_sets_controller.rb', line 54
def show
respond :resource => @product_content
end
|