Class: Katello::Api::V2::HostTracerController

Inherits:
ApiController
  • Object
show all
Includes:
Concerns::FilteredAutoCompleteSearch
Defined in:
app/controllers/katello/api/v2/host_tracer_controller.rb

Constant Summary

Constants included from Concerns::FilteredAutoCompleteSearch

Concerns::FilteredAutoCompleteSearch::PAGE_SIZE

Instance Method Summary collapse

Methods included from Concerns::FilteredAutoCompleteSearch

#auto_complete_search

Methods inherited from ApiController

#check_katello_agent_not_disabled, #deprecate_katello_agent, #empty_search_query?, #full_result_response, #katello_agent_removal_release, #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

Methods included from Katello::Api::Version2

#api_version

Instance Method Details

#indexObject



13
14
15
16
# File 'app/controllers/katello/api/v2/host_tracer_controller.rb', line 13

def index
  collection = scoped_search(index_relation, :application, :asc, :resource_class => ::Katello::HostTracer)
  respond_for_index(:collection => collection)
end

#resolveObject



21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/katello/api/v2/host_tracer_controller.rb', line 21

def resolve
  traces = @host.host_traces.resolvable.where(id: params[:trace_ids])
  fail HttpErrors::BadRequest, _("The requested traces were not found for this host") if traces.empty?

  result = Katello::HostTraceManager.resolve_traces(traces)

  task = ForemanTasks::Task.find(result.first.task_id)

  respond_for_async(resource: task)
end