foreman_inventory_upload 0.9.2 → 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. checksums.yaml +5 -5
  2. data/app/controllers/foreman_inventory_upload/reports_controller.rb +4 -3
  3. data/app/controllers/foreman_inventory_upload/statuses_controller.rb +41 -0
  4. data/app/controllers/foreman_inventory_upload/uploads_controller.rb +3 -3
  5. data/app/views/scripts/uploader.sh.erb +12 -25
  6. data/config/routes.rb +5 -5
  7. data/lib/foreman_inventory_upload/async/generate_all_reports_job.rb +7 -4
  8. data/lib/foreman_inventory_upload/async/generate_report_job.rb +10 -18
  9. data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +17 -12
  10. data/lib/foreman_inventory_upload/async/upload_report_job.rb +17 -22
  11. data/lib/foreman_inventory_upload/engine.rb +0 -2
  12. data/lib/foreman_inventory_upload/generators/archived_report.rb +2 -2
  13. data/lib/foreman_inventory_upload/generators/queries.rb +10 -19
  14. data/lib/foreman_inventory_upload/generators/slice.rb +3 -24
  15. data/lib/foreman_inventory_upload/version.rb +1 -1
  16. data/lib/foreman_inventory_upload.rb +10 -15
  17. data/lib/tasks/foreman_inventory_upload_tasks.rake +1 -1
  18. data/lib/tasks/generator.rake +5 -19
  19. data/test/controllers/reports_controller_test.rb +3 -3
  20. data/test/controllers/{accounts_controller_test.rb → statuses_controller_test.rb} +7 -6
  21. data/test/controllers/uploads_controller_test.rb +3 -3
  22. data/test/unit/archived_report_generator_test.rb +3 -3
  23. data/test/unit/slice_generator_test.rb +0 -74
  24. metadata +41 -180
  25. data/app/controllers/foreman_inventory_upload/accounts_controller.rb +0 -39
  26. data/package.json +0 -125
  27. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +0 -37
  28. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +0 -74
  29. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.stories.js +0 -18
  30. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +0 -65
  31. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListConstants.js +0 -9
  32. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListHelper.js +0 -0
  33. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js +0 -55
  34. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListSelectors.js +0 -8
  35. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyState.fixtures.js +0 -0
  36. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyState.js +0 -16
  37. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/EmptyStateHelper.js +0 -0
  38. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/EmptyState.test.js +0 -13
  39. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/__tests__/__snapshots__/EmptyState.test.js.snap +0 -26
  40. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/emptyState.scss +0 -7
  41. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/index.js +0 -1
  42. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/ErrorState.fixtures.js +0 -0
  43. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/ErrorState.js +0 -23
  44. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/ErrorStateHelper.js +0 -0
  45. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/__tests__/ErrorState.test.js +0 -13
  46. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/__tests__/__snapshots__/ErrorState.test.js.snap +0 -20
  47. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/errorState.scss +0 -18
  48. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/index.js +0 -1
  49. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.fixtures.js +0 -1
  50. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +0 -41
  51. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItemHelper.js +0 -0
  52. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/ListItem.test.js +0 -13
  53. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +0 -50
  54. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/index.js +0 -1
  55. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/listItem.scss +0 -0
  56. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.fixtures.js +0 -7
  57. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatus.js +0 -43
  58. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/ListItemStatusHelper.js +0 -29
  59. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/ListItemStatus.test.js +0 -14
  60. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/__snapshots__/ListItemStatus.test.js.snap +0 -78
  61. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/index.js +0 -1
  62. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/listItemStatus.scss +0 -16
  63. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountList.test.js +0 -13
  64. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js +0 -20
  65. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListIntegration.test.js +0 -14
  66. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js +0 -60
  67. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js +0 -26
  68. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +0 -44
  69. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListActions.test.js.snap +0 -47
  70. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListReducer.test.js.snap +0 -69
  71. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListSelectors.test.js.snap +0 -46
  72. data/webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss +0 -9
  73. data/webpack/ForemanInventoryUpload/Components/AccountList/index.js +0 -27
  74. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.fixtures.js +0 -50
  75. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.js +0 -146
  76. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.stories.js +0 -19
  77. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardActions.js +0 -87
  78. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardConstants.js +0 -9
  79. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardHelper.js +0 -0
  80. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardReducer.js +0 -68
  81. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardSelectors.js +0 -17
  82. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/Dashboard.test.js +0 -25
  83. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +0 -39
  84. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardIntegration.test.js +0 -16
  85. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardReducer.test.js +0 -64
  86. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardSelectors.test.js +0 -45
  87. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/Dashboard.test.js.snap +0 -36
  88. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/DashboardActions.test.js.snap +0 -76
  89. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/DashboardReducer.test.js.snap +0 -44
  90. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/__snapshots__/DashboardSelectors.test.js.snap +0 -42
  91. data/webpack/ForemanInventoryUpload/Components/Dashboard/dashboard.scss +0 -0
  92. data/webpack/ForemanInventoryUpload/Components/Dashboard/index.js +0 -34
  93. data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.fixtures.js +0 -0
  94. data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.js +0 -22
  95. data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownloadHelper.js +0 -0
  96. data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/FileDownload.test.js +0 -13
  97. data/webpack/ForemanInventoryUpload/Components/FileDownload/__tests__/__snapshots__/FileDownload.test.js.snap +0 -25
  98. data/webpack/ForemanInventoryUpload/Components/FileDownload/fileDownload.scss +0 -3
  99. data/webpack/ForemanInventoryUpload/Components/FileDownload/index.js +0 -1
  100. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.fixtures.js +0 -0
  101. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.js +0 -50
  102. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModalHelper.js +0 -0
  103. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/FullScreenModal.test.js +0 -13
  104. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/__snapshots__/FullScreenModal.test.js.snap +0 -64
  105. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/fullScreenModal.scss +0 -10
  106. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/index.js +0 -1
  107. data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js +0 -10
  108. data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.js +0 -83
  109. data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainerHelper.js +0 -0
  110. data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/NavContainer.test.js +0 -26
  111. data/webpack/ForemanInventoryUpload/Components/NavContainer/__tests__/__snapshots__/NavContainer.test.js.snap +0 -89
  112. data/webpack/ForemanInventoryUpload/Components/NavContainer/index.js +0 -1
  113. data/webpack/ForemanInventoryUpload/Components/NavContainer/navContainer.scss +0 -7
  114. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.fixtures.js +0 -16
  115. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.js +0 -57
  116. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerateHelper.js +0 -0
  117. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/ReportGenerate.test.js +0 -14
  118. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/__tests__/__snapshots__/ReportGenerate.test.js.snap +0 -45
  119. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/index.js +0 -1
  120. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/reportGenerate.scss +0 -0
  121. data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUpload.fixtures.js +0 -18
  122. data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUpload.js +0 -57
  123. data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUploadHelper.js +0 -0
  124. data/webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/ReportUpload.test.js +0 -14
  125. data/webpack/ForemanInventoryUpload/Components/ReportUpload/__tests__/__snapshots__/ReportUpload.test.js.snap +0 -45
  126. data/webpack/ForemanInventoryUpload/Components/ReportUpload/index.js +0 -1
  127. data/webpack/ForemanInventoryUpload/Components/ReportUpload/reportUpload.scss +0 -0
  128. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.fixtures.js +0 -3
  129. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRun.js +0 -27
  130. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/ScheduledRunHelper.js +0 -0
  131. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/ScheduledRun.test.js +0 -14
  132. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/__tests__/__snapshots__/ScheduledRun.test.js.snap +0 -25
  133. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/index.js +0 -1
  134. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/scheduledRun.scss +0 -11
  135. data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.fixtures.js +0 -0
  136. data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js +0 -56
  137. data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChartHelper.js +0 -0
  138. data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/StatusChart.test.js +0 -13
  139. data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/__snapshots__/StatusChart.test.js.snap +0 -74
  140. data/webpack/ForemanInventoryUpload/Components/StatusChart/index.js +0 -1
  141. data/webpack/ForemanInventoryUpload/Components/StatusChart/statusChart.scss +0 -8
  142. data/webpack/ForemanInventoryUpload/Components/TabBody/TabBody.fixtures.js +0 -0
  143. data/webpack/ForemanInventoryUpload/Components/TabBody/TabBody.js +0 -31
  144. data/webpack/ForemanInventoryUpload/Components/TabBody/TabBodyHelper.js +0 -0
  145. data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/TabBody.test.js +0 -13
  146. data/webpack/ForemanInventoryUpload/Components/TabBody/__tests__/__snapshots__/TabBody.test.js.snap +0 -19
  147. data/webpack/ForemanInventoryUpload/Components/TabBody/index.js +0 -1
  148. data/webpack/ForemanInventoryUpload/Components/TabBody/tabBody.scss +0 -3
  149. data/webpack/ForemanInventoryUpload/Components/TabContainer/TabContainer.fixtures.js +0 -0
  150. data/webpack/ForemanInventoryUpload/Components/TabContainer/TabContainer.js +0 -24
  151. data/webpack/ForemanInventoryUpload/Components/TabContainer/TabContainerHelper.js +0 -0
  152. data/webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/TabContainer.test.js +0 -13
  153. data/webpack/ForemanInventoryUpload/Components/TabContainer/__tests__/__snapshots__/TabContainer.test.js.snap +0 -18
  154. data/webpack/ForemanInventoryUpload/Components/TabContainer/index.js +0 -1
  155. data/webpack/ForemanInventoryUpload/Components/TabContainer/tabContainer.scss +0 -8
  156. data/webpack/ForemanInventoryUpload/Components/TabFooter/TabFooter.fixtures.js +0 -0
  157. data/webpack/ForemanInventoryUpload/Components/TabFooter/TabFooter.js +0 -19
  158. data/webpack/ForemanInventoryUpload/Components/TabFooter/TabFooterHelper.js +0 -0
  159. data/webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/TabFooter.test.js +0 -13
  160. data/webpack/ForemanInventoryUpload/Components/TabFooter/__tests__/__snapshots__/TabFooter.test.js.snap +0 -12
  161. data/webpack/ForemanInventoryUpload/Components/TabFooter/index.js +0 -1
  162. data/webpack/ForemanInventoryUpload/Components/TabFooter/tabFooter.scss +0 -0
  163. data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.fixtures.js +0 -0
  164. data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.js +0 -45
  165. data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeaderHelper.js +0 -0
  166. data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/TabHeader.test.js +0 -13
  167. data/webpack/ForemanInventoryUpload/Components/TabHeader/__tests__/__snapshots__/TabHeader.test.js.snap +0 -53
  168. data/webpack/ForemanInventoryUpload/Components/TabHeader/index.js +0 -1
  169. data/webpack/ForemanInventoryUpload/Components/TabHeader/tabHeader.scss +0 -21
  170. data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.fixtures.js +0 -10
  171. data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.js +0 -112
  172. data/webpack/ForemanInventoryUpload/Components/Terminal/TerminalHelper.js +0 -6
  173. data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js +0 -35
  174. data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/__snapshots__/Terminal.test.js.snap +0 -98
  175. data/webpack/ForemanInventoryUpload/Components/Terminal/index.js +0 -1
  176. data/webpack/ForemanInventoryUpload/Components/Terminal/terminal.scss +0 -31
  177. data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +0 -15
  178. data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.test.js +0 -10
  179. data/webpack/ForemanInventoryUpload/ForemanInventoryUploadReducers.js +0 -12
  180. data/webpack/ForemanInventoryUpload/ForemanInventoryUploadSelectors.js +0 -4
  181. data/webpack/ForemanInventoryUpload/__snapshots__/ForemanInventoryUpload.test.js.snap +0 -16
  182. data/webpack/ForemanInventoryUpload/index.js +0 -1
  183. data/webpack/__mocks__/foremanReact/API.js +0 -7
  184. data/webpack/__mocks__/foremanReact/common/I18n.js +0 -5
  185. data/webpack/__mocks__/foremanReact/common/helpers.js +0 -3
  186. data/webpack/index.js +0 -18
  187. data/webpack/stories/ForemanInventoryUploadReducers.js +0 -3
  188. data/webpack/stories/configureStore.js +0 -15
  189. data/webpack/stories/decorators/index.js +0 -1
  190. data/webpack/stories/decorators/withCardsDecorator.js +0 -14
  191. data/webpack/stories/index.js +0 -10
  192. data/webpack/stories/index.scss +0 -7
  193. data/webpack/test_setup.js +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: b70584c73786436bfa34fabe53f16e4e7107a89b49acc2cf9085eb0bb3be0dab
4
- data.tar.gz: a7564f641fad2c18c7e2122d09591b720411eb403cc84fefc0579e14a7d57d55
2
+ SHA1:
3
+ metadata.gz: 64394cf6cba5b7e8c903f1b54269cd944e970ed6
4
+ data.tar.gz: 2cf1d64dc23506fc1e2808d0ee283cff9010b33e
5
5
  SHA512:
6
- metadata.gz: 8f2504be14024e4d71f0d751a0a7715c45535087c0a6b861f8392bebe2f2f1a06a1aa46c71bc68cf46bf026a839bba32eb2e27953c2e3bcd0b6c2333c263df9f
7
- data.tar.gz: 9adcaae458723fa26775bcc233dddb3097c40eee965b3063c508ff1156604dc751c0614242bbfb992ca40d2e1f61732cd744ad70b9d6d5379c943170056647f0
6
+ metadata.gz: 16db4189b92eeafd639a0a67fe1bdae2d4d5be7931cc6ab43ea4a2fa3b8d9e88365c7d1757a205d8c23718b97c7da7bb28849d6c17f731ba27f5a8d42c5719af
7
+ data.tar.gz: 7ee617fe1bb503bcae3f82a5c74cd3d25266afee0d7f731a8ba4e6b4ca3a15c6d70f5b39e21b49f607867f7bdc3d40cbf549ae7e1062ef327da1419601ee2012
@@ -3,7 +3,7 @@
3
3
  module ForemanInventoryUpload
4
4
  class ReportsController < ::ApplicationController
5
5
  def last
6
- label = ForemanInventoryUpload::Async::GenerateReportJob.output_label(params[:organization_id])
6
+ label = ForemanInventoryUpload::Async::GenerateReportJob.output_label(params[:portal_user])
7
7
  output = ForemanInventoryUpload::Async::ProgressOutput.get(label)&.full_output
8
8
  task_label = ForemanInventoryUpload::Async::GenerateAllReportsJob.singleton_job_name
9
9
  scheduled = ForemanTasks::Task.where(
@@ -18,9 +18,10 @@ module ForemanInventoryUpload
18
18
  end
19
19
 
20
20
  def generate
21
- organization_id = params[:organization_id]
21
+ portal_user = params[:portal_user]
22
22
 
23
- ForemanInventoryUpload::Async::GenerateReportJob.perform_later(ForemanInventoryUpload.generated_reports_folder, organization_id)
23
+ generated_file_name = File.join(ForemanInventoryUpload.base_folder, "#{portal_user}.tar.gz")
24
+ ForemanInventoryUpload::Async::GenerateReportJob.perform_later(generated_file_name, portal_user)
24
25
 
25
26
  render json: {
26
27
  action_status: 'success',
@@ -0,0 +1,41 @@
1
+ module ForemanInventoryUpload
2
+ class StatusesController < ::ApplicationController
3
+ # override default "welcome screen behavior, since we don't have a model"
4
+ def welcome
5
+ true
6
+ end
7
+
8
+ def index
9
+ portal_users = RedhatAccess::TelemetryConfiguration
10
+ .where(enable_telemetry: true)
11
+ .distinct
12
+ .pluck(:portal_user)
13
+
14
+ statuses = Hash[
15
+ portal_users.map do |portal_user|
16
+ generate_report_status = status_for(portal_user, ForemanInventoryUpload::Async::GenerateReportJob)
17
+ upload_report_status = status_for(portal_user, ForemanInventoryUpload::Async::UploadReportJob)
18
+
19
+ [
20
+ portal_user,
21
+ {
22
+ generate_report_status: generate_report_status,
23
+ upload_report_status: upload_report_status,
24
+ },
25
+ ]
26
+ end
27
+ ]
28
+
29
+ render json: {
30
+ statuses: statuses,
31
+ }, status: :ok
32
+ end
33
+
34
+ private
35
+
36
+ def status_for(portal_user, job_class)
37
+ label = job_class.output_label(portal_user)
38
+ ForemanInventoryUpload::Async::ProgressOutput.get(label)&.status
39
+ end
40
+ end
41
+ end
@@ -1,7 +1,7 @@
1
1
  module ForemanInventoryUpload
2
2
  class UploadsController < ::ApplicationController
3
3
  def last
4
- label = ForemanInventoryUpload::Async::UploadReportJob.output_label(params[:organization_id])
4
+ label = ForemanInventoryUpload::Async::UploadReportJob.output_label(params[:portal_user])
5
5
  output = ForemanInventoryUpload::Async::ProgressOutput.get(label)&.full_output
6
6
 
7
7
  render json: {
@@ -10,8 +10,8 @@ module ForemanInventoryUpload
10
10
  end
11
11
 
12
12
  def download_file
13
- filename = ForemanInventoryUpload.facts_archive_name(params[:organization_id])
14
- path = Rails.root.join(ForemanInventoryUpload.uploads_folder, filename)
13
+ filename = 'hosts_report.tar.gz'
14
+ path = Rails.root.join(ForemanInventoryUpload.uploads_folder(params[:portal_user]), filename)
15
15
  unless File.exist? path
16
16
  return throw_flash_error(
17
17
  "Path doesn't exist: #{path}"
@@ -1,43 +1,30 @@
1
1
  #! /bin/sh
2
2
 
3
3
  DEST=<%= @upload_url %>
4
+ RH_USERNAME=<%= @rh_username %>
4
5
 
5
- if [ -z "$FILES" ]
6
+ if [ -z "$RH_USERNAME" ]
6
7
  then
7
- FILES=./*.tar.gz
8
+ IFS= read -rp "Enter username: " RH_USERNAME
8
9
  fi
9
10
 
10
- if [ -n "$CER_PATH" ]
11
+ if [ -z "$RH_PASSWORD" ]
11
12
  then
12
- AUTH_KEY="--cert"
13
- AUTH_VAL="$CER_PATH"
14
- else
15
- if [ -z "$RH_USERNAME" ]
16
- then
17
- IFS= read -rp "Enter username: " RH_USERNAME
18
- fi
19
-
20
- if [ -z "$RH_PASSWORD" ]
21
- then
22
- IFS= read -rsp "Enter password: " RH_PASSWORD
23
- fi
24
-
25
- AUTH_KEY="-u"
26
- AUTH_VAL="\"$RH_USERNAME\":\"$RH_PASSWORD\""
13
+ IFS= read -rsp "Enter password: " RH_PASSWORD
27
14
  fi
28
15
 
29
- # /tmp/a b/x.pem
30
- # curl --cert /tmp/a\ b/x.pem
16
+ if [ -z "$FILES" ]
17
+ then
18
+ FILES=./*.tar.gz
19
+ fi
31
20
 
32
- SCRIPT_DIR=$(realpath "$(dirname "${BASH_SOURCE:-0}")")
33
- DONE_DIR="$SCRIPT_DIR/done/"
34
- mkdir -p $DONE_DIR
21
+ mkdir -p done
35
22
 
36
23
  for f in $FILES
37
24
  do
38
- curl -k -vvv -# --fail -F "file=@$f;type=application/vnd.redhat.qpc.tar+tgz" $DEST "$AUTH_KEY" "$AUTH_VAL"
25
+ curl -k -vvv -# --fail -F "file=@$f;type=application/vnd.redhat.qpc.tar+tgz" $DEST -u "$RH_USERNAME":"$RH_PASSWORD"
39
26
  if [ $? -eq 0 ]; then
40
- mv $f $DONE_DIR
27
+ mv $f done/
41
28
  echo "Done: $f"
42
29
  fi
43
30
  done
data/config/routes.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  Rails.application.routes.draw do
2
2
  namespace :foreman_inventory_upload do
3
3
  get 'index', to: 'react#index'
4
- get ':organization_id/reports/last', to: 'reports#last', constraints: { organization_id: %r{[^\/]+} }
5
- post ':organization_id/reports', to: 'reports#generate', constraints: { organization_id: %r{[^\/]+} }
6
- get ':organization_id/uploads/last', to: 'uploads#last', constraints: { organization_id: %r{[^\/]+} }
7
- get ':organization_id/uploads/file', to: 'uploads#download_file', constraints: { organization_id: %r{[^\/]+} }
8
- get 'accounts', to: 'accounts#index'
4
+ get ':portal_user/reports/last', to: 'reports#last', constraints: { portal_user: %r{[^\/]+} }
5
+ post ':portal_user/reports', to: 'reports#generate', constraints: { portal_user: %r{[^\/]+} }
6
+ get ':portal_user/uploads/last', to: 'uploads#last', constraints: { portal_user: %r{[^\/]+} }
7
+ get ':portal_user/uploads/file', to: 'uploads#download_file', constraints: { portal_user: %r{[^\/]+} }
8
+ get 'statuses', to: 'statuses#index'
9
9
  end
10
10
  end
@@ -2,10 +2,13 @@ module ForemanInventoryUpload
2
2
  module Async
3
3
  class GenerateAllReportsJob < ::ApplicationJob
4
4
  def perform
5
- organizations = Organization.unscoped.all
6
-
7
- organizations.map do |organization|
8
- GenerateReportJob.perform_later(ForemanInventoryUpload.generated_reports_folder, organization.id)
5
+ portal_users = RedhatAccess::TelemetryConfiguration
6
+ .where(enable_telemetry: true)
7
+ .distinct
8
+ .pluck(:portal_user)
9
+ portal_users.map do |portal_user|
10
+ generated_file_name = File.join(ForemanInventoryUpload.base_folder, "#{portal_user}.tar.gz")
11
+ GenerateReportJob.perform_later(generated_file_name, portal_user)
9
12
  end
10
13
  ensure
11
14
  self.class.set(:wait => 24.hours).perform_later
@@ -1,35 +1,27 @@
1
1
  module ForemanInventoryUpload
2
2
  module Async
3
3
  class GenerateReportJob < ShellProcess
4
- def self.output_label(label)
5
- "report_for_#{label}"
4
+ def self.output_label(portal_user)
5
+ "report_for_#{portal_user}"
6
6
  end
7
7
 
8
- def perform(base_folder, organization)
9
- @base_folder = base_folder
10
- @organization = organization
8
+ def perform(result_file, portal_user)
9
+ @result_file = result_file
10
+ @portal_user = portal_user
11
11
 
12
- super(GenerateReportJob.output_label(organization))
12
+ super(GenerateReportJob.output_label(portal_user))
13
13
 
14
- QueueForUploadJob.perform_later(
15
- base_folder,
16
- ForemanInventoryUpload.facts_archive_name(organization),
17
- organization
18
- )
19
- end
20
-
21
- def rake_prefix
22
- 'foreman-' unless Rails.env.development?
14
+ QueueForUploadJob.perform_later(result_file, portal_user)
23
15
  end
24
16
 
25
17
  def command
26
- "#{rake_prefix}rake foreman_inventory_upload:report:generate"
18
+ 'rake foreman_inventory_upload:report:generate'
27
19
  end
28
20
 
29
21
  def env
30
22
  super.merge(
31
- 'target' => @base_folder,
32
- 'organization_id' => @organization
23
+ 'target' => @result_file,
24
+ 'portal_user' => @portal_user
33
25
  )
34
26
  end
35
27
  end
@@ -1,22 +1,21 @@
1
1
  module ForemanInventoryUpload
2
2
  module Async
3
3
  class QueueForUploadJob < ::ApplicationJob
4
- def perform(base_folder, report_file, organization_id)
5
- @base_folder = base_folder
6
- @report_file = report_file
4
+ def perform(report_file, portal_user)
5
+ @portal_user = portal_user
7
6
  logger.debug('Ensuring objects')
8
7
  ensure_ouput_folder
9
8
  ensure_output_script
10
9
  logger.debug("Copying #{report_file} to #{uploads_folder}")
11
- enqueued_file_name = File.join(uploads_folder, report_file)
12
- FileUtils.mv(File.join(base_folder, report_file), enqueued_file_name)
10
+ enqueued_file_name = File.join(uploads_folder, ForemanInventoryUpload.facts_archive_name)
11
+ FileUtils.mv(report_file, enqueued_file_name)
13
12
  logger.debug("Done copying #{report_file} to #{enqueued_file_name}")
14
13
 
15
- UploadReportJob.perform_later(enqueued_file_name, organization_id)
14
+ UploadReportJob.perform_later(enqueued_file_name, portal_user)
16
15
  end
17
16
 
18
17
  def uploads_folder
19
- @uploads_folder ||= ForemanInventoryUpload.uploads_folder
18
+ @uploads_folder ||= ForemanInventoryUpload.uploads_folder(@portal_user)
20
19
  end
21
20
 
22
21
  def script_file
@@ -30,11 +29,17 @@ module ForemanInventoryUpload
30
29
  def ensure_output_script
31
30
  return if File.exist?(script_file)
32
31
 
33
- script_source_file = File.join(ForemanInventoryUpload::Engine.root, 'app/views/scripts/uploader.sh.erb')
34
-
35
- script_source = File.read(script_source_file)
36
- script_source.gsub!('<%= @upload_url %>', ForemanInventoryUpload.upload_url)
37
-
32
+ script_source = File.join(ForemanInventoryUpload::Engine.root, 'app/views/scripts/uploader.sh.erb')
33
+
34
+ template_src = Foreman::Renderer::Source::String.new(content: File.read(script_source))
35
+ scope = Foreman::Renderer::Scope::Base.new(
36
+ source: template_src,
37
+ variables: {
38
+ upload_url: ForemanInventoryUpload.upload_url,
39
+ rh_username: @portal_user,
40
+ }
41
+ )
42
+ script_source = Foreman::Renderer.render(template_src, scope)
38
43
  File.write(script_file, script_source)
39
44
  FileUtils.chmod('+x', script_file)
40
45
  end
@@ -1,23 +1,15 @@
1
- require 'tempfile'
2
-
3
1
  module ForemanInventoryUpload
4
2
  module Async
5
3
  class UploadReportJob < ShellProcess
6
- def self.output_label(label)
7
- "upload_for_#{label}"
4
+ def self.output_label(portal_user)
5
+ "upload_for_#{portal_user}"
8
6
  end
9
7
 
10
- def perform(filename, organization_id)
8
+ def perform(filename, portal_user)
9
+ @portal_user = portal_user
11
10
  @filename = filename
12
- @organization = Organization.find(organization_id)
13
11
 
14
- Tempfile.create([@organization.name, '.pem']) do |cer_file|
15
- cer_file.write(rh_credentials[:cert])
16
- cer_file.write(rh_credentials[:key])
17
- cer_file.flush
18
- @cer_path = cer_file.path
19
- super(UploadReportJob.output_label(organization_id))
20
- end
12
+ super(UploadReportJob.output_label(portal_user))
21
13
  end
22
14
 
23
15
  def command
@@ -26,19 +18,22 @@ module ForemanInventoryUpload
26
18
 
27
19
  def env
28
20
  super.merge(
29
- 'FILES' => @filename,
30
- 'CER_PATH' => @cer_path
21
+ 'RH_USERNAME' => rh_username,
22
+ 'RH_PASSWORD' => rh_password,
23
+ 'FILES' => @filename
31
24
  )
32
25
  end
33
26
 
34
27
  def rh_credentials
35
- @rh_credentials ||= begin
36
- candlepin_id_certificate = @organization.owner_details['upstreamConsumer']['idCert']
37
- {
38
- cert: candlepin_id_certificate['cert'],
39
- key: candlepin_id_certificate['key'],
40
- }
41
- end
28
+ @rh_credentials ||= RedhatAccess::TelemetryConfiguration.where(portal_user: @portal_user).last
29
+ end
30
+
31
+ def rh_username
32
+ @portal_user
33
+ end
34
+
35
+ def rh_password
36
+ rh_credentials.portal_password
42
37
  end
43
38
  end
44
39
  end
@@ -11,8 +11,6 @@ module ForemanInventoryUpload
11
11
  config.autoload_paths += Dir["#{config.root}/app/overrides"]
12
12
  config.autoload_paths += Dir["#{config.root}/lib"]
13
13
 
14
- config.eager_load_paths += Dir["#{config.root}/lib"]
15
-
16
14
  # Add any db migrations
17
15
  initializer 'foreman_inventory_upload.load_app_instance_data' do |app|
18
16
  ForemanInventoryUpload::Engine.paths['db/migrate'].existent.each do |path|
@@ -6,10 +6,10 @@ module ForemanInventoryUpload
6
6
  @logger = logger
7
7
  end
8
8
 
9
- def render(organization:)
9
+ def render(portal_user)
10
10
  Dir.mktmpdir do |tmpdir|
11
11
  @logger.info "Started generating hosts report in #{tmpdir}"
12
- host_batches = ForemanInventoryUpload::Generators::Queries.for_org(organization)
12
+ host_batches = ForemanInventoryUpload::Generators::Queries.for_report(portal_user)
13
13
  File.open(File.join(tmpdir, 'metadata.json'), 'w') do |metadata_out|
14
14
  metadata_generator = ForemanInventoryUpload::Generators::Metadata.new(metadata_out)
15
15
  metadata_generator.render do |inner_generator|
@@ -17,7 +17,6 @@ module ForemanInventoryUpload
17
17
  'distribution::name',
18
18
  'uname::release',
19
19
  'lscpu::flags',
20
- 'distribution::version',
21
20
  ]).pluck(:name, :id)
22
21
  ]
23
22
  end
@@ -32,29 +31,21 @@ module ForemanInventoryUpload
32
31
  :installed_packages,
33
32
  :content_facet,
34
33
  :host_statuses,
35
- subscription_facet: [:pools, :installed_products, :hypervisor_host]
34
+ subscription_facet: [:pools, :installed_products]
36
35
  )
37
36
  .merge(fact_values)
38
37
  end
39
38
 
40
39
  def self.for_report(portal_user)
41
- org_ids = organizations_for_user(portal_user).pluck(:id)
42
- for_slice(Host.unscoped.where(organization_id: org_ids)).in_batches(of: 1_000)
43
- end
44
-
45
- def self.for_org(organization_id)
46
- for_slice(Host.unscoped.where(organization_id: organization_id)).in_batches(of: 1_000)
47
- end
48
-
49
- def self.organizations_for_user(portal_user)
50
- Organization
51
- .joins(:telemetry_configuration)
52
- .where(
53
- redhat_access_telemetry_configurations: {
54
- portal_user: portal_user,
55
- enable_telemetry: true,
56
- }
57
- )
40
+ org_ids = Organization
41
+ .joins(:telemetry_configuration)
42
+ .where(
43
+ redhat_access_telemetry_configurations: {
44
+ portal_user: portal_user,
45
+ enable_telemetry: true,
46
+ }
47
+ ).pluck(:id)
48
+ for_slice(Host.where(organization_id: org_ids)).in_batches(of: 1_000)
58
49
  end
59
50
  end
60
51
  end
@@ -23,14 +23,14 @@ module ForemanInventoryUpload
23
23
  first = true
24
24
  hosts_batch.each do |host|
25
25
  @stream.comma unless first
26
- first = false if report_host(host)
26
+ first = false
27
+ report_host(host)
27
28
  end
28
29
  end
29
30
  end
30
31
  end
31
32
 
32
33
  def report_host(host)
33
- return nil unless host&.subscription_facet&.pools&.first
34
34
  @stream.object do
35
35
  @stream.simple_field('display_name', host.name)
36
36
  @stream.simple_field('fqdn', host.fqdn)
@@ -49,17 +49,9 @@ module ForemanInventoryUpload
49
49
  @stream.stringify_value(nic.mac) if nic.mac
50
50
  end.compact.join(', '))
51
51
  end
52
- @stream.object_field('system_profile') do
52
+ @stream.object_field('system_profile', :last) do
53
53
  report_system_profile(host)
54
54
  end
55
- @stream.array_field('facts', :last) do
56
- @stream.object do
57
- @stream.simple_field('namespace', 'satellite')
58
- @stream.object_field('facts', :last) do
59
- report_satellite_facts(host)
60
- end
61
- end
62
- end
63
55
  end
64
56
  end
65
57
 
@@ -114,19 +106,6 @@ module ForemanInventoryUpload
114
106
  end
115
107
  end
116
108
 
117
- def report_satellite_facts(host)
118
- @stream.simple_field('virtual_host_name', host.subscription_facet.hypervisor_host&.name)
119
- @stream.simple_field('virtual_host_uuid', host.subscription_facet.hypervisor_host&.subscription_facet&.uuid)
120
- if defined?(ForemanThemeSatellite)
121
- @stream.simple_field('satellite_version', ForemanThemeSatellite::SATELLITE_VERSION)
122
- end
123
- @stream.simple_field('system_purpose_usage', host.subscription_facet.purpose_usage)
124
- @stream.simple_field('system_purpose_role', host.subscription_facet.purpose_role)
125
- @stream.simple_field('distribution_version', fact_value(host, 'distribution::version'))
126
- @stream.simple_field('satellite_instance_id', Foreman.respond_to?(:instance_id) ? Foreman.instance_id : nil)
127
- @stream.simple_field('organization_id', host.organization_id, :last)
128
- end
129
-
130
109
  def fact_value(host, fact_name)
131
110
  value_record = host.fact_values.find do |fact_value|
132
111
  fact_value.fact_name_id == ForemanInventoryUpload::Generators::Queries.fact_names[fact_name]
@@ -1,3 +1,3 @@
1
1
  module ForemanInventoryUpload
2
- VERSION = '0.9.2'.freeze
2
+ VERSION = '1.0.0.beta1'.freeze
3
3
  end
@@ -11,20 +11,16 @@ module ForemanInventoryUpload
11
11
  )
12
12
  end
13
13
 
14
- def self.uploads_folder
15
- @uploads_folder ||= ensure_folder(
16
- File.join(
17
- ForemanInventoryUpload.base_folder,
18
- 'uploads/'
19
- )
20
- )
21
- end
14
+ def self.uploads_folder(group)
15
+ @uploads_folders ||= {}
16
+ cache = @uploads_folders[group]
17
+ return cache if cache
22
18
 
23
- def self.generated_reports_folder
24
- @generated_reports_folder ||= ensure_folder(
19
+ @uploads_folders[group] = ensure_folder(
25
20
  File.join(
26
21
  ForemanInventoryUpload.base_folder,
27
- 'generated_reports/'
22
+ 'uploads/',
23
+ "#{group}/"
28
24
  )
29
25
  )
30
26
  end
@@ -37,13 +33,12 @@ module ForemanInventoryUpload
37
33
  'uploader.sh'
38
34
  end
39
35
 
40
- def self.facts_archive_name(organization)
41
- "report_for_#{organization}.tar.gz"
36
+ def self.facts_archive_name
37
+ 'hosts_report.tar.gz'
42
38
  end
43
39
 
44
40
  def self.upload_url
45
- # for testing set ENV to 'https://ci.cloud.redhat.com/api/ingress/v1/upload'
46
- @upload_url ||= ENV['SATELLITE_INVENTORY_UPLOAD_URL'] || 'https://cert.cloud.redhat.com/api/ingress/v1/upload'
41
+ 'https://ci.cloud.paas.psi.redhat.com/api/ingress/v1/upload'
47
42
  end
48
43
 
49
44
  def self.ensure_folder(folder)
@@ -13,7 +13,7 @@ namespace :test do
13
13
  end
14
14
 
15
15
  namespace :foreman_inventory_upload do
16
- task :rubocop => :environment do
16
+ task :rubocop do
17
17
  begin
18
18
  require 'rubocop/rake_task'
19
19
  RuboCop::RakeTask.new(:rubocop_foreman_inventory_upload) do |task|
@@ -4,26 +4,12 @@ namespace :foreman_inventory_upload do
4
4
  namespace :report do
5
5
  desc 'Generate inventory report to be sent to Red Hat cloud'
6
6
  task generate: :environment do
7
- portal_user = ENV['portal_user']
8
- organizations = [ENV['organization_id']]
9
- base_folder = ENV['target'] || Dir.pwd
7
+ target = ENV['target'] || ForemanInventoryUpload.facts_archive_name
8
+ portal_user = ENV['portal_user'] || 'anonymous'
10
9
 
11
- unless portal_user || organizations.empty?
12
- puts "Must specify either portal_user or organization_id"
13
- end
14
-
15
- if portal_user
16
- puts "Generating report for all organizations associated with #{portal_user}"
17
- base_folder = File.join(base_folder, portal_user)
18
- organizations = ForemanInventoryUpload::Generators::Queries.organizations_for_user(portal_user).pluck(:id)
19
- end
20
-
21
- organizations.each do |organization|
22
- target = File.join(base_folder, ForemanInventoryUpload.facts_archive_name(organization))
23
- archived_report_generator = ForemanInventoryUpload::Generators::ArchivedReport.new(target, Logger.new(STDOUT))
24
- archived_report_generator.render(organization: organization)
25
- puts "Successfully generated #{target} for organization id #{organization}"
26
- end
10
+ archived_report_generator = ForemanInventoryUpload::Generators::ArchivedReport.new(target, Logger.new(STDOUT))
11
+ archived_report_generator.render(portal_user)
12
+ puts "Successfully generated #{target} for #{portal_user}"
27
13
  end
28
14
  end
29
15
  end
@@ -5,14 +5,14 @@ class ReportsControllerTest < ActionController::TestCase
5
5
 
6
6
  test 'Returns latest report generation status' do
7
7
  progress_output = mock('progress_output')
8
- test_org = FactoryBot.create(:organization)
8
+ test_portal_user = 'test_portal_user'
9
9
  ForemanInventoryUpload::Async::ProgressOutput
10
10
  .expects(:get)
11
- .with(ForemanInventoryUpload::Async::GenerateReportJob.output_label(test_org.id))
11
+ .with(ForemanInventoryUpload::Async::GenerateReportJob.output_label(test_portal_user))
12
12
  .returns(progress_output)
13
13
  progress_output.expects(:full_output).returns('test output')
14
14
 
15
- get :last, params: { organization_id: test_org.id }, session: set_session_user
15
+ get :last, params: { portal_user: test_portal_user }, session: set_session_user
16
16
 
17
17
  assert_response :success
18
18
  actual = JSON.parse(response.body)
@@ -1,24 +1,25 @@
1
1
  require 'test_plugin_helper'
2
2
 
3
- class AccountsControllerTest < ActionController::TestCase
4
- tests ForemanInventoryUpload::AccountsController
3
+ class StatusesControllerTest < ActionController::TestCase
4
+ tests ForemanInventoryUpload::StatusesController
5
5
 
6
6
  include FolderIsolation
7
7
 
8
8
  test 'Returns statuses for each process type' do
9
- test_org = FactoryBot.create(:organization)
9
+ configuration = RedhatAccess::TelemetryConfiguration.new(enable_telemetry: true, portal_user: 'test')
10
+ configuration.save!
10
11
 
11
- generate_label = ForemanInventoryUpload::Async::GenerateReportJob.output_label(test_org.id)
12
+ generate_label = ForemanInventoryUpload::Async::GenerateReportJob.output_label('test')
12
13
  generate_output = ForemanInventoryUpload::Async::ProgressOutput.register(generate_label)
13
14
  generate_output.status = 'generate_status_test'
14
- upload_label = ForemanInventoryUpload::Async::UploadReportJob.output_label(test_org.id)
15
+ upload_label = ForemanInventoryUpload::Async::UploadReportJob.output_label('test')
15
16
  upload_output = ForemanInventoryUpload::Async::ProgressOutput.register(upload_label)
16
17
  upload_output.status = 'upload_status_test'
17
18
 
18
19
  get :index, session: set_session_user
19
20
 
20
21
  assert_response :success
21
- actual = JSON.parse(response.body)['accounts'][test_org.id.to_s]
22
+ actual = JSON.parse(response.body)['statuses']['test']
22
23
  assert_equal 'generate_status_test', actual['generate_report_status']
23
24
  assert_equal 'upload_status_test', actual['upload_report_status']
24
25
  end
@@ -5,14 +5,14 @@ class UploadsControllerTest < ActionController::TestCase
5
5
 
6
6
  test 'Returns latest upload status' do
7
7
  progress_output = mock('progress_output')
8
- test_org = FactoryBot.create(:organization)
8
+ test_portal_user = 'test_portal_user'
9
9
  ForemanInventoryUpload::Async::ProgressOutput
10
10
  .expects(:get)
11
- .with(ForemanInventoryUpload::Async::UploadReportJob.output_label(test_org.id))
11
+ .with(ForemanInventoryUpload::Async::UploadReportJob.output_label(test_portal_user))
12
12
  .returns(progress_output)
13
13
  progress_output.expects(:full_output).returns('test output')
14
14
 
15
- get :last, params: { organization_id: test_org.id }, session: set_session_user
15
+ get :last, params: { portal_user: test_portal_user }, session: set_session_user
16
16
 
17
17
  assert_response :success
18
18
  actual = JSON.parse(response.body)