Class: Katello::Api::V2::SyncStatusController
Instance Method Summary
collapse
#arches, #collect_arches, #collect_minor, #collect_repos, #filter_empty_nodes, #format_repo, #minors, #pprint_collection, #repos?
#empty_search_query?, #full_result_response, #resource_class, #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
#destroy ⇒ Object
60
61
62
63
|
# File 'app/controllers/katello/api/v2/sync_status_controller.rb', line 60
def destroy
@repository.cancel_dynflow_sync
render :json => {:message => _("Sync canceled")}
end
|
#index ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/controllers/katello/api/v2/sync_status_controller.rb', line 10
def index
org = @organization || current_organization_object
fail HttpErrors::NotFound, _("Organization required") if org.nil?
products = org.library.products.readable
redhat_products, custom_products = products.partition(&:redhat?)
redhat_products.sort_by! { |p| p.name.downcase }
custom_products.sort_by! { |p| p.name.downcase }
sorted_products = redhat_products + custom_products
@product_tree = collect_repos(sorted_products, org.library, false)
@product_tree = filter_empty_nodes(@product_tree)
@repo_statuses = collect_all_repo_statuses(sorted_products, org.library)
respond_for_index(:collection => {:products => @product_tree, :repo_statuses => @repo_statuses})
end
|
#poll ⇒ Object
34
35
36
37
38
39
|
# File 'app/controllers/katello/api/v2/sync_status_controller.rb', line 34
def poll
repos = Repository.where(:id => params[:repository_ids]).readable
statuses = repos.map { |repo| format_sync_progress(repo) }
respond_for_index(:collection => statuses)
end
|
#sync ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'app/controllers/katello/api/v2/sync_status_controller.rb', line 44
def sync
collected = []
repos = Repository.where(:id => params[:repository_ids]).syncable
repos.each do |repo|
if latest_task(repo).try(:state) != 'running'
ForemanTasks.async_task(::Actions::Katello::Repository::Sync, repo)
end
collected << format_sync_progress(repo)
end
respond_for_index(:collection => collected)
end
|