24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'app/controllers/foreman_salt/api/v2/jobs_controller.rb', line 24
def upload
params[:job].permit!
Rails.logger.info("Processing job #{params[:job][:job_id]} from Salt.")
case params[:job][:function]
when 'state.highstate'
task = ForemanTasks.async_task(::Actions::ForemanSalt::ReportImport, params[:job], detected_proxy.try(:id))
render json: { task_id: task.id }
else
render json: { message: 'Unsupported function' }, status: :unprocessable_entity
end
rescue ::Foreman::Exception => e
render json: { message: e.to_s }, status: :unprocessable_entity
end
|