Skip to content
This repository was archived by the owner on Aug 28, 2023. It is now read-only.

Commit 97cae93

Browse files
committed
Add payload download action.
1 parent bfc2122 commit 97cae93

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

app/controllers/api/red_hat_migration_analytics_controller.rb

+17
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,23 @@ def reset_manifest_collection(type, data)
5050
end
5151
end
5252

53+
def payload_collection(type, data)
54+
task_id = data['task_id']
55+
raise "Must specify a task id via \"task_id\"" if task_id.blank?
56+
57+
begin
58+
task = MiqTask.find(task_id)
59+
path = task&.context_data&.payload_path
60+
if path && File.exist?(path)
61+
send_file(path, :type => 'application/binary', :filename => 'analytics_payload.bin')
62+
else
63+
raise "Payload not found."
64+
end
65+
rescue ActiveRecord::RecordNotFound => e
66+
action_result(false, e.to_s)
67+
end
68+
end
69+
5370
private
5471

5572
def check_feature_enabled

config/api.yml

+3
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@
1919
:identifier: red_hat_migration_analytics
2020
- :name: reset_manifest
2121
:identifier: red_hat_migration_analytics
22+
- :name: payload
23+
:identifier: red_hat_migration_analytics
24+
2225

0 commit comments

Comments
 (0)