Module: ForemanTasks::Concerns::HostsControllerExtension

Defined in:
app/controllers/foreman_tasks/concerns/hosts_controller_extension.rb

Instance Method Summary collapse

Instance Method Details

#factsObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/foreman_tasks/concerns/hosts_controller_extension.rb', line 4

def facts
  task = ForemanTasks.async_task(::Actions::Foreman::Host::ImportFacts,
                                 detect_host_type,
                                 params[:name],
                                 params[:facts],
                                 params[:certname],
                                 detected_proxy.try(:id))

  render :json => { :task_id => task.id }, :status => :accepted
rescue ::Foreman::Exception => e
  render :json => { 'message' => e.to_s }, :status => :unprocessable_entity
end