katello 4.11.1 → 4.12.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of katello might be problematic. Click here for more details.

Files changed (349) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/katello/common/katello.global.js +1 -1
  3. data/app/assets/javascripts/katello/locale/bn/katello.js +76 -85
  4. data/app/assets/javascripts/katello/locale/bn_IN/katello.js +76 -85
  5. data/app/assets/javascripts/katello/locale/ca/katello.js +80 -86
  6. data/app/assets/javascripts/katello/locale/cs/katello.js +79 -85
  7. data/app/assets/javascripts/katello/locale/cs_CZ/katello.js +91 -88
  8. data/app/assets/javascripts/katello/locale/de/katello.js +97 -94
  9. data/app/assets/javascripts/katello/locale/de_AT/katello.js +76 -85
  10. data/app/assets/javascripts/katello/locale/de_DE/katello.js +76 -85
  11. data/app/assets/javascripts/katello/locale/el/katello.js +86 -86
  12. data/app/assets/javascripts/katello/locale/en/katello.js +76 -85
  13. data/app/assets/javascripts/katello/locale/en_GB/katello.js +88 -85
  14. data/app/assets/javascripts/katello/locale/en_US/katello.js +76 -85
  15. data/app/assets/javascripts/katello/locale/es/katello.js +94 -94
  16. data/app/assets/javascripts/katello/locale/et_EE/katello.js +76 -85
  17. data/app/assets/javascripts/katello/locale/fr/katello.js +97 -94
  18. data/app/assets/javascripts/katello/locale/gl/katello.js +80 -86
  19. data/app/assets/javascripts/katello/locale/gu/katello.js +76 -85
  20. data/app/assets/javascripts/katello/locale/he_IL/katello.js +76 -85
  21. data/app/assets/javascripts/katello/locale/hi/katello.js +76 -85
  22. data/app/assets/javascripts/katello/locale/id/katello.js +76 -85
  23. data/app/assets/javascripts/katello/locale/it/katello.js +89 -86
  24. data/app/assets/javascripts/katello/locale/ja/katello.js +97 -94
  25. data/app/assets/javascripts/katello/locale/ka/katello.js +92 -92
  26. data/app/assets/javascripts/katello/locale/kn/katello.js +76 -85
  27. data/app/assets/javascripts/katello/locale/ko/katello.js +91 -94
  28. data/app/assets/javascripts/katello/locale/locale/katello.js +1051 -1048
  29. data/app/assets/javascripts/katello/locale/ml_IN/katello.js +76 -85
  30. data/app/assets/javascripts/katello/locale/mr/katello.js +76 -85
  31. data/app/assets/javascripts/katello/locale/nl_NL/katello.js +76 -85
  32. data/app/assets/javascripts/katello/locale/or/katello.js +76 -85
  33. data/app/assets/javascripts/katello/locale/pa/katello.js +76 -85
  34. data/app/assets/javascripts/katello/locale/pl/katello.js +76 -85
  35. data/app/assets/javascripts/katello/locale/pl_PL/katello.js +76 -85
  36. data/app/assets/javascripts/katello/locale/pt/katello.js +76 -85
  37. data/app/assets/javascripts/katello/locale/pt_BR/katello.js +94 -94
  38. data/app/assets/javascripts/katello/locale/ro/katello.js +76 -85
  39. data/app/assets/javascripts/katello/locale/ro_RO/katello.js +76 -85
  40. data/app/assets/javascripts/katello/locale/ru/katello.js +91 -94
  41. data/app/assets/javascripts/katello/locale/sl/katello.js +76 -85
  42. data/app/assets/javascripts/katello/locale/sv_SE/katello.js +80 -86
  43. data/app/assets/javascripts/katello/locale/ta/katello.js +76 -85
  44. data/app/assets/javascripts/katello/locale/ta_IN/katello.js +76 -85
  45. data/app/assets/javascripts/katello/locale/te/katello.js +76 -85
  46. data/app/assets/javascripts/katello/locale/tr/katello.js +76 -85
  47. data/app/assets/javascripts/katello/locale/vi/katello.js +76 -85
  48. data/app/assets/javascripts/katello/locale/vi_VN/katello.js +76 -85
  49. data/app/assets/javascripts/katello/locale/zh/katello.js +76 -85
  50. data/app/assets/javascripts/katello/locale/zh_CN/katello.js +97 -94
  51. data/app/assets/javascripts/katello/locale/zh_TW/katello.js +91 -94
  52. data/app/assets/javascripts/katello/sync_management/index.js +0 -1
  53. data/app/assets/javascripts/katello/sync_management/sync_management.js +365 -308
  54. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +1 -0
  55. data/app/controllers/katello/api/v2/debs_controller.rb +4 -0
  56. data/app/controllers/katello/api/v2/host_debs_controller.rb +13 -1
  57. data/app/controllers/katello/api/v2/organizations_controller.rb +1 -3
  58. data/app/controllers/katello/api/v2/repositories_controller.rb +2 -8
  59. data/app/controllers/katello/concerns/api/v2/registration_commands_controller_extensions.rb +0 -1
  60. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +7 -3
  61. data/app/controllers/katello/concerns/organizations_controller_extensions.rb +1 -17
  62. data/app/helpers/katello/concerns/dashboard_helper_extensions.rb +0 -20
  63. data/app/lib/actions/katello/content_view/publish.rb +3 -3
  64. data/app/lib/actions/katello/content_view_version/auto_create_products.rb +4 -4
  65. data/app/lib/actions/katello/content_view_version/auto_create_redhat_repositories.rb +5 -5
  66. data/app/lib/actions/katello/content_view_version/auto_create_repositories.rb +5 -5
  67. data/app/lib/actions/katello/content_view_version/import.rb +14 -13
  68. data/app/lib/actions/katello/content_view_version/import_library.rb +4 -4
  69. data/app/lib/actions/katello/content_view_version/import_repository.rb +3 -3
  70. data/app/lib/actions/katello/content_view_version/reset_content_view_repositories_from_metadata.rb +2 -2
  71. data/app/lib/actions/katello/host/hypervisors_update.rb +0 -1
  72. data/app/lib/actions/katello/organization/manifest_delete.rb +1 -1
  73. data/app/lib/actions/katello/organization/manifest_refresh.rb +16 -16
  74. data/app/lib/actions/katello/repository/sync.rb +2 -4
  75. data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +20 -15
  76. data/app/lib/actions/pulp3/orchestration/content_view_version/export_library.rb +17 -14
  77. data/app/lib/actions/pulp3/orchestration/content_view_version/import.rb +11 -11
  78. data/app/lib/actions/pulp3/orchestration/repository/upload_content.rb +18 -13
  79. data/app/lib/actions/pulp3/repository/import_upload.rb +13 -5
  80. data/app/lib/actions/pulp3/repository/save_artifact.rb +23 -12
  81. data/app/lib/katello/api/v2/error_handling.rb +1 -1
  82. data/app/lib/katello/lazy_accessor.rb +6 -6
  83. data/app/lib/katello/resources/candlepin/owner.rb +2 -2
  84. data/app/mailers/katello/errata_mailer.rb +3 -3
  85. data/app/models/katello/concerns/host_managed_extensions.rb +29 -76
  86. data/app/models/katello/concerns/hostgroup_extensions.rb +4 -2
  87. data/app/models/katello/concerns/organization_extensions.rb +1 -1
  88. data/app/models/katello/concerns/pulp_database_unit.rb +1 -1
  89. data/app/models/katello/concerns/subscription_facet_host_extensions.rb +0 -27
  90. data/app/models/katello/content_view.rb +11 -6
  91. data/app/models/katello/content_view_version.rb +2 -0
  92. data/app/models/katello/deb.rb +8 -0
  93. data/app/models/katello/host/content_facet.rb +19 -14
  94. data/app/models/katello/host/subscription_facet.rb +0 -19
  95. data/app/models/katello/host_tracer.rb +9 -5
  96. data/app/models/katello/installed_deb.rb +1 -0
  97. data/app/models/katello/repository.rb +3 -2
  98. data/app/models/katello/trace_status.rb +6 -2
  99. data/app/overrides/add_organization_attributes.rb +0 -18
  100. data/app/presenters/katello/host_deb_presenter.rb +23 -0
  101. data/app/services/katello/candlepin/consumer.rb +0 -4
  102. data/app/services/katello/candlepin/event_handler.rb +6 -25
  103. data/app/services/katello/candlepin/message_handler.rb +1 -21
  104. data/app/services/katello/host/profiles_uploader.rb +17 -6
  105. data/app/services/katello/host_status_manager.rb +0 -22
  106. data/app/services/katello/organization_creator.rb +2 -2
  107. data/app/services/katello/pulp3/api/apt.rb +1 -1
  108. data/app/services/katello/pulp3/content_view_version/export.rb +2 -2
  109. data/app/services/katello/pulp3/content_view_version/metadata_generator.rb +1 -0
  110. data/app/services/katello/pulp3/content_view_version/metadata_map.rb +3 -0
  111. data/app/services/katello/pulp3/repository/apt.rb +16 -6
  112. data/app/services/katello/registration_manager.rb +1 -13
  113. data/app/views/katello/api/v2/host_debs/base.json.rabl +2 -0
  114. data/app/views/katello/api/v2/hosts/base.json.rabl +9 -0
  115. data/app/views/katello/api/v2/subscription_facet/base_with_root.json.rabl +0 -3
  116. data/app/views/katello/api/v2/subscription_facet/show.json.rabl +3 -0
  117. data/app/views/katello/sync_management/index.html.erb +14 -13
  118. data/app/views/overrides/activation_keys/_host_environment_select.html.erb +20 -16
  119. data/app/views/overrides/activation_keys/_host_synced_content_select.html.erb +6 -4
  120. data/app/views/overrides/organizations/_edit_override.html.erb +0 -12
  121. data/db/migrate/20131014225132_add_users_fields.rb +0 -1
  122. data/db/migrate/20150603045418_remove_user_fields.rb +0 -2
  123. data/db/migrate/20160404132250_remove_katello_from_notification_name.rb +4 -22
  124. data/db/migrate/20160505181337_rename_katello_settings.rb +2 -2
  125. data/db/migrate/20200818192230_update_system_purpose_status.rb +9 -3
  126. data/db/migrate/20240111032511_add_index_to_host_installed_packages.rb +16 -0
  127. data/db/migrate/20240123120109_remove_pulp_export_destination_setting.rb +9 -0
  128. data/db/migrate/20240207191223_remove_entitlement_mode_host_statuses.rb +30 -0
  129. data/db/seeds.d/111-upgrade_tasks.rb +2 -1
  130. data/engines/bastion/app/assets/javascripts/bastion/bastion.js +0 -2
  131. data/engines/bastion/app/views/bastion/layouts/assets.html.erb +6 -2
  132. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-associations-content-hosts.html +0 -4
  133. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-details.html +0 -1
  134. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion-katello-bootstrap.js +45 -29
  135. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js +0 -10
  136. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details.controller.js +0 -1
  137. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +2 -21
  138. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-subscriptions.html +0 -5
  139. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +0 -7
  140. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +5 -5
  141. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +9 -1
  142. data/engines/bastion_katello/lib/bastion_katello/engine.rb +0 -6
  143. data/lib/katello/engine.rb +0 -3
  144. data/lib/katello/plugin.rb +2 -11
  145. data/lib/katello/tasks/rubocop.rake +0 -9
  146. data/lib/katello/tasks/unify_hosts.rake +0 -1
  147. data/lib/katello/tasks/upgrades/4.12/update_content_access_modes.rake +35 -0
  148. data/lib/katello/version.rb +1 -1
  149. data/locale/action_names.rb +12 -6
  150. data/locale/bn/katello.po +19 -28
  151. data/locale/bn/katello.po.time_stamp +0 -0
  152. data/locale/bn/katello.pox +0 -0
  153. data/locale/bn_IN/katello.po +19 -28
  154. data/locale/bn_IN/katello.po.time_stamp +0 -0
  155. data/locale/ca/LC_MESSAGES/katello.mo +0 -0
  156. data/locale/ca/katello.po +20 -29
  157. data/locale/ca/katello.po.time_stamp +0 -0
  158. data/locale/cs/katello.po +19 -29
  159. data/locale/cs/katello.po.time_stamp +0 -0
  160. data/locale/cs_CZ/LC_MESSAGES/katello.mo +0 -0
  161. data/locale/cs_CZ/katello.po +20 -29
  162. data/locale/cs_CZ/katello.po.time_stamp +0 -0
  163. data/locale/de/LC_MESSAGES/katello.mo +0 -0
  164. data/locale/de/katello.po +20 -29
  165. data/locale/de/katello.po.time_stamp +0 -0
  166. data/locale/de_AT/katello.po +19 -28
  167. data/locale/de_AT/katello.po.time_stamp +0 -0
  168. data/locale/de_DE/katello.po +19 -28
  169. data/locale/de_DE/katello.po.time_stamp +0 -0
  170. data/locale/el/LC_MESSAGES/katello.mo +0 -0
  171. data/locale/el/katello.po +20 -29
  172. data/locale/el/katello.po.time_stamp +0 -0
  173. data/locale/en/katello.po +19 -28
  174. data/locale/en/katello.po.time_stamp +0 -0
  175. data/locale/en_GB/LC_MESSAGES/katello.mo +0 -0
  176. data/locale/en_GB/katello.po +19 -28
  177. data/locale/en_GB/katello.po.time_stamp +0 -0
  178. data/locale/en_US/katello.po +19 -28
  179. data/locale/en_US/katello.po.time_stamp +0 -0
  180. data/locale/es/LC_MESSAGES/katello.mo +0 -0
  181. data/locale/es/katello.po +20 -29
  182. data/locale/es/katello.po.time_stamp +0 -0
  183. data/locale/et_EE/katello.po +19 -28
  184. data/locale/et_EE/katello.po.time_stamp +0 -0
  185. data/locale/fr/LC_MESSAGES/katello.mo +0 -0
  186. data/locale/fr/katello.po +20 -29
  187. data/locale/fr/katello.po.time_stamp +0 -0
  188. data/locale/gl/LC_MESSAGES/katello.mo +0 -0
  189. data/locale/gl/katello.po +20 -29
  190. data/locale/gl/katello.po.time_stamp +0 -0
  191. data/locale/gu/katello.po +19 -28
  192. data/locale/gu/katello.po.time_stamp +0 -0
  193. data/locale/he_IL/katello.po +19 -28
  194. data/locale/he_IL/katello.po.time_stamp +0 -0
  195. data/locale/hi/katello.po +19 -28
  196. data/locale/hi/katello.po.time_stamp +0 -0
  197. data/locale/id/katello.po +19 -28
  198. data/locale/id/katello.po.time_stamp +0 -0
  199. data/locale/it/LC_MESSAGES/katello.mo +0 -0
  200. data/locale/it/katello.po +20 -29
  201. data/locale/it/katello.po.time_stamp +0 -0
  202. data/locale/ja/LC_MESSAGES/katello.mo +0 -0
  203. data/locale/ja/katello.po +20 -29
  204. data/locale/ja/katello.po.time_stamp +0 -0
  205. data/locale/ka/LC_MESSAGES/katello.mo +0 -0
  206. data/locale/ka/katello.po +20 -29
  207. data/locale/ka/katello.po.time_stamp +0 -0
  208. data/locale/katello.pot +363 -348
  209. data/locale/kn/katello.po +19 -28
  210. data/locale/kn/katello.po.time_stamp +0 -0
  211. data/locale/ko/LC_MESSAGES/katello.mo +0 -0
  212. data/locale/ko/katello.po +20 -29
  213. data/locale/ko/katello.po.time_stamp +0 -0
  214. data/locale/messages.mo +0 -0
  215. data/locale/ml_IN/katello.po +19 -28
  216. data/locale/ml_IN/katello.po.time_stamp +0 -0
  217. data/locale/mr/katello.po +19 -28
  218. data/locale/mr/katello.po.time_stamp +0 -0
  219. data/locale/nl_NL/katello.po +19 -28
  220. data/locale/nl_NL/katello.po.time_stamp +0 -0
  221. data/locale/or/katello.po +19 -28
  222. data/locale/or/katello.po.time_stamp +0 -0
  223. data/locale/pa/katello.po +19 -28
  224. data/locale/pa/katello.po.time_stamp +0 -0
  225. data/locale/pl/katello.po +19 -28
  226. data/locale/pl/katello.po.time_stamp +0 -0
  227. data/locale/pl_PL/katello.po +19 -28
  228. data/locale/pl_PL/katello.po.time_stamp +0 -0
  229. data/locale/pt/katello.po +19 -28
  230. data/locale/pt/katello.po.time_stamp +0 -0
  231. data/locale/pt_BR/LC_MESSAGES/katello.mo +0 -0
  232. data/locale/pt_BR/katello.po +20 -29
  233. data/locale/pt_BR/katello.po.time_stamp +0 -0
  234. data/locale/ro/katello.po +19 -28
  235. data/locale/ro/katello.po.time_stamp +0 -0
  236. data/locale/ro_RO/katello.po +19 -28
  237. data/locale/ro_RO/katello.po.time_stamp +0 -0
  238. data/locale/ru/LC_MESSAGES/katello.mo +0 -0
  239. data/locale/ru/katello.po +20 -29
  240. data/locale/ru/katello.po.time_stamp +0 -0
  241. data/locale/sl/katello.po +19 -28
  242. data/locale/sl/katello.po.time_stamp +0 -0
  243. data/locale/sv_SE/LC_MESSAGES/katello.mo +0 -0
  244. data/locale/sv_SE/katello.po +20 -29
  245. data/locale/sv_SE/katello.po.time_stamp +0 -0
  246. data/locale/ta/katello.po +19 -28
  247. data/locale/ta/katello.po.time_stamp +0 -0
  248. data/locale/ta_IN/katello.po +19 -28
  249. data/locale/ta_IN/katello.po.time_stamp +0 -0
  250. data/locale/te/katello.po +19 -28
  251. data/locale/te/katello.po.time_stamp +0 -0
  252. data/locale/tr/katello.po +19 -28
  253. data/locale/tr/katello.po.time_stamp +0 -0
  254. data/locale/vi/katello.po +19 -28
  255. data/locale/vi/katello.po.time_stamp +0 -0
  256. data/locale/vi_VN/katello.po +19 -28
  257. data/locale/vi_VN/katello.po.time_stamp +0 -0
  258. data/locale/zh/katello.po +19 -28
  259. data/locale/zh/katello.po.time_stamp +0 -0
  260. data/locale/zh_CN/LC_MESSAGES/katello.mo +0 -0
  261. data/locale/zh_CN/katello.po +20 -29
  262. data/locale/zh_CN/katello.po.time_stamp +0 -0
  263. data/locale/zh_TW/LC_MESSAGES/katello.mo +0 -0
  264. data/locale/zh_TW/katello.po +20 -29
  265. data/locale/zh_TW/katello.po.time_stamp +0 -0
  266. data/package.json +0 -1
  267. data/webpack/components/extensions/HostDetails/Tabs/ContentTab/SecondaryTabsRoutes.js +4 -0
  268. data/webpack/components/extensions/HostDetails/Tabs/ContentTab/constants.js +4 -1
  269. data/webpack/components/extensions/HostDetails/Tabs/DebsTab/DebInstallModal.js +250 -0
  270. data/webpack/components/extensions/HostDetails/Tabs/DebsTab/DebInstallModal.scss +3 -0
  271. data/webpack/components/extensions/HostDetails/Tabs/DebsTab/DebsTab.js +585 -0
  272. data/webpack/components/extensions/HostDetails/Tabs/DebsTab/DebsTab.scss +12 -0
  273. data/webpack/components/extensions/HostDetails/Tabs/DebsTab/HostDebsActions.js +13 -0
  274. data/webpack/components/extensions/HostDetails/Tabs/DebsTab/HostDebsConstants.js +13 -0
  275. data/webpack/components/extensions/HostDetails/Tabs/DebsTab/HostDebsSelectors.js +16 -0
  276. data/webpack/components/extensions/HostDetails/Tabs/DebsTab/InstallableDebsActions.js +17 -0
  277. data/webpack/components/extensions/HostDetails/Tabs/DebsTab/InstallableDebsConstants.js +3 -0
  278. data/webpack/components/extensions/HostDetails/Tabs/DebsTab/InstallableDebsSelectors.js +16 -0
  279. data/webpack/components/extensions/HostDetails/Tabs/ModuleStreamsTab/ModuleStreamsTab.js +1 -8
  280. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab/PackagesTab.js +2 -0
  281. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.js +4 -18
  282. data/webpack/components/extensions/HostDetails/Tabs/TracesTab/TracesTab.js +13 -5
  283. data/webpack/components/extensions/HostDetails/Tabs/__tests__/debs.fixtures.json +31 -0
  284. data/webpack/components/extensions/HostDetails/Tabs/__tests__/debsInstallModal.test.js +226 -0
  285. data/webpack/components/extensions/HostDetails/Tabs/__tests__/debsTab.test.js +420 -0
  286. data/webpack/components/extensions/HostDetails/Tabs/__tests__/installableDebs.fixtures.json +63 -0
  287. data/webpack/components/extensions/HostDetails/Tabs/__tests__/traces.fixtures.json +11 -1
  288. data/webpack/components/extensions/HostDetails/Tabs/__tests__/tracesTab.test.js +63 -3
  289. data/webpack/scenes/ContentViews/ContentViewsConstants.js +3 -0
  290. data/webpack/scenes/ContentViews/Delete/__tests__/affectedHosts.fixtures.json +0 -13
  291. data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +23 -1
  292. data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +19 -1
  293. data/webpack/scenes/ContentViews/Details/Versions/BulkDelete/__tests__/hosts.fixtures.json +0 -13
  294. data/webpack/scenes/ContentViews/Details/Versions/Compare/CVVersionCompareConfig.js +37 -3
  295. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersionContent.js +10 -2
  296. data/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvAffectedHosts.fixture.json +0 -13
  297. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailConfig.js +31 -5
  298. data/webpack/scenes/Organizations/OrganizationSelectors.js +0 -3
  299. data/webpack/scenes/Subscriptions/Manifest/index.js +1 -4
  300. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +3 -25
  301. data/webpack/scenes/Subscriptions/SubscriptionsSelectors.js +0 -3
  302. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsSelectors.test.js +0 -3
  303. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +0 -22
  304. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsSelectors.test.js.snap +0 -3
  305. data/webpack/scenes/Subscriptions/index.js +1 -2
  306. metadata +93 -190
  307. data/app/controllers/katello/concerns/content_facet_hosts_controller_extensions.rb +0 -22
  308. data/app/models/katello/concerns/widget_extensions.rb +0 -23
  309. data/app/models/katello/purpose_addons_status.rb +0 -28
  310. data/app/models/katello/purpose_role_status.rb +0 -28
  311. data/app/models/katello/purpose_sla_status.rb +0 -28
  312. data/app/models/katello/purpose_status.rb +0 -71
  313. data/app/models/katello/purpose_usage_status.rb +0 -28
  314. data/app/models/katello/subscription_status.rb +0 -71
  315. data/app/services/katello/candlepin/system_purpose.rb +0 -49
  316. data/app/views/dashboard/_subscription_status_widget.html.erb +0 -37
  317. data/app/views/dashboard/_subscription_widget.html.erb +0 -85
  318. data/app/views/overrides/organizations/_index_header_override.html.erb +0 -3
  319. data/app/views/overrides/organizations/_index_row_override.html.erb +0 -3
  320. data/app/views/overrides/organizations/_step_1_override.html.erb +0 -10
  321. data/config/locales/README +0 -10
  322. data/config/locales/bn.yml +0 -182
  323. data/config/locales/compare_upstream.sh +0 -21
  324. data/config/locales/cs.yml +0 -211
  325. data/config/locales/de.yml +0 -203
  326. data/config/locales/en.yml +0 -205
  327. data/config/locales/es.yml +0 -199
  328. data/config/locales/fr.yml +0 -222
  329. data/config/locales/gu.yml +0 -181
  330. data/config/locales/hi.yml +0 -199
  331. data/config/locales/it.yml +0 -205
  332. data/config/locales/ja.yml +0 -197
  333. data/config/locales/kn.yml +0 -199
  334. data/config/locales/ko.yml +0 -197
  335. data/config/locales/mr.yml +0 -178
  336. data/config/locales/or.yml +0 -181
  337. data/config/locales/pa.yml +0 -181
  338. data/config/locales/pt-BR.yml +0 -207
  339. data/config/locales/pt.yml +0 -207
  340. data/config/locales/ru.yml +0 -257
  341. data/config/locales/ta.yml +0 -181
  342. data/config/locales/te.yml +0 -181
  343. data/config/locales/update.sh +0 -14
  344. data/config/locales/zh-CN.yml +0 -199
  345. data/config/locales/zh-TW.yml +0 -199
  346. data/engines/bastion/app/assets/javascripts/bastion/bastion-bootstrap.js +0 -17
  347. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/content-access-mode-banner.directive.js +0 -22
  348. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +0 -10
  349. data/webpack/scenes/Subscriptions/Manifest/SimpleContentAccess.js +0 -96
@@ -3,7 +3,7 @@ module Actions
3
3
  module Orchestration
4
4
  module ContentViewVersion
5
5
  class Import < Actions::EntryAction
6
- def plan(content_view_version, path:, metadata:)
6
+ def plan(content_view_version, opts = {})
7
7
  action_subject(content_view_version)
8
8
  sequence do
9
9
  smart_proxy = SmartProxy.pulp_primary!
@@ -11,8 +11,8 @@ module Actions
11
11
  ::Actions::Pulp3::ContentViewVersion::CreateImporter,
12
12
  content_view_version_id: content_view_version.id,
13
13
  smart_proxy_id: smart_proxy.id,
14
- path: path,
15
- metadata: metadata
14
+ path: opts[:path],
15
+ metadata: opts[:metadata]
16
16
  ).output
17
17
 
18
18
  plan_action(
@@ -20,8 +20,8 @@ module Actions
20
20
  organization_id: content_view_version.content_view.organization_id,
21
21
  smart_proxy_id: smart_proxy.id,
22
22
  importer_data: importer_output[:importer_data],
23
- path: path,
24
- metadata: metadata
23
+ path: opts[:path],
24
+ metadata: opts[:metadata]
25
25
  )
26
26
  concurrence do
27
27
  content_view_version.importable_repositories.each do |repo|
@@ -31,20 +31,20 @@ module Actions
31
31
  plan_action(
32
32
  ::Actions::Pulp3::ContentViewVersion::CreateImportHistory,
33
33
  content_view_version_id: content_view_version.id,
34
- path: path,
35
- metadata: metadata,
34
+ path: opts[:path],
35
+ metadata: opts[:metadata],
36
36
  content_view_name: content_view_version.name
37
37
  )
38
38
  plan_action(::Actions::Pulp3::ContentViewVersion::DestroyImporter,
39
39
  organization_id: content_view_version.content_view.organization_id,
40
40
  smart_proxy_id: smart_proxy.id,
41
- path: path,
42
- metadata: metadata,
41
+ path: opts[:path],
42
+ metadata: opts[:metadata],
43
43
  importer_data: importer_output[:importer_data])
44
44
  plan_self(
45
45
  content_view_name: content_view_version.name,
46
- metadata: metadata,
47
- path: path,
46
+ metadata: opts[:metadata],
47
+ path: opts[:path],
48
48
  content_view_version_id: content_view_version.id
49
49
  )
50
50
  end
@@ -6,22 +6,27 @@ module Actions
6
6
  include Actions::Helpers::OutputPropagator
7
7
  def plan(repository, smart_proxy, file, unit_type_id)
8
8
  sequence do
9
- checksum = Digest::SHA256.hexdigest(File.read(file[:path]))
10
- duplicate_sha_path_content_list = ::Katello::Pulp3::PulpContentUnit.find_duplicate_unit(repository, unit_type_id, file, checksum)
11
- duplicate_content_href = duplicate_sha_path_content_list&.results&.first&.pulp_href
9
+ if repository.deb?
10
+ upload_action_output = plan_action(Pulp3::Repository::UploadFile, repository, smart_proxy, file[:path]).output
11
+ artifact_action_output = plan_action(Pulp3::Repository::SaveArtifact, file, repository, smart_proxy, upload_action_output[:pulp_tasks], unit_type_id).output
12
+ else
13
+ checksum = Digest::SHA256.hexdigest(File.read(file[:path]))
14
+ duplicate_sha_path_content_list = ::Katello::Pulp3::PulpContentUnit.find_duplicate_unit(repository, unit_type_id, file, checksum)
15
+ duplicate_content_href = duplicate_sha_path_content_list&.results&.first&.pulp_href
12
16
 
13
- unless duplicate_content_href
14
- duplicate_sha_artifact_list = ::Katello::Pulp3::Api::Core.new(smart_proxy).artifacts_api.list("sha256": Digest::SHA256.hexdigest(File.read(file[:path])))
15
- duplicate_sha_artifact_href = duplicate_sha_artifact_list&.results&.first&.pulp_href
16
- if duplicate_sha_artifact_href
17
- artifact_action_output = plan_action(Pulp3::Repository::SaveArtifact, file, repository, smart_proxy, nil, unit_type_id, artifact_href: duplicate_sha_artifact_href).output
18
- else
19
- upload_action_output = plan_action(Pulp3::Repository::UploadFile, repository, smart_proxy, file[:path]).output
20
- artifact_action_output = plan_action(Pulp3::Repository::SaveArtifact, file, repository, smart_proxy, upload_action_output[:pulp_tasks], unit_type_id).output
17
+ unless duplicate_content_href
18
+ duplicate_sha_artifact_list = ::Katello::Pulp3::Api::Core.new(smart_proxy).artifacts_api.list("sha256": Digest::SHA256.hexdigest(File.read(file[:path])))
19
+ duplicate_sha_artifact_href = duplicate_sha_artifact_list&.results&.first&.pulp_href
20
+ if duplicate_sha_artifact_href
21
+ artifact_action_output = plan_action(Pulp3::Repository::SaveArtifact, file, repository, smart_proxy, nil, unit_type_id, artifact_href: duplicate_sha_artifact_href).output
22
+ else
23
+ upload_action_output = plan_action(Pulp3::Repository::UploadFile, repository, smart_proxy, file[:path]).output
24
+ artifact_action_output = plan_action(Pulp3::Repository::SaveArtifact, file, repository, smart_proxy, upload_action_output[:pulp_tasks], unit_type_id).output
25
+ end
21
26
  end
22
-
27
+ artifact_action_output ||= {:content_unit_href => duplicate_content_href}
23
28
  end
24
- artifact_action_output ||= {:content_unit_href => duplicate_content_href}
29
+
25
30
  action_output = plan_action(Pulp3::Repository::ImportUpload, artifact_action_output, repository, smart_proxy).output
26
31
  plan_action(Pulp3::Repository::SaveVersion, repository, tasks: action_output[:pulp_tasks]).output
27
32
  plan_self(:subaction_output => action_output)
@@ -12,17 +12,25 @@ module Actions
12
12
  end
13
13
 
14
14
  def invoke_external_task
15
+ repo = ::Katello::Repository.find(input[:repository_id])
16
+ repo_backend_service = repo.backend_service(smart_proxy)
17
+
15
18
  if input[:save_artifact_output][:pulp_tasks]&.any?
16
- content_unit_href = input[:save_artifact_output][:pulp_tasks].last[:created_resources].first
19
+ if repo.deb?
20
+ content_unit_href = input[:save_artifact_output][:pulp_tasks].last[:created_resources].find { |href| href.include?("/deb/packages") }
21
+ else
22
+ content_unit_href = input[:save_artifact_output][:pulp_tasks].last[:created_resources].first
23
+ end
17
24
  else
18
25
  content_unit_href = input[:save_artifact_output][:content_unit_href]
19
26
  end
20
27
 
21
- repo = ::Katello::Repository.find(input[:repository_id])
22
- repo_backend_service = repo.backend_service(smart_proxy)
23
-
24
28
  output[:content_unit_href] = content_unit_href
25
- output[:pulp_tasks] = [repo_backend_service.add_content(content_unit_href)]
29
+ if repo.deb?
30
+ output[:pulp_tasks] = input[:save_artifact_output][:pulp_tasks]
31
+ else
32
+ output[:pulp_tasks] = [repo_backend_service.add_content(content_unit_href)]
33
+ end
26
34
  end
27
35
  end
28
36
  end
@@ -16,20 +16,31 @@ module Actions
16
16
  content_type = input[:unit_type_id]
17
17
  content_backend_service = SmartProxy.pulp_primary.content_service(content_type)
18
18
 
19
- existing_content = ::Katello::Pulp3::PulpContentUnit.find_duplicate_unit(repository, input[:unit_type_id], {filename: input[:options][:file_name]}, input[:options][:sha256])
20
- existing_content_href = existing_content&.results&.first&.pulp_href
21
-
22
- if ::Katello::RepositoryTypeManager.find_content_type(input[:unit_type_id]).repository_import_on_upload
23
- output[:pulp_tasks] = [repository.backend_service(smart_proxy).repository_import_content(artifact_href, input[:options])]
19
+ if repository.deb?
20
+ repo_url = repository.backend_service(smart_proxy).repository_reference.repository_href
21
+ output[:pulp_tasks] = [content_backend_service.content_api_create(relative_path: input[:options][:file_name],
22
+ repository: repo_url,
23
+ repository_id: repository.id,
24
+ distribution: "katello",
25
+ component: "upload",
26
+ artifact: artifact_href,
27
+ content_type: content_type)]
24
28
  else
25
- if existing_content_href
26
- output[:content_unit_href] = existing_content_href
27
- []
29
+ existing_content = ::Katello::Pulp3::PulpContentUnit.find_duplicate_unit(repository, input[:unit_type_id], {filename: input[:options][:file_name]}, input[:options][:sha256])
30
+ existing_content_href = existing_content&.results&.first&.pulp_href
31
+
32
+ if ::Katello::RepositoryTypeManager.find_content_type(input[:unit_type_id]).repository_import_on_upload
33
+ output[:pulp_tasks] = [repository.backend_service(smart_proxy).repository_import_content(artifact_href, input[:options])]
28
34
  else
29
- output[:pulp_tasks] = [content_backend_service.content_api_create(relative_path: input[:options][:file_name],
30
- repository_id: repository.id,
31
- artifact: artifact_href,
32
- content_type: content_type)]
35
+ if existing_content_href
36
+ output[:content_unit_href] = existing_content_href
37
+ []
38
+ else
39
+ output[:pulp_tasks] = [content_backend_service.content_api_create(relative_path: input[:options][:file_name],
40
+ repository_id: repository.id,
41
+ artifact: artifact_href,
42
+ content_type: content_type)]
43
+ end
33
44
  end
34
45
  end
35
46
  end
@@ -75,7 +75,7 @@ module Katello
75
75
  end
76
76
 
77
77
  def rescue_from_unsupported_action_exception(exception)
78
- respond_for_exception(exception, :status => :bad_request)
78
+ respond_for_exception(exception, :status => :bad_request, :force_json => true)
79
79
  end
80
80
 
81
81
  def rescue_from_bad_data(exception)
@@ -56,21 +56,21 @@ module Katello
56
56
  @changed_remote_attributes = val
57
57
  end
58
58
 
59
- def save(*)
60
- if (status = super)
59
+ def save(...)
60
+ if (status = super(...))
61
61
  changed_remote_attributes.clear
62
62
  end
63
63
  status
64
64
  end
65
65
 
66
- def save!(*)
67
- super.tap do
66
+ def save!(...)
67
+ super(...).tap do
68
68
  changed_remote_attributes.clear
69
69
  end
70
70
  end
71
71
 
72
- def reload(*)
73
- super.tap do
72
+ def reload(...)
73
+ super(...).tap do
74
74
  changed_remote_attributes.clear
75
75
  end
76
76
  end
@@ -18,7 +18,7 @@ module Katello
18
18
  :displayName => description,
19
19
  :contentPrefix => "/#{key}/$env",
20
20
  :contentAccessMode => content_access_mode,
21
- :contentAccessModeList => ['entitlement', 'org_environment'].join(',')
21
+ :contentAccessModeList => 'org_environment'
22
22
  }
23
23
  owner_json = self.post(path, attrs.to_json, self.default_headers).body
24
24
  JSON.parse(owner_json).with_indifferent_access
@@ -42,7 +42,7 @@ module Katello
42
42
  def update(key, attrs)
43
43
  owner = find(key)
44
44
  owner.merge!(attrs)
45
- owner.merge!(:contentAccessModeList => ['entitlement', 'org_environment'].join(','))
45
+ owner.merge!(:contentAccessModeList => 'org_environment')
46
46
  self.put(path(key), JSON.generate(owner), self.default_headers).body
47
47
  end
48
48
 
@@ -50,9 +50,9 @@ module Katello
50
50
 
51
51
  def errata_counts(errata)
52
52
  counts = {:total => errata.count}
53
- counts.merge(Hash[[:security, :bugfix, :enhancement].collect do |errata_type|
54
- [errata_type, errata.send(errata_type).count]
55
- end])
53
+ counts.merge([:security, :bugfix, :enhancement].index_with do |errata_type|
54
+ errata.send(errata_type).count
55
+ end)
56
56
  end
57
57
  end
58
58
  end
@@ -48,28 +48,6 @@ module Katello
48
48
  inherited_attrs
49
49
  end
50
50
 
51
- def apply_inherited_attributes(attributes, initialized = true)
52
- attributes = super(attributes, initialized) || {}
53
- facet_attrs = attributes&.[]('content_facet_attributes')
54
- return attributes if facet_attrs.blank?
55
- cv_id = facet_attrs['content_view_id']
56
- lce_id = facet_attrs['lifecycle_environment_id']
57
- if initialized && (cv_id.blank? || lce_id.blank?)
58
- if cv_id.blank?
59
- Rails.logger.info "Hostgroup has no content view assigned; using host's existing content view"
60
- facet_attrs['content_view_id'] = content_facet&.single_content_view&.id
61
- end
62
- if lce_id.blank?
63
- Rails.logger.info "Hostgroup has no lifecycle environment assigned; using host's existing lifecycle environment"
64
- facet_attrs['lifecycle_environment_id'] = content_facet&.single_lifecycle_environment&.id
65
- end
66
- attributes['content_facet_attributes'] = facet_attrs
67
- else
68
- Rails.logger.debug "Hostgroup has content view and lifecycle environment assigned; using those"
69
- end
70
- attributes
71
- end
72
-
73
51
  def smart_proxy_ids
74
52
  ids = super
75
53
  ids << content_source_id
@@ -168,6 +146,8 @@ module Katello
168
146
 
169
147
  scoped_search relation: :pools, on: :pools_expiring_in_days, ext_method: :find_with_expiring_pools, only_explicit: true
170
148
 
149
+ smart_proxy_reference :content_facet => [:content_source_id]
150
+
171
151
  def add_back_cve_errors
172
152
  if @pending_cve_attrs&.[](:content_view_id).present? || @pending_cve_attrs&.[](:lifecycle_environment_id).present?
173
153
  check_cve_attributes({ content_facet_attributes: @pending_cve_attrs })
@@ -430,18 +410,6 @@ module Katello
430
410
  update_trace_status
431
411
  end
432
412
 
433
- def subscription_status
434
- @subscription_status ||= get_status(::Katello::SubscriptionStatus).status
435
- end
436
-
437
- def subscription_status_label(options = {})
438
- @subscription_status_label ||= get_status(::Katello::SubscriptionStatus).to_label(options)
439
- end
440
-
441
- def subscription_global_status
442
- @subscription_global_status ||= get_status(::Katello::SubscriptionStatus).to_global
443
- end
444
-
445
413
  def errata_status
446
414
  @errata_status ||= get_status(::Katello::ErrataStatus).status
447
415
  end
@@ -450,46 +418,6 @@ module Katello
450
418
  @errata_status_label ||= get_status(::Katello::ErrataStatus).to_label(options)
451
419
  end
452
420
 
453
- def purpose_status
454
- @purpose_status ||= get_status(::Katello::PurposeStatus).status
455
- end
456
-
457
- def purpose_status_label(options = {})
458
- @purpose_status_label ||= get_status(::Katello::PurposeStatus).to_label(options)
459
- end
460
-
461
- def purpose_sla_status
462
- @purpose_sla_status ||= get_status(::Katello::PurposeSlaStatus).status
463
- end
464
-
465
- def purpose_sla_status_label(options = {})
466
- @purpose_sla_status_label ||= get_status(::Katello::PurposeSlaStatus).to_label(options)
467
- end
468
-
469
- def purpose_role_status
470
- @purpose_role_status ||= get_status(::Katello::PurposeRoleStatus).status
471
- end
472
-
473
- def purpose_role_status_label(options = {})
474
- @purpose_role_status_label ||= get_status(::Katello::PurposeRoleStatus).to_label(options)
475
- end
476
-
477
- def purpose_usage_status
478
- @purpose_usage_status ||= get_status(::Katello::PurposeUsageStatus).status
479
- end
480
-
481
- def purpose_usage_status_label(options = {})
482
- @purpose_usage_status_label ||= get_status(::Katello::PurposeUsageStatus).to_label(options)
483
- end
484
-
485
- def purpose_addons_status
486
- @purpose_addons_status ||= get_status(::Katello::PurposeAddonsStatus).status
487
- end
488
-
489
- def purpose_addons_status_label(options = {})
490
- @purpose_addons_status_label ||= get_status(::Katello::PurposeAddonsStatus).to_label(options)
491
- end
492
-
493
421
  def rhel_lifecycle_global_status
494
422
  @rhel_lifecycle_global_status ||= get_status(::Katello::RhelLifecycleStatus).to_global
495
423
  end
@@ -541,6 +469,14 @@ module Katello
541
469
  end
542
470
 
543
471
  def package_names_for_job_template(action:, search:, versions: nil)
472
+ if self.operatingsystem.family == 'Debian'
473
+ deb_names_for_job_template(action: action, search: search)
474
+ else
475
+ yum_names_for_job_template(action: action, search: search, versions: versions)
476
+ end
477
+ end
478
+
479
+ def yum_names_for_job_template(action:, search:, versions: nil)
544
480
  actions = %w(install remove update).freeze
545
481
  case action
546
482
  when 'install'
@@ -567,6 +503,24 @@ module Katello
567
503
  end
568
504
  end
569
505
 
506
+ def deb_names_for_job_template(action:, search:)
507
+ actions = %w(install remove update).freeze
508
+ case action
509
+ when 'install'
510
+ ::Katello::Deb.apt_installable_for_host(self).search_for(search).distinct.pluck(:name)
511
+ when 'remove'
512
+ return [] if search.empty?
513
+
514
+ installed_debs.search_for(search).distinct.pluck(:name)
515
+ when 'update'
516
+ return [] if search.empty?
517
+
518
+ installed_debs.search_for(search).distinct.pluck(:name)
519
+ else
520
+ fail ::Foreman::Exception.new(N_("deb_names_for_job_template: Action must be one of %s"), actions.join(', '))
521
+ end
522
+ end
523
+
570
524
  def advisory_ids(search:)
571
525
  ::Katello::Erratum.installable_for_hosts([self]).search_for(search).pluck(:errata_id)
572
526
  end
@@ -596,8 +550,7 @@ class ::Host::Managed::Jail < Safemode::Jail
596
550
  :host_collections, :pools, :hypervisor_host, :installed_debs,
597
551
  :installed_packages, :traces_helpers, :advisory_ids, :package_names_for_job_template,
598
552
  :filtered_entitlement_quantity_consumed, :bound_repositories,
599
- :single_content_view, :single_lifecycle_environment, :purpose_role, :purpose_usage, :release_version,
600
- :purpose_role_status_label, :purpose_usage_status_label
553
+ :single_content_view, :single_lifecycle_environment, :release_version
601
554
  end
602
555
 
603
556
  class ActiveRecord::Associations::CollectionProxy::Jail < Safemode::Jail
@@ -122,8 +122,10 @@ module Katello
122
122
  # it will return the value 2.
123
123
  facet_model = Facets.registered_facets[facet].hostgroup_configuration.model
124
124
  value = facet_model.where.not(attribute => nil).joins(:hostgroup).merge(
125
- ::Hostgroup.where(id: self.ancestor_ids).reorder(ancestry: :desc)
126
- ).limit(1).pluck(attribute).first
125
+ ::Hostgroup.where(id: self.ancestor_ids).reorder(
126
+ "#{::Hostgroup.table_name}.ancestry desc nulls last"
127
+ )
128
+ ).pick(attribute)
127
129
  end
128
130
  value
129
131
  end
@@ -79,7 +79,7 @@ module Katello
79
79
  end
80
80
 
81
81
  def redhat_account_number
82
- pools.upstream.pluck(:account_number).first
82
+ pools.upstream.pick(:account_number)
83
83
  end
84
84
 
85
85
  def active_pools_count
@@ -169,7 +169,7 @@ module Katello
169
169
 
170
170
  def orphaned
171
171
  if many_repository_associations
172
- where.not(:id => repository_association_class.select(unit_id_field))
172
+ left_joins(repository_association.to_sym).where("#{repository_association_class.table_name}.#{unit_id_field}" => nil)
173
173
  else
174
174
  where.not(:repository_id => ::Katello::Repository.select(:id))
175
175
  end
@@ -10,38 +10,15 @@ module Katello
10
10
  included do
11
11
  audited :associations => [:pools]
12
12
 
13
- SUBSCRIPTION_STATUS_MAP = {
14
- :valid => Katello::SubscriptionStatus::VALID,
15
- :partial => Katello::SubscriptionStatus::PARTIAL,
16
- :invalid => Katello::SubscriptionStatus::INVALID,
17
- :unknown => Katello::SubscriptionStatus::UNKNOWN,
18
- :disabled => Katello::SubscriptionStatus::DISABLED,
19
- :unsubscribed_hypervisor => Katello::SubscriptionStatus::UNSUBSCRIBED_HYPERVISOR
20
- }.freeze
21
-
22
13
  accepts_nested_attributes_for :subscription_facet, :update_only => true, :reject_if => lambda { |attrs| attrs.values.compact.empty? }
23
14
 
24
15
  has_many :activation_keys, :through => :subscription_facet
25
16
  has_many :pools, :through => :subscription_facet
26
17
  has_many :purpose_addons, :through => :subscription_facet
27
18
  has_many :subscriptions, :through => :pools
28
- has_one :subscription_status_object, :class_name => 'Katello::SubscriptionStatus', :foreign_key => 'host_id', :dependent => :destroy
29
- has_one :purpose_sla_status_object, :class_name => 'Katello::PurposeSlaStatus', :foreign_key => 'host_id', :dependent => :destroy
30
- has_one :purpose_role_status_object, :class_name => 'Katello::PurposeRoleStatus', :foreign_key => 'host_id', :dependent => :destroy
31
- has_one :purpose_usage_status_object, :class_name => 'Katello::PurposeUsageStatus', :foreign_key => 'host_id', :dependent => :destroy
32
- has_one :purpose_addons_status_object, :class_name => 'Katello::PurposeAddonsStatus', :foreign_key => 'host_id', :dependent => :destroy
33
- has_one :purpose_status_object, :class_name => 'Katello::PurposeStatus', :foreign_key => 'host_id', :dependent => :destroy
34
19
  has_one :rhel_lifecycle_status_object, :class_name => 'Katello::RhelLifecycleStatus', :foreign_key => 'host_id', :dependent => :destroy
35
20
  has_one :hypervisor_host, :through => :subscription_facet
36
21
 
37
- scoped_search :on => :status, :relation => :subscription_status_object, :rename => :subscription_status,
38
- :complete_value => SUBSCRIPTION_STATUS_MAP
39
-
40
- scoped_search on: :status, relation: :purpose_sla_status_object, rename: :sla_status, complete_value: purpose_status_map
41
- scoped_search on: :status, relation: :purpose_role_status_object, rename: :role_status, complete_value: purpose_status_map
42
- scoped_search on: :status, relation: :purpose_usage_status_object, rename: :usage_status, complete_value: purpose_status_map
43
- scoped_search on: :status, relation: :purpose_addons_status_object, rename: :addons_status, complete_value: purpose_status_map
44
- scoped_search on: :status, relation: :purpose_status_object, rename: :purpose_status, complete_value: purpose_status_map
45
22
  scoped_search on: :status, relation: :rhel_lifecycle_status_object, rename: :rhel_lifecycle_status, complete_value: rhel_lifecycle_status_map
46
23
 
47
24
  scoped_search :on => :release_version, :relation => :subscription_facet, :complete_value => true, :only_explicit => true
@@ -98,10 +75,6 @@ module Katello
98
75
  end
99
76
 
100
77
  module ClassMethods
101
- def purpose_status_map
102
- ::Katello::PurposeStatus.status_map
103
- end
104
-
105
78
  def rhel_lifecycle_status_map
106
79
  ::Katello::RhelLifecycleStatus.status_map
107
80
  end
@@ -18,6 +18,7 @@ module Katello
18
18
 
19
19
  has_many :content_view_versions, :class_name => "Katello::ContentViewVersion", :dependent => :destroy
20
20
  alias_method :versions, :content_view_versions
21
+ has_one :latest_version_object, -> { latest }, :class_name => "Katello::ContentViewVersion", :dependent => :destroy
21
22
  # Note the difference between content_view_components and component_composites both refer to
22
23
  # ContentViewComponent but mean different things.
23
24
  # content_view_components -> Topdown, given I am a composite CV get the associated components belonging to me
@@ -188,7 +189,7 @@ module Katello
188
189
  end
189
190
 
190
191
  def content_host_count
191
- hosts.count
192
+ hosts.size
192
193
  end
193
194
 
194
195
  def component_ids
@@ -341,10 +342,6 @@ module Katello
341
342
  latest_version_object.try(:environments) || []
342
343
  end
343
344
 
344
- def latest_version_object
345
- self.versions.order('major DESC').order('minor DESC').first
346
- end
347
-
348
345
  def last_task
349
346
  last_task_id = history.order(:created_at)&.last&.task_id
350
347
  last_task_id ? ForemanTasks::Task.find_by(id: last_task_id) : nil
@@ -611,6 +608,14 @@ module Katello
611
608
  :components => components
612
609
  )
613
610
 
611
+ # TODO: If a controller creates a new version and then uses latest_version_object, the old data is displayed.
612
+ # To prevent this, a 'reload' would currently be necessary, but this is not very performant.
613
+ # However, this is currently not a problem because after your create_new_version there is no immediate
614
+ # access to latest_version_object, but the ContentView object is first completely reloaded.
615
+ #
616
+ # In Rails 7.1, individual connections can be reloaded:
617
+ # https://www.shakacode.com/blog/rails-7-1-allows-resetting-singular-associations/
618
+
614
619
  update(:next_version => major.to_i + 1) unless major.to_i < next_version
615
620
  version
616
621
  end
@@ -735,7 +740,7 @@ module Katello
735
740
  end
736
741
 
737
742
  def version_count
738
- content_view_versions.count
743
+ content_view_versions.size
739
744
  end
740
745
 
741
746
  def on_demand_repositories
@@ -66,6 +66,8 @@ module Katello
66
66
  joins(:repositories).includes(:content_view).merge(repositories).distinct
67
67
  end
68
68
 
69
+ scope :latest, -> { order('major DESC', 'minor DESC').limit(1) }
70
+
69
71
  scoped_search :on => :content_view_id, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
70
72
  scoped_search :on => :major, :rename => :version, :complete_value => true, :ext_method => :find_by_version
71
73
  serialize :content_counts
@@ -10,6 +10,7 @@ module Katello
10
10
  :dependent => :destroy, :inverse_of => :deb
11
11
  has_many :content_facets, :through => :content_facet_applicable_debs, :class_name => "Katello::Host::ContentFacet"
12
12
 
13
+ scoped_search :on => :id, :complete_value => true
13
14
  scoped_search :on => :name, :complete_value => true
14
15
  scoped_search :on => :version, :complete_value => true
15
16
  scoped_search :on => :architecture, :complete_value => true
@@ -95,6 +96,13 @@ module Katello
95
96
  where("#{Katello::Host::ContentFacet.table_name}.host_id" => hosts).distinct
96
97
  end
97
98
 
99
+ # Return deb packages that are not installed on a host, but could be installed
100
+ # the word 'installable' has a different meaning here than elsewhere
101
+ def self.apt_installable_for_host(host)
102
+ repos = host.content_facet.bound_repositories.pluck(:id)
103
+ Katello::Deb.in_repositories(repos).where.not(name: host.installed_debs.pluck(:name)).order(:name)
104
+ end
105
+
98
106
  def self.latest(_relation)
99
107
  fail 'NotImplemented'
100
108
  end
@@ -8,6 +8,9 @@ module Katello
8
8
  HOST_TOOLS_PACKAGE_NAME = 'katello-host-tools'.freeze
9
9
  HOST_TOOLS_TRACER_PACKAGE_NAME = 'katello-host-tools-tracer'.freeze
10
10
  SUBSCRIPTION_MANAGER_PACKAGE_NAME = 'subscription-manager'.freeze
11
+ ALL_HOST_TOOLS_PACKAGE_NAMES = [ "python-#{HOST_TOOLS_PACKAGE_NAME}",
12
+ "python3-#{HOST_TOOLS_PACKAGE_NAME}",
13
+ HOST_TOOLS_PACKAGE_NAME ].freeze
11
14
  ALL_TRACER_PACKAGE_NAMES = [ "python-#{HOST_TOOLS_TRACER_PACKAGE_NAME}",
12
15
  "python3-#{HOST_TOOLS_TRACER_PACKAGE_NAME}",
13
16
  HOST_TOOLS_TRACER_PACKAGE_NAME ].freeze
@@ -181,12 +184,14 @@ module Katello
181
184
  }
182
185
  installable_hash[:total] = installable_hash.values.inject(:+)
183
186
  # same for applicable, but we need to get the counts from the db
187
+ applicable_errata_counts = applicable_errata.pluck(:errata_type).tally
184
188
  applicable_hash = {
185
- :security => applicable_errata.security.count,
186
- :bugfix => applicable_errata.bugfix.count,
187
- :enhancement => applicable_errata.enhancement.count
189
+ :bugfix => applicable_errata_counts.values_at(*Katello::Erratum::BUGZILLA).compact.sum,
190
+ :security => applicable_errata_counts.values_at(*Katello::Erratum::SECURITY).compact.sum,
191
+ :enhancement => applicable_errata_counts.values_at(*Katello::Erratum::ENHANCEMENT).compact.sum
188
192
  }
189
- applicable_hash[:total] = applicable_hash.values.inject(:+)
193
+ applicable_hash[:total] = applicable_errata_counts.values.sum
194
+
190
195
  # keeping installable at the top level for backward compatibility
191
196
  installable_hash.merge({
192
197
  :applicable => applicable_hash
@@ -307,22 +312,22 @@ module Katello
307
312
  end
308
313
  end
309
314
 
310
- def tracer_installed?
311
- self.host.installed_packages.where("#{Katello::InstalledPackage.table_name}.name" => ALL_TRACER_PACKAGE_NAMES).any? ||
312
- self.host.installed_debs.where("#{Katello::InstalledDeb.table_name}.name" => ALL_TRACER_PACKAGE_NAMES).any?
315
+ def tracer_installed?(force_update_cache: false)
316
+ Rails.cache.fetch("#{self.host.id}/tracer_installed", expires_in: 7.days, force: force_update_cache) do
317
+ self.host.installed_packages.where("#{Katello::InstalledPackage.table_name}.name" => ALL_TRACER_PACKAGE_NAMES).any? ||
318
+ self.host.installed_debs.where("#{Katello::InstalledDeb.table_name}.name" => ALL_TRACER_PACKAGE_NAMES).any?
319
+ end
313
320
  end
314
321
 
315
322
  def tracer_rpm_available?
316
323
  ::Katello::Rpm.yum_installable_for_host(self.host).where(name: ALL_TRACER_PACKAGE_NAMES).any?
317
324
  end
318
325
 
319
- def host_tools_installed?
320
- host.installed_packages.where("#{Katello::InstalledPackage.table_name}.name" => [ "python-#{HOST_TOOLS_PACKAGE_NAME}",
321
- "python3-#{HOST_TOOLS_PACKAGE_NAME}",
322
- HOST_TOOLS_PACKAGE_NAME ]).any? ||
323
- host.installed_debs.where("#{Katello::InstalledDeb.table_name}.name" => [ "python-#{HOST_TOOLS_PACKAGE_NAME}",
324
- "python3-#{HOST_TOOLS_PACKAGE_NAME}",
325
- HOST_TOOLS_PACKAGE_NAME ]).any?
326
+ def host_tools_installed?(force_update_cache: false)
327
+ Rails.cache.fetch("#{self.host.id}/host_tools_installed", expires_in: 7.days, force: force_update_cache) do
328
+ self.host.installed_packages.where("#{Katello::InstalledPackage.table_name}.name" => ALL_HOST_TOOLS_PACKAGE_NAMES).any? ||
329
+ self.host.installed_debs.where("#{Katello::InstalledDeb.table_name}.name" => ALL_HOST_TOOLS_PACKAGE_NAMES).any?
330
+ end
326
331
  end
327
332
 
328
333
  def update_errata_status