33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'app/controllers/api/v2/preupgrade_report_entries_controller.rb', line 33
def bulk_remediate
entries = filtered_remediation_entries
remediation_ids = entries.pluck(:id)
if remediation_ids.empty?
return render json: { error: _('No fixable entries found matching the selection.') },
status: :unprocessable_entity
end
composer = JobInvocationComposer.for_feature(
'leapp_remediation_plan',
target_host_ids(entries),
{ 'remediation_ids' => remediation_ids.join(',') }
)
composer.trigger!
job_invocation = composer.job_invocation
render json: { id: job_invocation.id }
rescue StandardError => e
Foreman::Logging.exception('Failed to trigger bulk remediation job', e)
render json: { error: _('An unexpected error occurred while creating the remediation job.') },
status: :internal_server_error
end
|