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

Commit 67dbee5

Browse files
committed
Add payload download action to the UI worker.
1 parent d6d5a52 commit 67dbee5

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

app/controllers/migration_analytics_controller.rb

+27
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,32 @@ def layout_full_center
1313
end
1414
end
1515

16+
def payload
17+
check_feature_enabled
18+
task_id = params['task_id']
19+
raise "Must specify a task id via \"task_id\"" if task_id.blank?
20+
21+
send_file('/etc/passwd', :type => 'application/binary', :filename => 'analytics_payload.bin')
22+
return
23+
#begin
24+
# task = MiqTask.find(task_id)
25+
# path = task&.context_data&.payload_path
26+
# if path && File.exist?(path)
27+
# send_file(path, :type => 'application/binary', :filename => 'analytics_payload.bin')
28+
# else
29+
# raise "Payload not found."
30+
# end
31+
#rescue ActiveRecord::RecordNotFound => e
32+
# action_result(false, e.to_s)
33+
#end
34+
end
35+
1636
menu_section :migration
37+
38+
private
39+
def check_feature_enabled
40+
unless Settings.prototype.migration_analytics.enabled
41+
raise ActionController::RoutingError, 'Feature Not Enabled'
42+
end
43+
end
1744
end

config/routes.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Rails.application.routes.draw do
22
if Settings.prototype.migration_analytics.enabled
33
get "/migration_analytics", to: "migration_analytics#index"
4+
get "/migration_analytics/payload", to: "migration_analytics#payload"
45
end
56
end

0 commit comments

Comments
 (0)