foreman_rh_cloud 1.0.6 → 1.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (244) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -0
  3. data/app/controllers/foreman_inventory_upload/accounts_controller.rb +4 -6
  4. data/app/controllers/foreman_inventory_upload/tasks_controller.rb +25 -0
  5. data/app/controllers/foreman_inventory_upload/uploads_controller.rb +22 -3
  6. data/app/controllers/foreman_rh_cloud/react_controller.rb +11 -0
  7. data/app/controllers/insights_cloud/hits_controller.rb +17 -0
  8. data/app/controllers/insights_cloud/settings_controller.rb +24 -0
  9. data/app/controllers/insights_cloud/tasks_controller.rb +7 -0
  10. data/app/helpers/foreman_inventory_upload_host_helper.rb +20 -0
  11. data/app/models/concerns/rh_cloud_host.rb +12 -0
  12. data/app/models/insights_facet.rb +7 -0
  13. data/app/models/insights_hit.rb +6 -0
  14. data/app/models/inventory_sync/inventory_status.rb +30 -0
  15. data/app/models/setting/rh_cloud.rb +4 -1
  16. data/app/overrides/hosts_list.rb +13 -0
  17. data/app/views/foreman_rh_cloud/react/insights_cloud.html.erb +6 -0
  18. data/app/views/foreman_rh_cloud/react/inventory_upload.html.erb +1 -0
  19. data/app/views/hosts/_insights_tab.html.erb +15 -0
  20. data/app/views/{foreman_inventory_upload/layouts/react.html.erb → layouts/foreman_rh_cloud/application.html.erb} +2 -2
  21. data/config/routes.rb +15 -1
  22. data/db/migrate/20191215104806_create_insights_hits.foreman_inventory_upload.rb +14 -0
  23. data/db/migrate/20191216062008_create_insights_facets.foreman_inventory_upload.rb +7 -0
  24. data/db/migrate/20200727111529_add_uuid_column_to_insights_facets.foreman_rh_cloud.rb +5 -0
  25. data/lib/foreman_inventory_upload.rb +4 -0
  26. data/lib/foreman_inventory_upload/async/generate_report_job.rb +1 -1
  27. data/lib/foreman_inventory_upload/async/shell_process.rb +15 -9
  28. data/lib/foreman_inventory_upload/async/upload_report_job.rb +19 -1
  29. data/lib/foreman_inventory_upload/generators/fact_helpers.rb +43 -0
  30. data/lib/foreman_inventory_upload/generators/json_stream.rb +10 -0
  31. data/lib/foreman_inventory_upload/generators/metadata.rb +3 -0
  32. data/lib/foreman_inventory_upload/generators/queries.rb +7 -4
  33. data/lib/foreman_inventory_upload/generators/slice.rb +42 -14
  34. data/lib/foreman_inventory_upload/notifications/manifest_import_success_notification_override.rb +19 -0
  35. data/lib/foreman_rh_cloud.rb +13 -0
  36. data/lib/foreman_rh_cloud/engine.rb +44 -5
  37. data/lib/foreman_rh_cloud/version.rb +1 -1
  38. data/lib/insights_cloud.rb +15 -0
  39. data/lib/insights_cloud/async/insights_full_sync.rb +103 -0
  40. data/lib/insights_cloud/async/insights_scheduled_sync.rb +23 -0
  41. data/lib/inventory_sync/async/host_result.rb +50 -0
  42. data/lib/inventory_sync/async/inventory_full_sync.rb +99 -0
  43. data/lib/tasks/insights.rake +15 -0
  44. data/lib/tasks/{generator.rake → rh_cloud_inventory.rake} +7 -1
  45. data/package.json +3 -1
  46. data/test/controllers/insights_sync/settings_controller_test.rb +30 -0
  47. data/test/factories/insights_factories.rb +31 -0
  48. data/test/jobs/insights_full_sync_test.rb +94 -0
  49. data/test/jobs/inventory_full_sync_test.rb +91 -0
  50. data/test/jobs/upload_report_job_test.rb +34 -0
  51. data/test/unit/insights_facet_test.rb +16 -0
  52. data/test/unit/metadata_generator_test.rb +2 -0
  53. data/test/unit/slice_generator_test.rb +199 -9
  54. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +14 -2
  55. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +13 -10
  56. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListActions.js +6 -3
  57. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListHelper.js +10 -0
  58. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js +11 -1
  59. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListSelectors.js +10 -1
  60. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/EmptyResults.js +15 -0
  61. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/__tests__/EmptyResults.test.js +13 -0
  62. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/__tests__/__snapshots__/EmptyResults.test.js.snap +18 -0
  63. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/emptyResults.scss +7 -0
  64. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/index.js +1 -0
  65. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +1 -4
  66. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountList.test.js +1 -0
  67. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListActions.test.js +8 -1
  68. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListHelper.test.js +12 -0
  69. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListIntegration.test.js +1 -1
  70. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js +13 -0
  71. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js +12 -8
  72. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +2 -3
  73. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListActions.test.js.snap +21 -2
  74. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListReducer.test.js.snap +11 -0
  75. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListSelectors.test.js.snap +3 -0
  76. data/webpack/ForemanInventoryUpload/Components/AccountList/index.js +2 -0
  77. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.js +6 -6
  78. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherActions.js +4 -1
  79. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcher.test.js.snap +9 -9
  80. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/autoUploadSwitcher.scss +1 -1
  81. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardActions.js +4 -3
  82. data/webpack/ForemanInventoryUpload/Components/Dashboard/DashboardSelectors.js +1 -1
  83. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardActions.test.js +2 -3
  84. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardIntegration.test.js +1 -1
  85. data/webpack/ForemanInventoryUpload/Components/Dashboard/__tests__/DashboardSelectors.test.js +3 -2
  86. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.js +5 -1
  87. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/__snapshots__/FullScreenModal.test.js.snap +1 -0
  88. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/fullScreenModal.scss +15 -13
  89. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcher.fixtures.js +1 -0
  90. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcher.js +29 -0
  91. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcherActions.js +30 -0
  92. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcherConstants.js +3 -0
  93. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/HostObfuscationSwitcher.test.js +14 -0
  94. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/HostObfuscationSwitcherActions.test.js +14 -0
  95. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/__snapshots__/HostObfuscationSwitcher.test.js.snap +38 -0
  96. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/__snapshots__/HostObfuscationSwitcherActions.test.js.snap +14 -0
  97. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/hostObfuscationSwitcher.scss +0 -0
  98. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/index.js +20 -0
  99. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/Components/ClearButton/ClearButton.js +26 -0
  100. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/Components/ClearButton/index.js +1 -0
  101. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.fixtures.js +2 -0
  102. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js +39 -0
  103. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterActions.js +16 -0
  104. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterConstants.js +3 -0
  105. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterReducer.js +36 -0
  106. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterSelectors.js +7 -0
  107. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilter.test.js +14 -0
  108. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterActions.test.js +14 -0
  109. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterReducer.test.js +35 -0
  110. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterSelectors.test.js +21 -0
  111. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilter.test.js.snap +25 -0
  112. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterActions.test.js.snap +17 -0
  113. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterReducer.test.js.snap +25 -0
  114. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/InventoryFilterSelectors.test.js.snap +9 -0
  115. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/integration.test.js.snap +40 -0
  116. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/integration.test.js +18 -0
  117. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/index.js +17 -0
  118. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/inventoryFilter.scss +28 -0
  119. data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.js +15 -0
  120. data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/InventorySettings.test.js +13 -0
  121. data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/__snapshots__/InventorySettings.test.js.snap +13 -0
  122. data/webpack/ForemanInventoryUpload/Components/InventorySettings/index.js +1 -0
  123. data/webpack/ForemanInventoryUpload/Components/InventorySettings/inventorySettings.scss +15 -0
  124. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.js +25 -6
  125. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +33 -5
  126. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/DocsButton.js +18 -0
  127. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/__tests__/DocsButton.test.js +13 -0
  128. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/__tests__/__snapshots__/DocsButton.test.js.snap +21 -0
  129. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/DocsButton/index.js +1 -0
  130. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/HistoryButton.js +19 -0
  131. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/__tests__/HistoryButton.test.js +14 -0
  132. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/__tests__/__snapshots__/HistoryButton.test.js.snap +22 -0
  133. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/HistoryButton/index.js +1 -0
  134. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +24 -0
  135. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/PageDescription.test.js +11 -0
  136. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/__snapshots__/PageDescription.test.js.snap +17 -0
  137. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/index.js +1 -0
  138. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButton.js +52 -0
  139. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +59 -0
  140. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonConstants.js +3 -0
  141. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonReducer.js +36 -0
  142. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonSelectors.js +13 -0
  143. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButton.test.js +13 -0
  144. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonActions.test.js +13 -0
  145. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonFixtures.js +9 -0
  146. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonReducer.test.js +33 -0
  147. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonSelectors.test.js +36 -0
  148. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButton.test.js.snap +26 -0
  149. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonActions.test.js.snap +36 -0
  150. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonReducer.test.js.snap +25 -0
  151. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonSelectors.test.js.snap +18 -0
  152. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Modal.js +63 -0
  153. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Toast.js +41 -0
  154. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/modal.scss +20 -0
  155. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/index.js +22 -0
  156. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/ToolbarButtons.js +15 -0
  157. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/__tests__/ToolbarButtons.test.js +12 -0
  158. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/__tests__/__snapshots__/ToolbarButtons.test.js.snap +11 -0
  159. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/index.js +1 -0
  160. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/ToolbarButtons/toolbarButtons.scss +12 -0
  161. data/webpack/ForemanInventoryUpload/Components/PageHeader/pageHeader.scss +3 -0
  162. data/webpack/ForemanInventoryUpload/Components/StatusChart/StatusChart.js +1 -1
  163. data/webpack/ForemanInventoryUpload/Components/StatusChart/__tests__/__snapshots__/StatusChart.test.js.snap +1 -1
  164. data/webpack/ForemanInventoryUpload/Components/TabContainer/tabContainer.scss +1 -1
  165. data/webpack/ForemanInventoryUpload/ForemanInventoryConstants.js +9 -0
  166. data/webpack/ForemanInventoryUpload/ForemanInventoryHelpers.js +12 -0
  167. data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +16 -8
  168. data/webpack/ForemanInventoryUpload/ForemanInventoryUploadReducers.js +6 -4
  169. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/SubscriptionsPageExtensionActions.js +34 -0
  170. data/webpack/ForemanInventoryUpload/__tests__/ForemanInventoryHelpers.test.js +12 -0
  171. data/webpack/ForemanInventoryUpload/{ForemanInventoryUpload.test.js → __tests__/ForemanInventoryUpload.test.js} +1 -1
  172. data/webpack/ForemanInventoryUpload/__tests__/__snapshots__/ForemanInventoryHelpers.test.js.snap +5 -0
  173. data/webpack/ForemanInventoryUpload/{__snapshots__ → __tests__/__snapshots__}/ForemanInventoryUpload.test.js.snap +0 -0
  174. data/webpack/ForemanRhCloudHelpers.js +6 -0
  175. data/webpack/ForemanRhCloudPages.js +9 -0
  176. data/webpack/ForemanRhCloudReducers.js +12 -0
  177. data/webpack/ForemanRhCloudSelectors.js +10 -0
  178. data/webpack/ForemanRhCloudTestHelpers.js +20 -0
  179. data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettings.js +33 -0
  180. data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettingsActions.js +60 -0
  181. data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettingsConstants.js +10 -0
  182. data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettingsReducer.js +28 -0
  183. data/webpack/InsightsCloudSync/Components/InsightsSettings/InsightsSettingsSelectors.js +6 -0
  184. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/InsightsSettings.test.js +18 -0
  185. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/InsightsSettingsActions.test.js +46 -0
  186. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/InsightsSettingsReducer.test.js +56 -0
  187. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/InsightsSettingsSelectors.test.js +21 -0
  188. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/__snapshots__/InsightsSettings.test.js.snap +15 -0
  189. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/__snapshots__/InsightsSettingsActions.test.js.snap +31 -0
  190. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/__snapshots__/InsightsSettingsReducer.test.js.snap +33 -0
  191. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/__snapshots__/InsightsSettingsSelectors.test.js.snap +9 -0
  192. data/webpack/InsightsCloudSync/Components/InsightsSettings/index.js +21 -0
  193. data/webpack/InsightsCloudSync/Components/InsightsSettings/insightsSettings.scss +16 -0
  194. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/InsightsSyncSwitcher.fixtures.js +1 -0
  195. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/InsightsSyncSwitcher.js +45 -0
  196. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/__tests__/InsightsSyncSwitcher.test.js +17 -0
  197. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/__tests__/__snapshots__/InsightsSyncSwitcher.test.js.snap +38 -0
  198. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/index.js +1 -0
  199. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/insightsSyncSwitcher.scss +3 -0
  200. data/webpack/InsightsCloudSync/InsightsCloudSync.js +59 -0
  201. data/webpack/InsightsCloudSync/InsightsCloudSync.test.js +16 -0
  202. data/webpack/InsightsCloudSync/InsightsCloudSyncActions.js +23 -0
  203. data/webpack/InsightsCloudSync/InsightsCloudSyncConstants.js +6 -0
  204. data/webpack/InsightsCloudSync/InsightsCloudSyncHelpers.js +3 -0
  205. data/webpack/InsightsCloudSync/InsightsCloudSyncReducers.js +8 -0
  206. data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +67 -0
  207. data/webpack/InsightsCloudSync/__tests__/InsightsCloudSyncHelpers.test.js +11 -0
  208. data/webpack/InsightsCloudSync/__tests__/__snapshots__/InsightsCloudSyncHelpers.test.js.snap +3 -0
  209. data/webpack/InsightsCloudSync/index.js +18 -0
  210. data/webpack/InsightsHostDetailsTab/InsightsTab.js +64 -0
  211. data/webpack/InsightsHostDetailsTab/InsightsTab.scss +86 -0
  212. data/webpack/InsightsHostDetailsTab/InsightsTabActions.js +30 -0
  213. data/webpack/InsightsHostDetailsTab/InsightsTabConstants.js +3 -0
  214. data/webpack/InsightsHostDetailsTab/InsightsTabReducer.js +26 -0
  215. data/webpack/InsightsHostDetailsTab/InsightsTabSelectors.js +3 -0
  216. data/webpack/InsightsHostDetailsTab/__tests__/InsightsTab.fixtures.js +25 -0
  217. data/webpack/InsightsHostDetailsTab/__tests__/InsightsTab.test.js +13 -0
  218. data/webpack/InsightsHostDetailsTab/__tests__/InsightsTabActions.test.js +13 -0
  219. data/webpack/InsightsHostDetailsTab/__tests__/InsightsTabIntegration.test.js +17 -0
  220. data/webpack/InsightsHostDetailsTab/__tests__/InsightsTabReducer.test.js +35 -0
  221. data/webpack/InsightsHostDetailsTab/__tests__/InsightsTabSelectors.test.js +13 -0
  222. data/webpack/InsightsHostDetailsTab/__tests__/__snapshots__/InsightsTab.test.js.snap +30 -0
  223. data/webpack/InsightsHostDetailsTab/__tests__/__snapshots__/InsightsTabActions.test.js.snap +20 -0
  224. data/webpack/InsightsHostDetailsTab/__tests__/__snapshots__/InsightsTabReducer.test.js.snap +41 -0
  225. data/webpack/InsightsHostDetailsTab/__tests__/__snapshots__/InsightsTabSelectors.test.js.snap +20 -0
  226. data/webpack/InsightsHostDetailsTab/components/ListItem/ListItem.js +69 -0
  227. data/webpack/InsightsHostDetailsTab/components/ListItem/index.js +1 -0
  228. data/webpack/InsightsHostDetailsTab/index.js +20 -0
  229. data/webpack/__mocks__/foremanReact/components/Layout/LayoutConstants.js +1 -0
  230. data/webpack/__mocks__/foremanReact/constants.js +5 -0
  231. data/webpack/__mocks__/foremanReact/redux/actions/toasts.js +8 -0
  232. data/webpack/__tests__/ForemanRhCloudHelpers.test.js +11 -0
  233. data/webpack/__tests__/ForemanRhCloudSelectors.test.js +22 -0
  234. data/webpack/__tests__/ForemanRhCloudTestHelpers.test.js +20 -0
  235. data/webpack/__tests__/__snapshots__/ForemanRhCloudHelpers.test.js.snap +3 -0
  236. data/webpack/__tests__/__snapshots__/ForemanRhCloudSelectors.test.js.snap +25 -0
  237. data/webpack/__tests__/__snapshots__/ForemanRhCloudTestHelpers.test.js.snap +39 -0
  238. data/webpack/index.js +3 -6
  239. data/webpack/stories/decorators/withCardsDecorator.js +1 -1
  240. data/webpack/subscriptions_extension_index.js +8 -0
  241. metadata +196 -17
  242. data/app/controllers/foreman_inventory_upload/react_controller.rb +0 -7
  243. data/test/unit/slice_generator_test.rb.orig +0 -280
  244. data/webpack/ForemanInventoryUpload/ForemanInventoryUploadSelectors.js +0 -4
@@ -8,15 +8,33 @@ module ForemanInventoryUpload
8
8
  end
9
9
 
10
10
  def perform(filename, organization_id)
11
+ label = UploadReportJob.output_label(organization_id)
11
12
  @filename = filename
12
13
  @organization = Organization.find(organization_id)
13
14
 
15
+ if Setting[:content_disconnected]
16
+ progress_output_for(label) do |progress_output|
17
+ progress_output.write_line('Upload was stopped since disconnected mode setting is enabled for content on this instance.')
18
+ progress_output.status = "Task aborted, exit 1"
19
+ end
20
+ return
21
+ end
22
+
23
+ unless @organization.owner_details&.fetch('upstreamConsumer')&.fetch('idCert')
24
+ logger.info("Skipping organization '#{@organization}', no candlepin certificate defined.")
25
+ progress_output_for(label) do |progress_output|
26
+ progress_output.write_line("Skipping organization #{@organization}, no candlepin certificate defined.")
27
+ progress_output.status = "Task aborted, exit 1"
28
+ end
29
+ return
30
+ end
31
+
14
32
  Tempfile.create([@organization.name, '.pem']) do |cer_file|
15
33
  cer_file.write(rh_credentials[:cert])
16
34
  cer_file.write(rh_credentials[:key])
17
35
  cer_file.flush
18
36
  @cer_path = cer_file.path
19
- super(UploadReportJob.output_label(organization_id))
37
+ super(label)
20
38
  end
21
39
  end
22
40
 
@@ -3,6 +3,11 @@ module ForemanInventoryUpload
3
3
  module FactHelpers
4
4
  extend ActiveSupport::Concern
5
5
 
6
+ CLOUD_AMAZON = 'aws'
7
+ CLOUD_GOOGLE = 'google'
8
+ CLOUD_AZURE = 'azure'
9
+ CLOUD_ALIBABA = 'alibaba'
10
+
6
11
  def fact_value(host, fact_name)
7
12
  value_record = host.fact_values.find do |fact_value|
8
13
  fact_value.fact_name_id == ForemanInventoryUpload::Generators::Queries.fact_names[fact_name]
@@ -26,6 +31,44 @@ module ForemanInventoryUpload
26
31
  @organization_golden_tickets ||= {}
27
32
  @organization_golden_tickets[organization.id] ||= result
28
33
  end
34
+
35
+ def cloud_provider(host)
36
+ bios_version = fact_value(host, 'dmi::bios::version')
37
+
38
+ if bios_version
39
+ return CLOUD_AMAZON if bios_version.downcase['amazon']
40
+ return CLOUD_GOOGLE if bios_version.downcase['google']
41
+ end
42
+
43
+ chassis_asset_tag = fact_value(host, 'dmi::chassis::asset_tag')
44
+ return CLOUD_AZURE if chassis_asset_tag && chassis_asset_tag['7783-7084-3265-9085-8269-3286-77']
45
+
46
+ system_manufacturer = fact_value(host, 'dmi::system::manufacturer')
47
+ return CLOUD_ALIBABA if system_manufacturer && system_manufacturer.downcase['alibaba cloud']
48
+
49
+ product_name = fact_value(host, 'dmi::system::product_name')
50
+ return CLOUD_ALIBABA if product_name && product_name.downcase['alibaba cloud ecs']
51
+
52
+ nil
53
+ end
54
+
55
+ def obfuscate_hostname?(host)
56
+ insights_client_setting = fact_value(host, 'insights_client::obfuscate_hostname_enabled')
57
+ insights_client_setting = ActiveModel::Type::Boolean.new.cast(insights_client_setting)
58
+ return insights_client_setting unless insights_client_setting.nil?
59
+
60
+ Setting[:obfuscate_inventory_hostnames]
61
+ end
62
+
63
+ def fqdn(host)
64
+ return host.fqdn unless obfuscate_hostname?(host)
65
+
66
+ fact_value(host, 'insights_client::hostname') || obfuscate_fqdn(host.fqdn)
67
+ end
68
+
69
+ def obfuscate_fqdn(fqdn)
70
+ "#{Digest::SHA1.hexdigest(fqdn)}.example.com"
71
+ end
29
72
  end
30
73
  end
31
74
  end
@@ -36,6 +36,16 @@ module ForemanInventoryUpload
36
36
  @out << ',' unless last
37
37
  end
38
38
 
39
+ def string_array_value(name, value, last = false)
40
+ return if value.empty?
41
+
42
+ string_value = value.map { |v| stringify_value(v) }
43
+
44
+ array_field(name, last) do
45
+ raw(string_value.join(', '))
46
+ end
47
+ end
48
+
39
49
  def object_field(name, last = false, &block)
40
50
  @out << "\"#{name}\": "
41
51
  object(&block)
@@ -21,6 +21,9 @@ module ForemanInventoryUpload
21
21
  private
22
22
 
23
23
  def render_report(metadata)
24
+ metadata ||= {}
25
+ metadata['foreman_rh_cloud_version'] = ForemanRhCloud::VERSION
26
+
24
27
  @stream.object do
25
28
  @stream.simple_field('report_id', Foreman.uuid)
26
29
  @stream.simple_field('host_inventory_api_version', '1.0')
@@ -20,28 +20,31 @@ module ForemanInventoryUpload
20
20
  'distribution::version',
21
21
  'distribution::id',
22
22
  'virt::is_guest',
23
+ 'dmi::system::manufacturer',
24
+ 'dmi::system::product_name',
25
+ 'dmi::chassis::asset_tag',
26
+ 'insights_client::obfuscate_hostname_enabled',
27
+ 'insights_client::hostname',
23
28
  ]).pluck(:name, :id)
24
29
  ]
25
30
  end
26
31
 
27
32
  def self.for_slice(base)
28
- fact_values = FactValue.where(fact_name_id: fact_names.values)
29
33
  base
30
34
  .joins(:subscription_facet)
31
- .eager_load(:fact_values)
32
35
  .preload(
33
36
  :interfaces,
34
37
  :installed_packages,
35
38
  :content_facet,
36
39
  :host_statuses,
40
+ :inventory_upload_facts,
37
41
  subscription_facet: [:pools, :installed_products, :hypervisor_host]
38
42
  )
39
- .merge(fact_values)
40
43
  end
41
44
 
42
45
  def self.for_report(portal_user)
43
46
  org_ids = organizations_for_user(portal_user).pluck(:id)
44
- for_slice(Host.unscoped.where(organization_id: org_ids)).in_batches(of: 1_000)
47
+ for_org(org_ids)
45
48
  end
46
49
 
47
50
  def self.for_org(organization_id)
@@ -3,6 +3,8 @@ module ForemanInventoryUpload
3
3
  class Slice
4
4
  include FactHelpers
5
5
 
6
+ SATELLITE_NAMESPACE = 'satellite'
7
+
6
8
  attr_accessor :slice_id
7
9
  attr_reader :hosts_count
8
10
 
@@ -39,28 +41,20 @@ module ForemanInventoryUpload
39
41
 
40
42
  def report_host(host)
41
43
  @stream.object do
42
- @stream.simple_field('fqdn', host.fqdn)
44
+ @stream.simple_field('fqdn', fqdn(host))
43
45
  @stream.simple_field('account', account_id(host.organization).to_s)
44
46
  @stream.simple_field('subscription_manager_id', host.subscription_facet&.uuid)
45
47
  @stream.simple_field('satellite_id', host.subscription_facet&.uuid)
46
48
  @stream.simple_field('bios_uuid', fact_value(host, 'dmi::system::uuid'))
47
49
  @stream.simple_field('vm_uuid', fact_value(host, 'virt::uuid'))
48
- @stream.array_field('ip_addresses') do
49
- @stream.raw(host.interfaces.map do |nic|
50
- @stream.stringify_value(nic.ip) if nic.ip
51
- end.compact.join(', '))
52
- end
53
- @stream.array_field('mac_addresses') do
54
- @stream.raw(host.interfaces.map do |nic|
55
- @stream.stringify_value(nic.mac) if nic.mac
56
- end.compact.join(', '))
57
- end
50
+ report_ip_addresses(host)
51
+ report_mac_addresses(host)
58
52
  @stream.object_field('system_profile') do
59
53
  report_system_profile(host)
60
54
  end
61
55
  @stream.array_field('facts') do
62
56
  @stream.object do
63
- @stream.simple_field('namespace', 'satellite')
57
+ @stream.simple_field('namespace', SATELLITE_NAMESPACE)
64
58
  @stream.object_field('facts', :last) do
65
59
  report_satellite_facts(host)
66
60
  end
@@ -68,8 +62,15 @@ module ForemanInventoryUpload
68
62
  end
69
63
 
70
64
  @stream.array_field('tags', :last) do
71
- report_tag('satellite', 'satellite_instance_id', Foreman.instance_id) if Foreman.respond_to?(:instance_id)
72
- report_tag('satellite', 'organization_id', host.organization_id.to_s, :last)
65
+ report_satellite_tag('satellite_instance_id', Foreman.instance_id) if Foreman.respond_to?(:instance_id)
66
+ report_satellite_tag('lifecycle_environment', host.lifecycle_environment&.name)
67
+ report_satellite_tag('content_view', host.content_view&.name)
68
+ report_satellite_tag('activation_key', host.activation_keys) { |key| key.name }
69
+ report_satellite_tag('host_collection', host.host_collections) { |collection| collection.name }
70
+ report_satellite_tag('location', host.location.name)
71
+ report_satellite_tag('organization', host.organization.name)
72
+ report_satellite_tag('hostgroup', host.hostgroup&.name)
73
+ report_satellite_tag('organization_id', host.organization_id.to_s, :last)
73
74
  end
74
75
  end
75
76
  end
@@ -83,6 +84,18 @@ module ForemanInventoryUpload
83
84
  @stream.comma unless last
84
85
  end
85
86
 
87
+ def report_satellite_tag(key, value, last = nil)
88
+ return if value.nil?
89
+
90
+ array_value = Array(value)
91
+ last_index = array_value.count - 1
92
+
93
+ array_value.each_with_index do |value, index|
94
+ value = yield(value) if block_given?
95
+ report_tag(SATELLITE_NAMESPACE, key, value, last && index == last_index)
96
+ end
97
+ end
98
+
86
99
  def report_system_profile(host)
87
100
  @stream.simple_field('number_of_cpus', fact_value(host, 'cpu::cpu(s)').to_i)
88
101
  @stream.simple_field('number_of_sockets', fact_value(host, 'cpu::cpu_socket(s)').to_i)
@@ -126,6 +139,7 @@ module ForemanInventoryUpload
126
139
  'infrastructure_type',
127
140
  ActiveModel::Type::Boolean.new.cast(fact_value(host, 'virt::is_guest')) ? 'virtual' : 'physical'
128
141
  )
142
+ @stream.simple_field('cloud_provider', cloud_provider(host))
129
143
  unless (installed_products = host.subscription_facet&.installed_products).empty?
130
144
  @stream.array_field('installed_products') do
131
145
  @stream.raw(installed_products.map do |product|
@@ -153,12 +167,26 @@ module ForemanInventoryUpload
153
167
  end
154
168
  @stream.simple_field('system_purpose_usage', host.subscription_facet.purpose_usage)
155
169
  @stream.simple_field('system_purpose_role', host.subscription_facet.purpose_role)
170
+ @stream.simple_field('system_purpose_sla', host.subscription_facet.service_level)
156
171
  @stream.simple_field('distribution_version', fact_value(host, 'distribution::version'))
157
172
  @stream.simple_field('satellite_instance_id', Foreman.try(:instance_id))
158
173
  @stream.simple_field('is_simple_content_access', golden_ticket?(host.organization))
174
+ @stream.simple_field('is_hostname_obfuscated', !!obfuscate_hostname?(host))
159
175
  @stream.simple_field('organization_id', host.organization_id, :last)
160
176
  end
161
177
 
178
+ def report_ip_addresses(host)
179
+ ip_addresses = host.interfaces.map { |nic| nic.ip }.compact
180
+
181
+ @stream.string_array_value('ip_addresses', ip_addresses)
182
+ end
183
+
184
+ def report_mac_addresses(host)
185
+ macs = host.interfaces.map { |nic| nic.mac }.compact
186
+
187
+ @stream.string_array_value('mac_addresses', macs)
188
+ end
189
+
162
190
  def os_release_value(name:, version:, codename:)
163
191
  "#{name} #{version} (#{codename})"
164
192
  end
@@ -0,0 +1,19 @@
1
+ module ForemanInventoryUpload
2
+ module Notifications
3
+ module ManifestImportSuccessNotificationOverride
4
+ extend ActiveSupport::Concern
5
+
6
+ def actions
7
+ {
8
+ :links => [
9
+ {
10
+ :href => Rails.application.routes.url_helpers.foreman_rh_cloud_inventory_upload_path,
11
+ :title => _('Enable inventory upload'),
12
+ :external => false,
13
+ },
14
+ ],
15
+ }
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,4 +1,17 @@
1
1
  require 'foreman_rh_cloud/engine.rb'
2
2
 
3
3
  module ForemanRhCloud
4
+ def self.base_url
5
+ # for testing set ENV to 'https://ci.cloud.redhat.com'
6
+ @base_url ||= ENV['SATELLITE_RH_CLOUD_URL'] || 'https://cloud.redhat.com'
7
+ end
8
+
9
+ def self.authentication_url
10
+ # https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token
11
+ @authentication_url ||= ENV['SATELLITE_RH_CLOUD_SSO_URL'] || 'https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token'
12
+ end
13
+
14
+ def self.verify_ssl_method
15
+ @verify_ssl_method ||= ENV['SATELLITE_RH_CLOUD_URL'] ? OpenSSL::SSL::VERIFY_NONE : OpenSSL::SSL::VERIFY_PEER
16
+ end
4
17
  end
@@ -30,23 +30,62 @@ module ForemanRhCloud
30
30
 
31
31
  # Add permissions
32
32
  security_block :foreman_rh_cloud do
33
- permission :view_foreman_rh_cloud, :'foreman_rh_cloud/reports' => [:last]
33
+ permission(
34
+ :generate_foreman_rh_cloud,
35
+ 'foreman_inventory_upload/reports': [:generate]
36
+ )
37
+ permission(
38
+ :view_foreman_rh_cloud,
39
+ 'foreman_inventory_upload/accounts': [:index],
40
+ 'foreman_inventory_upload/reports': [:last],
41
+ 'foreman_inventory_upload/uploads': [:auto_upload, :download_file, :last],
42
+ 'foreman_rh_cloud/react': [:inventory_upload]
43
+ )
34
44
  end
35
45
 
36
- # Add a new role called 'Discovery' if it doesn't exist
37
- role 'ForemanRhCloud', [:view_foreman_rh_cloud]
46
+ plugin_permissions = [:view_foreman_rh_cloud, :generate_foreman_rh_cloud]
47
+
48
+ role 'ForemanRhCloud', plugin_permissions, 'Role granting permissions to view the hosts inventory,
49
+ generate a report, upload it to the cloud and download it locally'
50
+
51
+ add_permissions_to_default_roles Role::ORG_ADMIN => plugin_permissions,
52
+ Role::MANAGER => plugin_permissions,
53
+ Role::SYSTEM_ADMIN => plugin_permissions
38
54
 
39
55
  # Adding a sub menu after hosts menu
40
- sub_menu :top_menu, :foreman_rh_cloud, :caption => N_('RH Cloud'), :icon => 'fa fa-cloud-upload' do
41
- menu :top_menu, :level1, :caption => N_('Inventory Upload'), :url_hash => { controller: :'foreman_inventory_upload/react', :action => :index}
56
+ divider :top_menu, caption: N_('RH Cloud'), parent: :configure_menu
57
+ menu :top_menu, :inventory_upload, :caption => N_('Inventory Upload'), :url_hash => { controller: :'foreman_rh_cloud/react', :action => :inventory_upload}, parent: :configure_menu
58
+ menu :top_menu, :insights_hits_import, :caption => N_('Insights'), :url_hash => { controller: :'foreman_rh_cloud/react', :action => :insights_cloud }, parent: :configure_menu
59
+
60
+ register_facet InsightsFacet, :insights do
61
+ configure_host do
62
+ set_dependent_action :destroy
63
+ end
64
+ end
65
+
66
+ register_global_js_file 'subscriptions_extension'
67
+
68
+ register_custom_status(InventorySync::InventoryStatus)
69
+
70
+ extend_page 'hosts/show' do |context|
71
+ context.add_pagelet :main_tabs,
72
+ partial: 'hosts/insights_tab',
73
+ name: _('Insights'),
74
+ onlyif: proc { |host| host.insights }
42
75
  end
43
76
  end
77
+
78
+ ::Katello::UINotifications::Subscriptions::ManifestImportSuccess.include ForemanInventoryUpload::Notifications::ManifestImportSuccessNotificationOverride if defined?(Katello)
79
+
80
+ ::Host::Managed.include RhCloudHost
81
+ ::Host::Base.include RhCloudHost
44
82
  end
45
83
 
46
84
  initializer "foreman_rh_cloud.set_dynflow.config.on_init", :before => :finisher_hook do |_app|
47
85
  unless Rails.env.test?
48
86
  ForemanTasks.dynflow.config.on_init do |world|
49
87
  ForemanInventoryUpload::Async::GenerateAllReportsJob.spawn_if_missing(world)
88
+ InsightsCloud::Async::InsightsScheduledSync.spawn_if_missing(world)
50
89
  end
51
90
  end
52
91
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanRhCloud
2
- VERSION = '1.0.6'.freeze
2
+ VERSION = '1.0.11'.freeze
3
3
  end
@@ -0,0 +1,15 @@
1
+ module InsightsCloud
2
+ module WebUi
3
+ ADVISOR = 'advisor'
4
+ VULNERABILITY = 'vulnerability'
5
+ PATCH = 'patch'
6
+
7
+ def self.system_url(subsystem, host_uuid)
8
+ ForemanRhCloud.base_url + "/insights/#{subsystem}/systems/#{host_uuid}"
9
+ end
10
+ end
11
+
12
+ def self.hits_export_url
13
+ ForemanRhCloud.base_url + '/api/insights/v1/export/hits/'
14
+ end
15
+ end
@@ -0,0 +1,103 @@
1
+ require 'rest-client'
2
+
3
+ module InsightsCloud
4
+ module Async
5
+ class InsightsFullSync < ::ApplicationJob
6
+ def perform
7
+ hits = query_insights_hits
8
+
9
+ @hits_host_names = Hash[hits.map { |hit| [hit['hostname'], hit['uuid']] }]
10
+ setup_host_names(@hits_host_names.keys)
11
+
12
+ replace_hits_data(hits)
13
+ end
14
+
15
+ def logger
16
+ Foreman::Logging.logger('background')
17
+ end
18
+
19
+ def rh_credentials
20
+ @rh_credentials ||= query_refresh_token
21
+ end
22
+
23
+ private
24
+
25
+ def query_insights_hits
26
+ hits_response = RestClient::Request.execute(
27
+ method: :get,
28
+ url: InsightsCloud.hits_export_url,
29
+ verify_ssl: ForemanRhCloud.verify_ssl_method,
30
+ headers: {
31
+ Authorization: "Bearer #{rh_credentials}",
32
+ }
33
+ )
34
+
35
+ JSON.parse(hits_response)
36
+ end
37
+
38
+ def query_refresh_token
39
+ token_response = RestClient::Request.execute(
40
+ method: :post,
41
+ url: ForemanRhCloud.authentication_url,
42
+ verify_ssl: ForemanRhCloud.verify_ssl_method,
43
+ payload: {
44
+ grant_type: 'refresh_token',
45
+ client_id: 'rhsm-api',
46
+ refresh_token: Setting[:rh_cloud_token],
47
+ }
48
+ )
49
+
50
+ JSON.parse(token_response)['access_token']
51
+ rescue RestClient::ExceptionWithResponse => e
52
+ Foreman::Logging.exception('Unable to authenticate using rh_cloud_token setting', e)
53
+ raise ::Foreman::WrappedException.new(e, N_('Unable to authenticate using rh_cloud_token setting'))
54
+ end
55
+
56
+ def setup_host_names(host_names)
57
+ @host_ids = Hash[
58
+ Host.unscoped.where(name: host_names).pluck(:name, :id)
59
+ ]
60
+ end
61
+
62
+ def host_id(host_name)
63
+ @host_ids[host_name]
64
+ end
65
+
66
+ def replace_hits_data(hits)
67
+ InsightsHit.transaction do
68
+ InsightsHit.delete_all
69
+ InsightsHit.create(hits.map { |hits_hash| to_model_hash(hits_hash) }.compact)
70
+ # create new facets for hosts that are missing one
71
+ hosts_with_existing_facets = InsightsFacet.where(host_id: @host_ids.values).pluck(:host_id)
72
+ InsightsFacet.create(
73
+ @host_ids.map do |host_name, host_id|
74
+ unless hosts_with_existing_facets.include?(host_id)
75
+ {
76
+ host_id: host_id,
77
+ uuid: @hits_host_names[host_name],
78
+ }
79
+ end
80
+ end.compact
81
+ )
82
+ end
83
+ end
84
+
85
+ def to_model_hash(hit_hash)
86
+ hit_host_id = host_id(hit_hash['hostname'])
87
+
88
+ return unless hit_host_id
89
+
90
+ {
91
+ host_id: hit_host_id,
92
+ last_seen: DateTime.parse(hit_hash['last_seen']),
93
+ publish_date: DateTime.parse(hit_hash['publish_date']),
94
+ title: hit_hash['title'],
95
+ solution_url: hit_hash['solution_url'],
96
+ total_risk: hit_hash['total_risk'].to_i,
97
+ likelihood: hit_hash['likelihood'].to_i,
98
+ results_url: hit_hash['results_url'],
99
+ }
100
+ end
101
+ end
102
+ end
103
+ end