katello 4.13.1 → 4.14.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 (386) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/katello/hosts/host_and_hostgroup_edit.js +12 -8
  3. data/app/assets/javascripts/katello/locale/bn/katello.js +274 -22
  4. data/app/assets/javascripts/katello/locale/bn_IN/katello.js +274 -22
  5. data/app/assets/javascripts/katello/locale/ca/katello.js +274 -22
  6. data/app/assets/javascripts/katello/locale/cs/katello.js +274 -22
  7. data/app/assets/javascripts/katello/locale/cs_CZ/katello.js +275 -23
  8. data/app/assets/javascripts/katello/locale/de/katello.js +280 -28
  9. data/app/assets/javascripts/katello/locale/de_AT/katello.js +274 -22
  10. data/app/assets/javascripts/katello/locale/de_DE/katello.js +274 -22
  11. data/app/assets/javascripts/katello/locale/el/katello.js +274 -22
  12. data/app/assets/javascripts/katello/locale/en/katello.js +274 -22
  13. data/app/assets/javascripts/katello/locale/en_GB/katello.js +274 -22
  14. data/app/assets/javascripts/katello/locale/en_US/katello.js +274 -22
  15. data/app/assets/javascripts/katello/locale/es/katello.js +276 -24
  16. data/app/assets/javascripts/katello/locale/et_EE/katello.js +274 -22
  17. data/app/assets/javascripts/katello/locale/fr/katello.js +283 -31
  18. data/app/assets/javascripts/katello/locale/gl/katello.js +274 -22
  19. data/app/assets/javascripts/katello/locale/gu/katello.js +274 -22
  20. data/app/assets/javascripts/katello/locale/he_IL/katello.js +274 -22
  21. data/app/assets/javascripts/katello/locale/hi/katello.js +274 -22
  22. data/app/assets/javascripts/katello/locale/id/katello.js +274 -22
  23. data/app/assets/javascripts/katello/locale/it/katello.js +274 -22
  24. data/app/assets/javascripts/katello/locale/ja/katello.js +283 -31
  25. data/app/assets/javascripts/katello/locale/ka/katello.js +280 -28
  26. data/app/assets/javascripts/katello/locale/kn/katello.js +274 -22
  27. data/app/assets/javascripts/katello/locale/ko/katello.js +274 -22
  28. data/app/assets/javascripts/katello/locale/ml_IN/katello.js +274 -22
  29. data/app/assets/javascripts/katello/locale/mr/katello.js +274 -22
  30. data/app/assets/javascripts/katello/locale/nl_NL/katello.js +274 -22
  31. data/app/assets/javascripts/katello/locale/or/katello.js +274 -22
  32. data/app/assets/javascripts/katello/locale/pa/katello.js +274 -22
  33. data/app/assets/javascripts/katello/locale/pl/katello.js +274 -22
  34. data/app/assets/javascripts/katello/locale/pl_PL/katello.js +274 -22
  35. data/app/assets/javascripts/katello/locale/pt/katello.js +274 -22
  36. data/app/assets/javascripts/katello/locale/pt_BR/katello.js +276 -24
  37. data/app/assets/javascripts/katello/locale/ro/katello.js +274 -22
  38. data/app/assets/javascripts/katello/locale/ro_RO/katello.js +274 -22
  39. data/app/assets/javascripts/katello/locale/ru/katello.js +274 -22
  40. data/app/assets/javascripts/katello/locale/sl/katello.js +274 -22
  41. data/app/assets/javascripts/katello/locale/sv_SE/katello.js +274 -22
  42. data/app/assets/javascripts/katello/locale/ta/katello.js +274 -22
  43. data/app/assets/javascripts/katello/locale/ta_IN/katello.js +274 -22
  44. data/app/assets/javascripts/katello/locale/te/katello.js +274 -22
  45. data/app/assets/javascripts/katello/locale/tr/katello.js +274 -22
  46. data/app/assets/javascripts/katello/locale/vi/katello.js +274 -22
  47. data/app/assets/javascripts/katello/locale/vi_VN/katello.js +274 -22
  48. data/app/assets/javascripts/katello/locale/zh/katello.js +274 -22
  49. data/app/assets/javascripts/katello/locale/zh_CN/katello.js +283 -31
  50. data/app/assets/javascripts/katello/locale/zh_TW/katello.js +274 -22
  51. data/app/controllers/katello/api/registry/registry_proxies_controller.rb +118 -74
  52. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +15 -10
  53. data/app/controllers/katello/api/v2/activation_keys_controller.rb +1 -1
  54. data/app/controllers/katello/api/v2/api_controller.rb +7 -0
  55. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +4 -4
  56. data/app/controllers/katello/api/v2/debs_controller.rb +3 -2
  57. data/app/controllers/katello/api/v2/environments_controller.rb +2 -4
  58. data/app/controllers/katello/api/v2/host_contents_controller.rb +8 -3
  59. data/app/controllers/katello/api/v2/host_errata_controller.rb +4 -4
  60. data/app/controllers/katello/api/v2/host_packages_controller.rb +2 -2
  61. data/app/controllers/katello/api/v2/organizations_controller.rb +1 -1
  62. data/app/controllers/katello/api/v2/packages_controller.rb +13 -3
  63. data/app/controllers/katello/api/v2/repositories_bulk_actions_controller.rb +6 -2
  64. data/app/controllers/katello/api/v2/repositories_controller.rb +3 -4
  65. data/app/controllers/katello/api/v2/repository_sets_controller.rb +13 -14
  66. data/app/controllers/katello/api/v2/subscriptions_controller.rb +15 -9
  67. data/app/controllers/katello/api/v2/sync_controller.rb +2 -2
  68. data/app/controllers/katello/application_controller.rb +1 -1
  69. data/app/controllers/katello/concerns/api/v2/authorization.rb +3 -2
  70. data/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb +28 -0
  71. data/app/controllers/katello/concerns/api/v2/registration_commands_controller_extensions.rb +1 -1
  72. data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +4 -3
  73. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +2 -4
  74. data/app/controllers/katello/remote_execution_controller.rb +53 -58
  75. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +19 -2
  76. data/app/helpers/katello/katello_urls_helper.rb +1 -1
  77. data/app/lib/actions/katello/alternate_content_source/alternate_content_source_common.rb +1 -1
  78. data/app/lib/actions/katello/alternate_content_source/update.rb +2 -1
  79. data/app/lib/actions/katello/capsule_content/verify_checksum.rb +1 -2
  80. data/app/lib/actions/katello/content_view/publish.rb +1 -0
  81. data/app/lib/actions/katello/content_view_version/create_repos.rb +1 -0
  82. data/app/lib/actions/katello/content_view_version/incremental_update.rb +3 -2
  83. data/app/lib/actions/katello/environment/{publish_repositories.rb → publish_container_repositories.rb} +10 -8
  84. data/app/lib/actions/katello/foreman/content_update.rb +4 -6
  85. data/app/lib/actions/katello/host/hypervisors_update.rb +6 -4
  86. data/app/lib/actions/katello/repository/create.rb +4 -4
  87. data/app/lib/actions/katello/repository/import_upload.rb +4 -6
  88. data/app/lib/actions/katello/repository/metadata_generate.rb +1 -0
  89. data/app/lib/actions/katello/repository/update.rb +3 -3
  90. data/app/lib/actions/katello/repository_set/enable_repository.rb +5 -6
  91. data/app/lib/actions/middleware/backend_services_check.rb +3 -2
  92. data/app/lib/actions/pulp3/abstract_async_task.rb +2 -4
  93. data/app/lib/actions/pulp3/capsule_content/verify_checksum.rb +1 -2
  94. data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +5 -1
  95. data/app/lib/actions/pulp3/orchestration/repository/delete.rb +5 -2
  96. data/app/lib/actions/pulp3/repository/save_version.rb +3 -5
  97. data/app/lib/katello/concerns/base_template_scope_extensions.rb +5 -9
  98. data/app/lib/katello/errors.rb +1 -0
  99. data/app/lib/katello/http_resource.rb +1 -0
  100. data/app/lib/katello/lazy_accessor.rb +1 -1
  101. data/app/lib/katello/resources/candlepin/candlepin_ping.rb +0 -5
  102. data/app/lib/katello/resources/candlepin/owner.rb +1 -1
  103. data/app/lib/katello/resources/candlepin/pool.rb +1 -2
  104. data/app/lib/katello/resources/candlepin/upstream_job.rb +1 -1
  105. data/app/lib/katello/resources/cdn.rb +3 -2
  106. data/app/lib/katello/resources/discovery/yum.rb +3 -3
  107. data/app/lib/katello/util/cdn_var_substitutor.rb +5 -3
  108. data/app/lib/katello/util/data.rb +3 -2
  109. data/app/lib/katello/util/errata.rb +4 -3
  110. data/app/lib/katello/util/package.rb +3 -3
  111. data/app/lib/katello/util/path_with_substitutions.rb +1 -1
  112. data/app/lib/katello/util/report_table.rb +3 -2
  113. data/app/lib/katello/util/url_matcher.rb +1 -1
  114. data/app/lib/katello/validators/alternate_content_source_path_validator.rb +4 -3
  115. data/app/lib/katello/validators/alternate_content_source_products_validator.rb +5 -7
  116. data/app/lib/katello/validators/container_image_name_validator.rb +1 -1
  117. data/app/lib/katello/validators/katello_name_format_validator.rb +2 -2
  118. data/app/lib/katello/validators/no_trailing_space_validator.rb +2 -2
  119. data/app/lib/katello/validators/prior_validator.rb +2 -2
  120. data/app/lib/katello/validators/product_unique_attribute_validator.rb +2 -4
  121. data/app/models/katello/activation_key.rb +4 -6
  122. data/app/models/katello/alternate_content_source.rb +1 -1
  123. data/app/models/katello/authorization/host_tracer.rb +1 -2
  124. data/app/models/katello/candlepin/repository_mapper.rb +2 -2
  125. data/app/models/katello/concerns/host_managed_extensions.rb +41 -10
  126. data/app/models/katello/concerns/hostgroup_extensions.rb +2 -4
  127. data/app/models/katello/concerns/location_extensions.rb +2 -4
  128. data/app/models/katello/concerns/operatingsystem_extensions.rb +84 -16
  129. data/app/models/katello/concerns/smart_proxy_extensions.rb +4 -4
  130. data/app/models/katello/concerns/subscription_facet_host_extensions.rb +2 -0
  131. data/app/models/katello/content_view.rb +5 -1
  132. data/app/models/katello/content_view_environment.rb +19 -4
  133. data/app/models/katello/content_view_environment_content_facet.rb +11 -0
  134. data/app/models/katello/erratum.rb +1 -1
  135. data/app/models/katello/event.rb +1 -1
  136. data/app/models/katello/glue/provider.rb +1 -2
  137. data/app/models/katello/hash_util.rb +1 -1
  138. data/app/models/katello/host/content_facet.rb +16 -3
  139. data/app/models/katello/host/subscription_facet.rb +27 -4
  140. data/app/models/katello/host_collection.rb +12 -8
  141. data/app/models/katello/pool.rb +5 -1
  142. data/app/models/katello/product.rb +7 -4
  143. data/app/models/katello/provider.rb +1 -2
  144. data/app/models/katello/repository.rb +18 -4
  145. data/app/models/katello/root_repository.rb +19 -0
  146. data/app/models/katello/rpm.rb +2 -2
  147. data/app/models/katello/subscription_facet_pool.rb +1 -1
  148. data/app/models/katello/sync_plan.rb +5 -4
  149. data/app/models/katello/task_status.rb +18 -18
  150. data/app/presenters/katello/product_host_count_presenter.rb +10 -0
  151. data/app/services/katello/candlepin/consumer.rb +11 -11
  152. data/app/services/katello/candlepin/message_handler.rb +3 -2
  153. data/app/services/katello/content_unit_indexer.rb +6 -0
  154. data/app/services/katello/pulp3/alternate_content_source.rb +1 -3
  155. data/app/services/katello/pulp3/api/core.rb +1 -1
  156. data/app/services/katello/pulp3/api/docker.rb +10 -0
  157. data/app/services/katello/pulp3/content_view_version/export.rb +1 -0
  158. data/app/services/katello/pulp3/content_view_version/import.rb +6 -4
  159. data/app/services/katello/pulp3/content_view_version/importable_products.rb +1 -3
  160. data/app/services/katello/pulp3/repository/apt.rb +4 -16
  161. data/app/services/katello/pulp3/repository/yum.rb +9 -5
  162. data/app/services/katello/pulp3/repository.rb +2 -2
  163. data/app/services/katello/pulp3/repository_mirror.rb +2 -9
  164. data/app/services/katello/pulp3/task.rb +4 -2
  165. data/app/services/katello/registration_manager.rb +13 -3
  166. data/app/services/katello/smart_proxy_helper.rb +1 -0
  167. data/app/views/dashboard/_host_collection_widget.html.erb +5 -4
  168. data/app/views/foreman/job_templates/install_errata.erb +2 -0
  169. data/app/views/foreman/job_templates/install_errata_-_katello_ansible_default.erb +2 -0
  170. data/app/views/foreman/job_templates/install_errata_by_search_query.erb +2 -0
  171. data/app/views/foreman/job_templates/install_errata_by_search_query_-_katello_ansible_default.erb +3 -1
  172. data/app/views/foreman/job_templates/install_packages_by_search_query_-_katello_ansible_default.erb +1 -1
  173. data/app/views/foreman/job_templates/remove_packages_by_search_query_-_katello_ansible_default.erb +2 -2
  174. data/app/views/foreman/job_templates/resolve_traces.erb +5 -1
  175. data/app/views/foreman/job_templates/update_packages_by_search_query_-_katello_ansible_default.erb +1 -1
  176. data/app/views/foreman/job_templates/upload_profile.erb +2 -0
  177. data/app/views/foreman/smart_proxies/_reclaim_space.html.erb +7 -5
  178. data/app/views/katello/api/v2/content_facet/base.json.rabl +18 -2
  179. data/app/views/katello/api/v2/packages/thindex.json.rabl +6 -0
  180. data/app/views/katello/api/v2/repositories/show.json.rabl +8 -8
  181. data/app/views/katello/api/v2/repository_sets/show.json.rabl +1 -1
  182. data/app/views/katello/api/v2/subscription_facet/base.json.rabl +1 -1
  183. data/app/views/katello/api/v2/subscriptions/index.json.rabl +1 -0
  184. data/app/views/katello/api/v2/subscriptions/show.json.rabl +1 -0
  185. data/app/views/overrides/activation_keys/_host_environment_select.html.erb +14 -11
  186. data/app/views/overrides/activation_keys/_host_synced_content_select.html.erb +4 -4
  187. data/config/routes/api/v2.rb +3 -1
  188. data/config/routes.rb +1 -3
  189. data/db/migrate/20160114200145_add_mirror_on_sync_to_repositories.rb +1 -0
  190. data/db/migrate/20160131182301_add_download_policy_to_katello_repositories.rb +1 -0
  191. data/db/migrate/20210119162528_delete_puppet_and_ostree_repos.rb +3 -0
  192. data/db/migrate/20240522165308_add_priority_to_content_view_environment_content_facet.rb +5 -0
  193. data/db/migrate/20240621121212_katello_repository_debs_id_bigint.rb +6 -0
  194. data/db/migrate/20240729192228_add_convert2rhel_to_host_facets.rb +9 -0
  195. data/db/seeds.d/102-organizations.rb +5 -7
  196. data/db/seeds.d/150-module_job_templates.rb +7 -9
  197. data/db/seeds.d/75-job_templates.rb +9 -16
  198. data/engines/bastion_katello/README.md +3 -0
  199. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-errata.controller.js +3 -3
  200. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/debs/details/views/deb-info.html +6 -6
  201. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/views/erratum-content-hosts.html +2 -2
  202. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +4 -4
  203. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/details/views/package-info.html +6 -6
  204. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +28 -27
  205. data/engines/bastion_katello/lib/bastion_katello/engine.rb +2 -2
  206. data/lib/katello/engine.rb +1 -8
  207. data/lib/katello/permission_creator.rb +3 -2
  208. data/lib/katello/plugin.rb +31 -27
  209. data/lib/katello/tasks/clean_old_file_repos.rake +2 -4
  210. data/lib/katello/tasks/reset.rake +3 -4
  211. data/lib/katello/version.rb +1 -1
  212. data/lib/katello.rb +0 -2
  213. data/lib/monkeys/ar_postgres_evr_t.rb +2 -0
  214. data/locale/action_names.rb +1 -1
  215. data/locale/bn/LC_MESSAGES/katello.mo +0 -0
  216. data/locale/bn/katello.po +274 -22
  217. data/locale/bn_IN/katello.po +274 -22
  218. data/locale/ca/katello.po +274 -22
  219. data/locale/cs/katello.po +274 -22
  220. data/locale/cs_CZ/LC_MESSAGES/katello.mo +0 -0
  221. data/locale/cs_CZ/katello.po +275 -23
  222. data/locale/de/LC_MESSAGES/katello.mo +0 -0
  223. data/locale/de/katello.po +280 -28
  224. data/locale/de_AT/katello.po +274 -22
  225. data/locale/de_DE/katello.po +274 -22
  226. data/locale/el/katello.po +274 -22
  227. data/locale/en/katello.po +274 -22
  228. data/locale/en_GB/katello.po +274 -22
  229. data/locale/en_US/katello.po +274 -22
  230. data/locale/es/LC_MESSAGES/katello.mo +0 -0
  231. data/locale/es/katello.po +276 -24
  232. data/locale/et_EE/katello.po +274 -22
  233. data/locale/fr/LC_MESSAGES/katello.mo +0 -0
  234. data/locale/fr/katello.po +283 -31
  235. data/locale/gl/katello.po +274 -22
  236. data/locale/gu/katello.po +274 -22
  237. data/locale/he_IL/katello.po +274 -22
  238. data/locale/hi/katello.po +274 -22
  239. data/locale/id/katello.po +274 -22
  240. data/locale/it/LC_MESSAGES/katello.mo +0 -0
  241. data/locale/it/katello.po +274 -22
  242. data/locale/ja/LC_MESSAGES/katello.mo +0 -0
  243. data/locale/ja/katello.po +283 -31
  244. data/locale/ka/LC_MESSAGES/katello.mo +0 -0
  245. data/locale/ka/katello.po +280 -28
  246. data/locale/katello.pot +1001 -527
  247. data/locale/kn/katello.po +274 -22
  248. data/locale/ko/LC_MESSAGES/katello.mo +0 -0
  249. data/locale/ko/katello.po +274 -22
  250. data/locale/ml_IN/katello.po +274 -22
  251. data/locale/mr/katello.po +274 -22
  252. data/locale/nl_NL/katello.po +274 -22
  253. data/locale/or/katello.po +274 -22
  254. data/locale/pa/katello.po +274 -22
  255. data/locale/pl/katello.po +274 -22
  256. data/locale/pl_PL/katello.po +274 -22
  257. data/locale/pt/katello.po +274 -22
  258. data/locale/pt_BR/LC_MESSAGES/katello.mo +0 -0
  259. data/locale/pt_BR/katello.po +276 -24
  260. data/locale/ro/katello.po +274 -22
  261. data/locale/ro_RO/katello.po +274 -22
  262. data/locale/ru/LC_MESSAGES/katello.mo +0 -0
  263. data/locale/ru/katello.po +274 -22
  264. data/locale/sl/katello.po +274 -22
  265. data/locale/sv_SE/katello.po +274 -22
  266. data/locale/ta/LC_MESSAGES/katello.mo +0 -0
  267. data/locale/ta/katello.po +274 -22
  268. data/locale/ta_IN/katello.po +274 -22
  269. data/locale/te/katello.po +274 -22
  270. data/locale/tr/katello.po +274 -22
  271. data/locale/vi/katello.po +274 -22
  272. data/locale/vi_VN/katello.po +274 -22
  273. data/locale/zh/katello.po +274 -22
  274. data/locale/zh_CN/LC_MESSAGES/katello.mo +0 -0
  275. data/locale/zh_CN/katello.po +283 -31
  276. data/locale/zh_TW/LC_MESSAGES/katello.mo +0 -0
  277. data/locale/zh_TW/katello.po +274 -22
  278. data/webpack/ForemanColumnExtensions/index.js +44 -1
  279. data/webpack/components/Table/TableWrapper.js +6 -0
  280. data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard/ChangeHostCVModal.js +24 -3
  281. data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard/ContentViewDetailsCard.js +124 -56
  282. data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard/HostContentViewActions.js +2 -3
  283. data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard/__tests__/contentViewDetailsCard.test.js +44 -10
  284. data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionActions.js +75 -31
  285. data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionConstants.js +1 -0
  286. data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionHooks.js +1 -1
  287. data/webpack/components/extensions/HostDetails/Tabs/customizedRexUrlHelpers.js +22 -7
  288. data/webpack/components/extensions/Hosts/ActionsBar/ActionsBar.scss +14 -0
  289. data/webpack/components/extensions/Hosts/ActionsBar/index.js +82 -23
  290. data/webpack/components/extensions/Hosts/BulkActions/BulkChangeHostCVModal/index.js +5 -2
  291. data/webpack/components/extensions/Hosts/BulkActions/BulkErrataWizard/02_BulkErrataTable.js +171 -0
  292. data/webpack/components/extensions/Hosts/BulkActions/BulkErrataWizard/04_Review.js +160 -0
  293. data/webpack/components/extensions/Hosts/BulkActions/BulkErrataWizard/04_ReviewFooter.js +99 -0
  294. data/webpack/components/extensions/Hosts/BulkActions/BulkErrataWizard/BulkErrataWizard.js +157 -0
  295. data/webpack/components/extensions/Hosts/BulkActions/BulkErrataWizard/index.js +24 -0
  296. data/webpack/components/extensions/Hosts/BulkActions/BulkPackagesWizard/02_BulkPackagesTable.js +157 -0
  297. data/webpack/components/extensions/Hosts/BulkActions/BulkPackagesWizard/04_Review.js +168 -0
  298. data/webpack/components/extensions/Hosts/BulkActions/BulkPackagesWizard/04_ReviewFooter.js +141 -0
  299. data/webpack/components/extensions/Hosts/BulkActions/BulkPackagesWizard/BulkPackagesWizard.js +252 -0
  300. data/webpack/components/extensions/Hosts/BulkActions/BulkPackagesWizard/index.js +24 -0
  301. data/webpack/components/extensions/Hosts/BulkActions/HostReview.js +176 -0
  302. data/webpack/components/extensions/Hosts/TableRowActions/index.js +17 -0
  303. data/webpack/global_index.js +11 -3
  304. data/webpack/redux/actions/RedHatRepositories/repositorySetRepositories.js +5 -6
  305. data/webpack/redux/reducers/RedHatRepositories/__tests__/repositorySetRepositories.test.js +1 -1
  306. data/webpack/redux/reducers/RedHatRepositories/repositorySetRepositories.js +1 -1
  307. data/webpack/scenes/ContentViews/Copy/CopyContentViewModal.js +2 -1
  308. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentContentViewAddModal.js +2 -1
  309. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentContentViewBulkAddModal.js +2 -1
  310. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ContentViewComponents.js +2 -1
  311. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +2 -1
  312. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +2 -2
  313. data/webpack/scenes/ContentViews/Publish/CVPublishForm.js +2 -1
  314. data/webpack/scenes/ContentViews/Publish/CVPublishReview.js +3 -2
  315. data/webpack/scenes/ContentViews/Publish/PublishContentViewWizard.js +2 -1
  316. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +2 -1
  317. data/webpack/scenes/ContentViews/components/CVBreadCrumb.js +2 -1
  318. data/webpack/scenes/ContentViews/components/ContentViewSelect/ContentViewSelectOption.js +2 -2
  319. data/webpack/scenes/Subscriptions/Details/SubscriptionAttributes.js +1 -0
  320. data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailInfo.test.js.snap +10 -0
  321. data/webpack/scenes/Subscriptions/SubscriptionConstants.js +6 -0
  322. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +2 -0
  323. data/webpack/scenes/Subscriptions/__tests__/subscriptions.fixtures.js +14 -0
  324. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableHelpers.js +1 -0
  325. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableSchema.js +10 -0
  326. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.fixtures.js +1 -0
  327. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/__snapshots__/SubscriptionsToolbar.test.js.snap +10 -0
  328. data/webpack/scenes/Tasks/helpers.js +1 -1
  329. metadata +24 -63
  330. data/app/assets/javascripts/katello/containers/container.js +0 -304
  331. data/app/lib/katello/util/http_helper.rb +0 -15
  332. data/app/models/732bd3db9f64c621c64d2be4f2a838727aac0845.patch +0 -61
  333. data/app/models/katello/repository.rb.bak +0 -978
  334. data/app/services/katello/pulp3/content_view_version/import_validator.rb.bak +0 -166
  335. data/app/services/katello/pulp3/content_view_version/importable_repositories.rb.bak +0 -164
  336. data/lib/katello/tasks/update_repository_expiry.rake +0 -114
  337. data/locale/bn/katello.po.time_stamp +0 -0
  338. data/locale/bn_IN/katello.po.time_stamp +0 -0
  339. data/locale/ca/katello.po.time_stamp +0 -0
  340. data/locale/cs/katello.po.time_stamp +0 -0
  341. data/locale/cs_CZ/katello.po.time_stamp +0 -0
  342. data/locale/de/katello.po.time_stamp +0 -0
  343. data/locale/de_AT/katello.po.time_stamp +0 -0
  344. data/locale/de_DE/katello.po.time_stamp +0 -0
  345. data/locale/el/katello.po.time_stamp +0 -0
  346. data/locale/en/katello.po.time_stamp +0 -0
  347. data/locale/en_GB/katello.po.time_stamp +0 -0
  348. data/locale/en_US/katello.po.time_stamp +0 -0
  349. data/locale/es/katello.po.time_stamp +0 -0
  350. data/locale/et_EE/katello.po.time_stamp +0 -0
  351. data/locale/fr/katello.po.time_stamp +0 -0
  352. data/locale/gl/katello.po.time_stamp +0 -0
  353. data/locale/gu/katello.po.time_stamp +0 -0
  354. data/locale/he_IL/katello.po.time_stamp +0 -0
  355. data/locale/hi/katello.po.time_stamp +0 -0
  356. data/locale/id/katello.po.time_stamp +0 -0
  357. data/locale/it/katello.po.time_stamp +0 -0
  358. data/locale/ja/katello.po.time_stamp +0 -0
  359. data/locale/ka/katello.po.time_stamp +0 -0
  360. data/locale/kn/katello.po.time_stamp +0 -0
  361. data/locale/ko/katello.po.time_stamp +0 -0
  362. data/locale/ml_IN/katello.po.time_stamp +0 -0
  363. data/locale/mr/katello.po.time_stamp +0 -0
  364. data/locale/nl_NL/katello.po.time_stamp +0 -0
  365. data/locale/or/katello.po.time_stamp +0 -0
  366. data/locale/pa/katello.po.time_stamp +0 -0
  367. data/locale/pl/katello.po.time_stamp +0 -0
  368. data/locale/pl_PL/katello.po.time_stamp +0 -0
  369. data/locale/pt/katello.po.time_stamp +0 -0
  370. data/locale/pt_BR/katello.po.time_stamp +0 -0
  371. data/locale/ro/katello.po.time_stamp +0 -0
  372. data/locale/ro_RO/katello.po.time_stamp +0 -0
  373. data/locale/ru/katello.po.time_stamp +0 -0
  374. data/locale/sl/katello.po.time_stamp +0 -0
  375. data/locale/sv_SE/katello.po.time_stamp +0 -0
  376. data/locale/ta/katello.po.time_stamp +0 -0
  377. data/locale/ta_IN/katello.po.time_stamp +0 -0
  378. data/locale/te/katello.po.time_stamp +0 -0
  379. data/locale/tr/katello.po.time_stamp +0 -0
  380. data/locale/vi/katello.po.time_stamp +0 -0
  381. data/locale/vi_VN/katello.po.time_stamp +0 -0
  382. data/locale/zh/katello.po.time_stamp +0 -0
  383. data/locale/zh_CN/katello.po.time_stamp +0 -0
  384. data/locale/zh_TW/katello.po.time_stamp +0 -0
  385. data/webpack/global_test_setup.js.bak +0 -59
  386. data/webpack/utils/useKatelloDocUrl.js +0 -18
@@ -85,7 +85,7 @@ module Katello
85
85
  end
86
86
 
87
87
  included do
88
- prepend ::ForemanRemoteExecution::HostExtensions if ::Katello.with_remote_execution?
88
+ prepend ::ForemanRemoteExecution::HostExtensions
89
89
  prepend Overrides
90
90
 
91
91
  delegate :content_source_id, :single_content_view, :single_lifecycle_environment, :default_environment?, :single_content_view_environment?, :multi_content_view_environment?, :kickstart_repository_id, :bound_repositories,
@@ -480,8 +480,10 @@ module Katello
480
480
 
481
481
  def rhel_eos_schedule_index
482
482
  return nil unless probably_rhel?
483
- major = operatingsystem.major
483
+ major = operatingsystem&.major
484
+ return nil unless major
484
485
  return "RHEL#{major}" unless major == "7"
486
+
485
487
  arch_name = architecture&.name
486
488
  case arch_name
487
489
  when "ppc64le"
@@ -503,53 +505,82 @@ module Katello
503
505
  end
504
506
  end
505
507
 
508
+ # rubocop:disable Metrics/CyclomaticComplexity
509
+ # rubocop:disable Metrics/MethodLength
506
510
  def yum_names_for_job_template(action:, search:, versions: nil)
507
511
  actions = %w(install remove update).freeze
508
512
  case action
509
513
  when 'install'
510
- ::Katello::Rpm.yum_installable_for_host(self).search_for(search).distinct.pluck(:name)
514
+ yum_installable = ::Katello::Rpm.yum_installable_for_host(self).search_for(search).distinct.pluck(:name)
515
+ if yum_installable.empty?
516
+ fail N_("No available packages found for search term '%s'. Check the host's content view environments and already-installed packages.") % search
517
+ end
518
+ yum_installable
511
519
  when 'remove'
512
520
  return [] if search.empty?
513
521
 
514
- installed_packages.search_for(search).distinct.pluck(:name)
522
+ yum_removable = installed_packages.search_for(search).distinct.pluck(:name)
523
+ if yum_removable.empty?
524
+ fail N_("Cannot remove package(s): This host does not have any installed packages matching the search term '%s'.") % search
525
+ end
526
+ yum_removable
515
527
  when 'update'
516
528
  return [] if search.empty?
517
529
 
518
530
  versions_by_name_arch = {}
519
531
  if versions.present?
520
532
  JSON.parse(versions).each do |nvra|
521
- nvra =~ /([^\.]*)-[-\.\w]*\.(\w+)/
533
+ nvra =~ /([^.]*)-[-.\w]*\.(\w+)/
522
534
  versions_by_name_arch[[Regexp.last_match(1), Regexp.last_match(2)]] = nvra
523
535
  end
524
536
  end
525
537
  pkg_name_archs = installed_packages.search_for(search).distinct.pluck(:name, :arch)
538
+ if pkg_name_archs.empty?
539
+ fail _("Cannot upgrade packages: No installed packages found for search term '%s'") % search
540
+ end
526
541
  upgrades = ::Katello::Rpm.installable_for_hosts([self]).select(:id, :name, :arch, :nvra, :evr).order(evr: :desc).group_by { |i| [i.name, i.arch] }
527
- pkg_name_archs.map { |name, arch| versions_by_name_arch[[name, arch]] || upgrades[[name, arch]]&.first&.nvra }.compact
542
+ result = pkg_name_archs.map { |name, arch| versions_by_name_arch[[name, arch]] || upgrades[[name, arch]]&.first&.nvra }.compact
543
+ if result.empty?
544
+ fail _("No upgradable packages found for search term '%s'. The host may already have the latest version(s) installed.") % search
545
+ end
546
+ result
528
547
  else
529
548
  fail ::Foreman::Exception.new(N_("package_names_for_job_template: Action must be one of %s"), actions.join(', '))
530
549
  end
531
550
  end
551
+ # rubocop:enable Metrics/CyclomaticComplexity
532
552
 
533
553
  def deb_names_for_job_template(action:, search:)
534
554
  actions = %w(install remove update).freeze
535
555
  case action
536
556
  when 'install'
537
- ::Katello::Deb.apt_installable_for_host(self).search_for(search).distinct.pluck(:name)
557
+ deb_installable = ::Katello::Deb.apt_installable_for_host(self).search_for(search).distinct.pluck(:name)
558
+ if deb_installable.empty?
559
+ fail _("No available debs found for search term '%s'. Check the host's content view environments and already-installed debs.") % search
560
+ end
561
+ deb_installable
538
562
  when 'remove'
539
563
  return [] if search.empty?
540
564
 
541
565
  installed_debs.search_for(search).distinct.pluck(:name)
542
566
  when 'update'
543
567
  return [] if search.empty?
544
-
545
- installed_debs.search_for(search).distinct.pluck(:name)
568
+ deb_results = installed_debs.search_for(search).distinct.pluck(:name)
569
+ if deb_results.empty?
570
+ fail _("No installed debs found for search term '%s'") % search
571
+ end
572
+ deb_results
546
573
  else
547
574
  fail ::Foreman::Exception.new(N_("deb_names_for_job_template: Action must be one of %s"), actions.join(', '))
548
575
  end
549
576
  end
550
577
 
551
578
  def advisory_ids(search:)
552
- ::Katello::Erratum.installable_for_hosts([self]).search_for(search).pluck(:errata_id)
579
+ ids = ::Katello::Erratum.installable_for_hosts([self]).search_for(search).pluck(:errata_id)
580
+ if ids.empty?
581
+ fail _("Cannot install errata: No installable errata found for search term '%s'") % search
582
+ end
583
+ ids
553
584
  end
554
585
 
555
586
  def filtered_entitlement_quantity_consumed(pool)
@@ -39,10 +39,8 @@ module Katello
39
39
  self.medium = nil
40
40
  end
41
41
 
42
- if content_facet&.kickstart_repository_id && !matching_kickstart_repository?(content_facet)
43
- if (equivalent = equivalent_kickstart_repository)
44
- self.content_facet.kickstart_repository_id = equivalent[:id]
45
- end
42
+ if content_facet&.kickstart_repository_id && !matching_kickstart_repository?(content_facet) && (equivalent = equivalent_kickstart_repository)
43
+ self.content_facet.kickstart_repository_id = equivalent[:id]
46
44
  end
47
45
  end
48
46
 
@@ -16,10 +16,8 @@ module Katello
16
16
  end
17
17
 
18
18
  def reset_settings
19
- if saved_change_to_attribute?(:title)
20
- if ::Setting[:default_location_subscribed_hosts] == self.title_before_last_save
21
- ::Setting[:default_location_subscribed_hosts] = self.title
22
- end
19
+ if saved_change_to_attribute?(:title) && (::Setting[:default_location_subscribed_hosts] == self.title_before_last_save)
20
+ ::Setting[:default_location_subscribed_hosts] = self.title
23
21
  end
24
22
  end
25
23
 
@@ -6,33 +6,101 @@ module Katello
6
6
  REDHAT_ATOMIC_HOST_DISTRO_NAME = "Red Hat Enterprise Linux Atomic Host".freeze
7
7
  REDHAT_ATOMIC_HOST_OS = "RedHat_Enterprise_Linux_Atomic_Host".freeze
8
8
 
9
+ DEBIAN_DEFAULT_PROVISIONING_TEMPLATE = "Preseed default %{template_kind_name}".freeze
10
+ DEBIAN_DEFAULT_PTABLE = "Preseed default".freeze
11
+
12
+ SUSE_DEFAULT_PROVISIONING_TEMPLATE = "AutoYaST default %{template_kind_name}".freeze
13
+ SUSE_DEFAULT_PTABLE = "AutoYaST entire SCSI disk".freeze
14
+
9
15
  included do
10
16
  after_create :assign_templates!
11
17
  before_create :set_atomic_attributes, :if => proc { |os| os.name == ::Operatingsystem::REDHAT_ATOMIC_HOST_OS }
12
18
  end
13
19
 
14
- def assign_templates!
15
- # Automatically assign default templates
16
- if self.family == 'Redhat'
17
- TemplateKind.all.each do |kind|
18
- if name == ::Operatingsystem::REDHAT_ATOMIC_HOST_OS && kind.name == "provision"
19
- provisioning_template_name = Setting["katello_default_atomic_provision"]
20
- else
21
- provisioning_template_name = Setting["katello_default_#{kind.name}"]
22
- end
20
+ def find_related_os
21
+ Operatingsystem.unscoped.where(name: self.name).order(major: :desc, minor: :desc).where.not(id: self.id)
22
+ end
23
+
24
+ def assign_related_os_templates
25
+ all_related_os = find_related_os
26
+ return false if all_related_os.nil?
27
+
28
+ boot_loader_template_kinds = TemplateKind.where(name: ["PXELinux", "PXEGrub", "PXEGrub2", "iPXE"]).pluck(:id)
29
+ provision_template_kinds = TemplateKind.where(name: ["provision", "finish"]).pluck(:id)
23
30
 
24
- if (template = ProvisioningTemplate.unscoped.find_by_name(provisioning_template_name))
25
- provisioning_templates << template unless provisioning_templates.include?(template)
26
- if OsDefaultTemplate.where(:template_kind_id => kind.id, :operatingsystem_id => id).empty?
27
- OsDefaultTemplate.create(:template_kind_id => kind.id, :provisioning_template_id => template.id, :operatingsystem_id => id)
28
- end
31
+ all_related_os.each do |related_os|
32
+ next if related_os.provisioning_templates.empty? || related_os.ptables.empty?
33
+ next if related_os.provisioning_templates.where(template_kind_id: boot_loader_template_kinds).size == 0
34
+ next if related_os.provisioning_templates.where(template_kind_id: provision_template_kinds).size == 0
35
+
36
+ Rails.logger.info "Using operating system #{related_os.name} (major: #{related_os.major}, minor: #{related_os.minor}) " \
37
+ "as a template source for the new OS #{name} (major: #{major}, minor: #{minor})."
38
+
39
+ related_os.ptables.each do |ptable|
40
+ ptables << ptable unless ptables.include?(ptable)
41
+ end
42
+
43
+ related_os.provisioning_templates.each do |template|
44
+ provisioning_templates << template unless provisioning_templates.include?(template)
45
+ OsDefaultTemplate.where(:operatingsystem_id => related_os.id, :provisioning_template_id => template.id).each do |os_default_temp|
46
+ OsDefaultTemplate.create(:template_kind_id => os_default_temp.template_kind_id,
47
+ :provisioning_template_id => os_default_temp.provisioning_template_id,
48
+ :operatingsystem_id => id)
29
49
  end
30
50
  end
51
+ return true
52
+ end
53
+ false
54
+ end
55
+
56
+ def provisioning_template_name_for_os(template_kind_name)
57
+ case self.family
58
+ when 'Redhat'
59
+ if name == ::Operatingsystem::REDHAT_ATOMIC_HOST_OS && template_kind_name == "provision"
60
+ Setting["katello_default_atomic_provision"]
61
+ else
62
+ Setting["katello_default_#{template_kind_name}"]
63
+ end
64
+ when 'Debian'
65
+ format(DEBIAN_DEFAULT_PROVISIONING_TEMPLATE, template_kind_name: template_kind_name)
66
+ when 'Suse'
67
+ format(SUSE_DEFAULT_PROVISIONING_TEMPLATE, template_kind_name: template_kind_name)
68
+ end
69
+ end
31
70
 
32
- if (ptable = Ptable.unscoped.find_by_name(Setting["katello_default_ptable"]))
33
- ptables << ptable unless ptables.include?(ptable)
71
+ def partition_table_name_for_os
72
+ case self.family
73
+ when 'Redhat'
74
+ Setting["katello_default_ptable"]
75
+ when 'Debian'
76
+ DEBIAN_DEFAULT_PTABLE
77
+ when 'Suse'
78
+ SUSE_DEFAULT_PTABLE
79
+ end
80
+ end
81
+
82
+ def assign_templates!
83
+ if [ 'Suse', 'Debian' ].include?(self.family) && assign_related_os_templates
84
+ return
85
+ end
86
+
87
+ # Automatically assign default templates
88
+ TemplateKind.all.each do |kind|
89
+ provisioning_template_name = provisioning_template_name_for_os(kind.name)
90
+ next if provisioning_template_name.nil?
91
+ if (template = ProvisioningTemplate.unscoped.find_by_name(provisioning_template_name))
92
+ provisioning_templates << template unless provisioning_templates.include?(template)
93
+ if OsDefaultTemplate.where(:template_kind_id => kind.id, :operatingsystem_id => id).empty?
94
+ OsDefaultTemplate.create(:template_kind_id => kind.id, :provisioning_template_id => template.id, :operatingsystem_id => id)
95
+ end
34
96
  end
35
97
  end
98
+
99
+ partition_table_name = partition_table_name_for_os
100
+ return if partition_table_name.nil?
101
+ if (ptable = Ptable.unscoped.find_by_name(partition_table_name)) && !ptables.include?(ptable)
102
+ ptables << ptable
103
+ end
36
104
  end
37
105
 
38
106
  def set_atomic_attributes
@@ -11,8 +11,7 @@ module Katello
11
11
 
12
12
  module Overrides
13
13
  def refresh
14
- errors = super
15
- errors
14
+ super
16
15
  end
17
16
  end
18
17
 
@@ -254,10 +253,11 @@ module Katello
254
253
  end
255
254
 
256
255
  def pulp3_ssl_configuration(config, connection_adapter = Faraday.default_adapter)
257
- if connection_adapter == :excon
256
+ case connection_adapter
257
+ when :excon
258
258
  config.ssl_client_cert = ::Cert::Certs.ssl_client_cert_filename
259
259
  config.ssl_client_key = ::Cert::Certs.ssl_client_key_filename
260
- elsif connection_adapter == :net_http
260
+ when :net_http
261
261
  config.ssl_client_cert = ::Cert::Certs.ssl_client_cert
262
262
  config.ssl_client_key = ::Cert::Certs.ssl_client_key
263
263
  else
@@ -28,6 +28,7 @@ module Katello
28
28
  scoped_search :on => :registered_through, :relation => :subscription_facet, :complete_value => true, :only_explicit => true
29
29
  scoped_search :on => :registered_at, :relation => :subscription_facet, :rename => :registered_at, :only_explicit => true
30
30
  scoped_search :on => :uuid, :relation => :subscription_facet, :rename => :subscription_uuid, :only_explicit => true
31
+ scoped_search :on => :convert2rhel_through_foreman, :relation => :subscription_facet, :only_explicit => true
31
32
  scoped_search :relation => :activation_keys, :on => :name, :rename => :activation_key, :complete_value => true, :ext_method => :find_by_activation_key
32
33
  scoped_search :relation => :activation_keys, :on => :id, :rename => :activation_key_id, :complete_value => true, :ext_method => :find_by_activation_key_id,
33
34
  :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
@@ -42,6 +43,7 @@ module Katello
42
43
  end
43
44
 
44
45
  def update_candlepin_associations(consumer_params = nil)
46
+ Rails.logger.debug "Updating Candlepin associations for host #{name}"
45
47
  content_facet.cves_changed = false if content_facet
46
48
  content_facet&.save!
47
49
 
@@ -712,6 +712,7 @@ module Katello
712
712
  end
713
713
 
714
714
  def check_remove_from_environment!(env)
715
+ check_orphaned_content_facets!(environments: [env])
715
716
  errors = []
716
717
 
717
718
  dependencies = { hosts: _("hosts"),
@@ -730,6 +731,7 @@ module Katello
730
731
  end
731
732
 
732
733
  def check_ready_to_destroy!
734
+ check_orphaned_content_facets!(environments: self.environments)
733
735
  errors = []
734
736
 
735
737
  dependencies = { environments: _("environments"),
@@ -862,7 +864,9 @@ module Katello
862
864
  }
863
865
 
864
866
  table = Audit.arel_table
865
- repository_condition = table[:auditable_id].eq(id).and(audited_changes_like.call("repository_ids"))
867
+ repository_condition = table[:auditable_id].eq(id)
868
+ .and(table[:auditable_type].eq('Katello::ContentView'))
869
+ .and(audited_changes_like.call("repository_ids"))
866
870
 
867
871
  cv_repository_condition = table[:auditable_id].in(cv_repository_ids)
868
872
  .and(table[:auditable_type].eq('Katello::Repository'))
@@ -24,12 +24,23 @@ module Katello
24
24
  before_save :generate_info
25
25
 
26
26
  scope :non_default, -> { joins(:content_view).where("katello_content_views.default" => false) }
27
+ scope :default, -> { joins(:content_view).where("katello_content_views.default" => true) }
27
28
  alias :lifecycle_environment :environment
28
29
 
29
30
  def self.for_content_facets(content_facets)
30
31
  joins(:content_view_environment_content_facets, :content_facets).where("#{Katello::ContentViewEnvironmentContentFacet.table_name}.content_facet_id" => content_facets).uniq
31
32
  end
32
33
 
34
+ def self.with_candlepin_name(cp_name, organization: Organization.current)
35
+ lce_name, cv_name = cp_name.split('/')
36
+ if cv_name.blank? && lce_name == 'Library'
37
+ return default.find_by(
38
+ environment: ::Katello::KTEnvironment.library.where(organization: organization)&.first
39
+ )
40
+ end
41
+ joins(:environment, :content_view).where("#{Katello::KTEnvironment.table_name}.label" => lce_name, "#{Katello::ContentView.table_name}.label" => cv_name).first
42
+ end
43
+
33
44
  # retrieve the owning environment for this content view environment.
34
45
  def owner
35
46
  self.environment
@@ -47,10 +58,14 @@ module Katello
47
58
  content_view.default? && environment.library?
48
59
  end
49
60
 
50
- # TODO: uncomment when we need to start showing multiple CVE names in UI
51
- # def candlepin_name
52
- # "#{environment.label}/#{content_view.label}"
53
- # end
61
+ def candlepin_name
62
+ return environment.label if default_environment?
63
+ "#{environment.label}/#{content_view.label}"
64
+ end
65
+
66
+ def priority(content_facet)
67
+ content_view_environment_content_facets.find_by(:content_facet_id => content_facet.id).try(:priority)
68
+ end
54
69
 
55
70
  private
56
71
 
@@ -3,6 +3,8 @@ module Katello
3
3
  belongs_to :content_view_environment, :class_name => "::Katello::ContentViewEnvironment", :inverse_of => :content_view_environment_content_facets
4
4
  belongs_to :content_facet, :class_name => "::Katello::Host::ContentFacet", :inverse_of => :content_view_environment_content_facets
5
5
 
6
+ default_scope { order(:priority => :asc) }
7
+
6
8
  validates :content_view_environment_id, presence: true
7
9
  validates :content_facet_id, presence: true, unless: :new_record?
8
10
  validate :ensure_valid_content_source, if: proc { Setting['validate_host_lce_content_source_coherence'] }
@@ -19,5 +21,14 @@ module Katello
19
21
  errors.add(:base, error_msg)
20
22
  end
21
23
  end
24
+
25
+ def self.reprioritize_for_content_facet(content_facet, new_cves)
26
+ new_order = new_cves.map do |cve|
27
+ content_facet.content_view_environment_content_facets.find_by(:content_view_environment_id => cve.id)
28
+ end
29
+ new_order.compact.each_with_index do |cvecf, index|
30
+ cvecf.update_column(:priority, index)
31
+ end
32
+ end
22
33
  end
23
34
  end
@@ -67,7 +67,7 @@ module Katello
67
67
  end
68
68
 
69
69
  def self.applicable_to_hosts(hosts)
70
- # Note: ContentFacetErrata actually holds the "Applicable Errata" to that host
70
+ # NOTE: ContentFacetErrata actually holds the "Applicable Errata" to that host
71
71
  # It is not the errata "belonging" to the host. Its rather the errata that is "applicable"
72
72
  # which is calculated elsewhere.
73
73
 
@@ -1,7 +1,7 @@
1
1
  module Katello
2
2
  class Event < Katello::Model
3
3
  validate :validate_event_type
4
- # Note: Do not use active record call backs or dependent references on this class
4
+ # NOTE: Do not use active record call backs or dependent references on this class
5
5
  # Direct deletes are made in EventQueue#clear_events (instead of destroys).
6
6
 
7
7
  serialize :metadata, Hash
@@ -34,7 +34,7 @@ module Katello
34
34
  API_URL = 'https://subscription.rhsm.redhat.com/subscription/consumers/'.freeze
35
35
  def api_url(upstream = {})
36
36
  # Default to Red Hat
37
- upstream['apiUrl'] || API_URL
37
+ ENV['REDHAT_RHSM_API_URL'] || upstream['apiUrl'] || API_URL
38
38
  end
39
39
 
40
40
  def sync
@@ -65,7 +65,6 @@ module Katello
65
65
  Rails.logger.error "Upstream identity certificate not available"
66
66
  fail _("Upstream identity certificate not available")
67
67
  end
68
-
69
68
  params = {}
70
69
  params[:capabilities] = Resources::Candlepin::CandlepinPing.ping['managerCapabilities'].inject([]) do |result, element|
71
70
  result << {'name' => element}
@@ -16,7 +16,7 @@ module Katello
16
16
  subhash = hash[params.first]
17
17
  # If we don't have a subhash don't try and recurse down
18
18
  if !subhash.nil? && !subhash.empty?
19
- self.null_safe_get(subhash, default, params[1..-1])
19
+ self.null_safe_get(subhash, default, params[1..])
20
20
  else
21
21
  default
22
22
  end
@@ -64,6 +64,7 @@ module Katello
64
64
  end
65
65
 
66
66
  def mark_cves_changed(_cve)
67
+ Rails.logger.debug("ContentFacet: Marking CVEs changed for host #{host&.to_label}")
67
68
  self.cves_changed = true
68
69
  end
69
70
 
@@ -99,6 +100,17 @@ module Katello
99
100
  content_view_environments&.first&.lifecycle_environment
100
101
  end
101
102
 
103
+ def content_view_environments=(new_cves)
104
+ if new_cves.length > 1 && !Setting['allow_multiple_content_views']
105
+ fail ::Katello::Errors::MultiEnvironmentNotSupportedError,
106
+ _("Assigning a host to multiple content view environments is not enabled.")
107
+ end
108
+ super(new_cves)
109
+ Katello::ContentViewEnvironmentContentFacet.reprioritize_for_content_facet(self, new_cves)
110
+ self.content_view_environments.reload unless self.new_record?
111
+ self.host&.update_candlepin_associations unless self.host&.new_record?
112
+ end
113
+
102
114
  # rubocop:disable Metrics/CyclomaticComplexity
103
115
  def assign_single_environment(
104
116
  content_view_id: nil, lifecycle_environment_id: nil, environment_id: nil,
@@ -126,9 +138,10 @@ module Katello
126
138
  end
127
139
 
128
140
  def default_environment?
129
- content_view_environments.any? do |cve|
130
- cve.content_view.default? && cve.lifecycle_environment.library?
131
- end
141
+ return if content_view_environments.blank?
142
+ # if default cve is first, this is equivalent to default being the only one.
143
+ # if default cve is not first, candlepin will prioritize CV repos over library repos in case of conflicts.
144
+ content_view_environments.first.default_environment?
132
145
  end
133
146
 
134
147
  def update_repositories_by_paths(paths)
@@ -162,10 +162,22 @@ module Katello
162
162
  end
163
163
  end
164
164
 
165
+ def candlepin_environments_cp_ids
166
+ candlepin_environments.map { |e| e[:id] }
167
+ end
168
+
165
169
  def content_view_environments
166
170
  self.host.content_facet.try(:content_view_environments)
167
171
  end
168
172
 
173
+ def consumer_cve_order_from_candlepin
174
+ Katello::Resources::Candlepin::Consumer.get(uuid)['environments'].map { |e| e['id'] }
175
+ end
176
+
177
+ def cves_ordered_correctly?
178
+ consumer_cve_order_from_candlepin == candlepin_environments_cp_ids
179
+ end
180
+
169
181
  def organization
170
182
  self.host.organization
171
183
  end
@@ -229,10 +241,8 @@ module Katello
229
241
  setting_fact = Setting[:register_hostname_fact]
230
242
  only_use_custom_fact = Setting[:register_hostname_fact_strict_match]
231
243
 
232
- if !setting_fact.blank? && !facts[setting_fact].blank?
233
- if only_use_custom_fact || ::Host.where(:name => setting_fact.downcase).any?
234
- facts[setting_fact]
235
- end
244
+ if !setting_fact.blank? && !facts[setting_fact].blank? && (only_use_custom_fact || ::Host.where(:name => setting_fact.downcase).any?)
245
+ facts[setting_fact]
236
246
  end
237
247
  end
238
248
 
@@ -287,6 +297,19 @@ module Katello
287
297
  false
288
298
  end
289
299
 
300
+ def self.populate_fields_from_facts(host, parser, _type, _source_proxy)
301
+ has_convert2rhel = parser.facts.key?('conversions.env.CONVERT2RHEL_THROUGH_FOREMAN')
302
+ return unless host.subscription_facet || has_convert2rhel
303
+ # Add in custom convert2rhel fact if system was converted using convert2rhel through Katello
304
+ # We want the value nil unless the custom fact is present otherwise we get a 0 in the database which if debugging
305
+ # might make you think it was converted2rhel but not with satellite, that is why I have the tenary below.
306
+ facet = host.subscription_facet || host.build_subscription_facet
307
+ facet.attributes = {
308
+ convert2rhel_through_foreman: has_convert2rhel ? ::Foreman::Cast.to_bool(parser.facts['conversions.env.CONVERT2RHEL_THROUGH_FOREMAN']) : nil
309
+ }.compact
310
+ facet.save unless facet.new_record?
311
+ end
312
+
290
313
  private
291
314
 
292
315
  def update_status(status_class, **args)
@@ -58,8 +58,12 @@ module Katello
58
58
  consumer_ids
59
59
  end
60
60
 
61
- def errata(type = nil)
62
- query = Erratum.joins(:content_facets).where("#{Katello::Host::ContentFacet.table_name}.host_id" => self.host_ids)
61
+ def errata(type = nil, installable_only: false)
62
+ query = if installable_only
63
+ Katello::Erratum.installable_for_hosts(self.hosts)
64
+ else
65
+ Katello::Erratum.applicable_to_hosts(self.hosts)
66
+ end
63
67
  type ? query.of_type(type) : query
64
68
  end
65
69
 
@@ -95,16 +99,16 @@ module Katello
95
99
  return host_collections_hash[:critical].to_a, host_collections_hash[:warning].to_a, host_collections_hash[:ok].to_a
96
100
  end
97
101
 
98
- def security_updates?
99
- errata(Erratum::SECURITY).any?
102
+ def security_updates?(installable_only: false)
103
+ errata(Erratum::SECURITY, installable_only: installable_only).any?
100
104
  end
101
105
 
102
- def bugzilla_updates?
103
- errata(Erratum::BUGZILLA).any?
106
+ def bugzilla_updates?(installable_only: false)
107
+ errata(Erratum::BUGZILLA, installable_only: installable_only).any?
104
108
  end
105
109
 
106
- def enhancement_updates?
107
- errata(Erratum::ENHANCEMENT).any?
110
+ def enhancement_updates?(installable_only: false)
111
+ errata(Erratum::ENHANCEMENT, installable_only: installable_only).any?
108
112
  end
109
113
 
110
114
  def self.humanize_class_name(_name = nil)
@@ -55,6 +55,10 @@ module Katello
55
55
 
56
56
  validate :subscription_matches_organization
57
57
 
58
+ def product_host_count
59
+ Katello::Host::ContentFacet.joins(bound_repositories: { product: :pools }).where(pools: { id: id }).distinct.count
60
+ end
61
+
58
62
  def subscription_matches_organization
59
63
  return if errors[:subscription].any? || errors[:organization].any? # let other validations catch this
60
64
  unless subscription&.organization_id == self.organization_id
@@ -147,7 +151,7 @@ module Katello
147
151
  property :days_until_expiration, Integer, desc: 'Returns number of days until expiration'
148
152
  end
149
153
  class Jail < ::Safemode::Jail
150
- allow :id, :name, :available, :quantity, :product_id, :contract_number, :type, :account_number, :start_date, :end_date, :organization, :consumed, :days_until_expiration
154
+ allow :id, :name, :available, :quantity, :product_id, :contract_number, :type, :account_number, :start_date, :end_date, :organization, :consumed, :days_until_expiration, :product_host_count
151
155
  end
152
156
  end
153
157
  end
@@ -84,6 +84,10 @@ module Katello
84
84
 
85
85
  before_create :assign_unique_label
86
86
 
87
+ def acs_compatible_repositories
88
+ repositories.has_url.not_uln.library
89
+ end
90
+
87
91
  def orphaned?
88
92
  self.pool_products.empty?
89
93
  end
@@ -122,13 +126,12 @@ module Katello
122
126
  options = {} if options.nil?
123
127
 
124
128
  hash = super(options.merge(:except => [:cp_id, :id]))
125
- hash = hash.merge(:multiplier => self.multiplier,
129
+ hash.merge(:multiplier => self.multiplier,
126
130
  :attributes => self.attrs,
127
131
  :id => self.cp_id,
128
132
  :sync_plan_name => self.sync_plan ? self.sync_plan.name : nil,
129
133
  :sync_state => self.sync_state,
130
134
  :last_sync => self.last_sync)
131
- hash
132
135
  end
133
136
 
134
137
  def redhat?
@@ -168,8 +171,8 @@ module Katello
168
171
  self.label = Util::Model.labelize(self.name) if self.label.blank?
169
172
 
170
173
  # if the object label is already being used in this org, append the id to make it unique
171
- if Product.all_in_org(self.organization).where("#{Katello::Product.table_name}.label = ?", self.label).count > 0
172
- self.label = self.label + "_" + self.cp_id unless self.cp_id.blank?
174
+ if Product.all_in_org(self.organization).where("#{Katello::Product.table_name}.label = ?", self.label).count > 0 && !self.cp_id.blank?
175
+ self.label = self.label + "_" + self.cp_id
173
176
  end
174
177
  end
175
178
 
@@ -84,9 +84,8 @@ module Katello
84
84
  def serializable_hash(options = {})
85
85
  options = {} if options.nil?
86
86
  hash = super(options)
87
- hash = hash.merge(:sync_state => self.sync_state,
87
+ hash.merge(:sync_state => self.sync_state,
88
88
  :last_sync => self.last_sync)
89
- hash
90
89
  end
91
90
 
92
91
  def manifest_task