katello 4.14.1 → 4.15.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 (453) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/katello/common/chosen.jquery.js +3 -3
  3. data/app/assets/javascripts/katello/common/env_select_scroll.js +3 -3
  4. data/app/assets/javascripts/katello/common/katello.js +8 -7
  5. data/app/assets/javascripts/katello/common/katello_object.js +3 -3
  6. data/app/assets/javascripts/katello/common/menu.js +7 -7
  7. data/app/assets/javascripts/katello/hosts/host_and_hostgroup_edit.js +6 -6
  8. data/app/assets/javascripts/katello/locale/bn/katello.js +259 -28
  9. data/app/assets/javascripts/katello/locale/bn_IN/katello.js +258 -27
  10. data/app/assets/javascripts/katello/locale/ca/katello.js +258 -27
  11. data/app/assets/javascripts/katello/locale/cs/katello.js +258 -27
  12. data/app/assets/javascripts/katello/locale/cs_CZ/katello.js +258 -27
  13. data/app/assets/javascripts/katello/locale/de/katello.js +259 -28
  14. data/app/assets/javascripts/katello/locale/de_AT/katello.js +258 -27
  15. data/app/assets/javascripts/katello/locale/de_DE/katello.js +258 -27
  16. data/app/assets/javascripts/katello/locale/el/katello.js +258 -27
  17. data/app/assets/javascripts/katello/locale/en/katello.js +258 -27
  18. data/app/assets/javascripts/katello/locale/en_GB/katello.js +258 -27
  19. data/app/assets/javascripts/katello/locale/en_US/katello.js +258 -27
  20. data/app/assets/javascripts/katello/locale/es/katello.js +259 -28
  21. data/app/assets/javascripts/katello/locale/et_EE/katello.js +258 -27
  22. data/app/assets/javascripts/katello/locale/fr/katello.js +259 -28
  23. data/app/assets/javascripts/katello/locale/gl/katello.js +258 -27
  24. data/app/assets/javascripts/katello/locale/gu/katello.js +258 -27
  25. data/app/assets/javascripts/katello/locale/he_IL/katello.js +258 -27
  26. data/app/assets/javascripts/katello/locale/hi/katello.js +258 -27
  27. data/app/assets/javascripts/katello/locale/id/katello.js +258 -27
  28. data/app/assets/javascripts/katello/locale/it/katello.js +259 -28
  29. data/app/assets/javascripts/katello/locale/ja/katello.js +259 -28
  30. data/app/assets/javascripts/katello/locale/ka/katello.js +259 -28
  31. data/app/assets/javascripts/katello/locale/kn/katello.js +258 -27
  32. data/app/assets/javascripts/katello/locale/ko/katello.js +259 -28
  33. data/app/assets/javascripts/katello/locale/ml_IN/katello.js +258 -27
  34. data/app/assets/javascripts/katello/locale/mr/katello.js +258 -27
  35. data/app/assets/javascripts/katello/locale/nl_NL/katello.js +258 -27
  36. data/app/assets/javascripts/katello/locale/or/katello.js +258 -27
  37. data/app/assets/javascripts/katello/locale/pa/katello.js +258 -27
  38. data/app/assets/javascripts/katello/locale/pl/katello.js +258 -27
  39. data/app/assets/javascripts/katello/locale/pl_PL/katello.js +258 -27
  40. data/app/assets/javascripts/katello/locale/pt/katello.js +258 -27
  41. data/app/assets/javascripts/katello/locale/pt_BR/katello.js +259 -28
  42. data/app/assets/javascripts/katello/locale/ro/katello.js +258 -27
  43. data/app/assets/javascripts/katello/locale/ro_RO/katello.js +258 -27
  44. data/app/assets/javascripts/katello/locale/ru/katello.js +259 -28
  45. data/app/assets/javascripts/katello/locale/sl/katello.js +258 -27
  46. data/app/assets/javascripts/katello/locale/sv_SE/katello.js +258 -27
  47. data/app/assets/javascripts/katello/locale/ta/katello.js +259 -28
  48. data/app/assets/javascripts/katello/locale/ta_IN/katello.js +258 -27
  49. data/app/assets/javascripts/katello/locale/te/katello.js +258 -27
  50. data/app/assets/javascripts/katello/locale/tr/katello.js +258 -27
  51. data/app/assets/javascripts/katello/locale/vi/katello.js +258 -27
  52. data/app/assets/javascripts/katello/locale/vi_VN/katello.js +258 -27
  53. data/app/assets/javascripts/katello/locale/zh/katello.js +258 -27
  54. data/app/assets/javascripts/katello/locale/zh_CN/katello.js +259 -28
  55. data/app/assets/javascripts/katello/locale/zh_TW/katello.js +259 -28
  56. data/app/assets/javascripts/katello/organizations/download_certificate.js +1 -1
  57. data/app/assets/javascripts/katello/sync_management/sync_management.js +9 -9
  58. data/app/assets/javascripts/katello/widgets/env_content_view_selector.js +5 -5
  59. data/app/assets/javascripts/katello/widgets/path_selector.js +6 -6
  60. data/app/assets/javascripts/katello/widgets/subpanel_new.js +1 -1
  61. data/app/controllers/katello/api/registry/registry_proxies_controller.rb +7 -7
  62. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +6 -1
  63. data/app/controllers/katello/api/v2/activation_keys_controller.rb +131 -59
  64. data/app/controllers/katello/api/v2/api_controller.rb +1 -1
  65. data/app/controllers/katello/api/v2/capsule_content_controller.rb +21 -10
  66. data/app/controllers/katello/api/v2/content_view_components_controller.rb +1 -1
  67. data/app/controllers/katello/api/v2/content_view_environments_controller.rb +54 -0
  68. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +3 -3
  69. data/app/controllers/katello/api/v2/content_views_controller.rb +1 -1
  70. data/app/controllers/katello/api/v2/environments_controller.rb +1 -1
  71. data/app/controllers/katello/api/v2/exports_controller.rb +1 -1
  72. data/app/controllers/katello/api/v2/host_collections_controller.rb +2 -2
  73. data/app/controllers/katello/api/v2/host_contents_controller.rb +1 -1
  74. data/app/controllers/katello/api/v2/host_errata_controller.rb +1 -1
  75. data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +1 -1
  76. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +1 -4
  77. data/app/controllers/katello/api/v2/organizations_controller.rb +1 -1
  78. data/app/controllers/katello/api/v2/repositories_controller.rb +3 -2
  79. data/app/controllers/katello/api/v2/repository_sets_controller.rb +1 -1
  80. data/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb +10 -16
  81. data/app/controllers/katello/concerns/api/v2/multi_cv_params_handling.rb +24 -0
  82. data/app/controllers/katello/concerns/authorization/api/v2/content_views_controller.rb +2 -5
  83. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +1 -1
  84. data/app/controllers/katello/concerns/registration_commands_controller_extensions.rb +1 -1
  85. data/app/helpers/katello/concerns/smart_proxy_helper_extensions.rb +5 -5
  86. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +2 -2
  87. data/app/helpers/katello/katello_url_helper.rb +1 -1
  88. data/app/lib/actions/candlepin/product/content_create.rb +12 -1
  89. data/app/lib/actions/candlepin/product/content_update.rb +21 -4
  90. data/app/lib/actions/katello/activation_key/reassign.rb +4 -3
  91. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +8 -3
  92. data/app/lib/actions/katello/capsule_content/update_content_counts.rb +21 -3
  93. data/app/lib/actions/katello/cdn_configuration/update.rb +1 -1
  94. data/app/lib/actions/katello/content_view/capsule_sync.rb +17 -1
  95. data/app/lib/actions/katello/content_view/incremental_updates.rb +1 -1
  96. data/app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb +1 -1
  97. data/app/lib/actions/katello/content_view/remove.rb +8 -12
  98. data/app/lib/actions/katello/content_view_version/import.rb +1 -1
  99. data/app/lib/actions/katello/content_view_version/incremental_update.rb +2 -2
  100. data/app/lib/actions/katello/flatpak/scan_remote.rb +62 -0
  101. data/app/lib/actions/katello/host/hypervisors.rb +1 -1
  102. data/app/lib/actions/katello/product/content_create.rb +28 -19
  103. data/app/lib/actions/katello/product/content_destroy.rb +6 -5
  104. data/app/lib/actions/katello/product/destroy.rb +1 -1
  105. data/app/lib/actions/katello/repository/clone_contents.rb +14 -0
  106. data/app/lib/actions/katello/repository/create.rb +24 -17
  107. data/app/lib/actions/katello/repository/create_container_push_root.rb +44 -0
  108. data/app/lib/actions/katello/repository/create_root.rb +5 -15
  109. data/app/lib/actions/katello/repository/destroy.rb +3 -3
  110. data/app/lib/actions/katello/repository/discover.rb +1 -1
  111. data/app/lib/actions/katello/repository/finish_upload.rb +13 -0
  112. data/app/lib/actions/katello/repository/import_upload.rb +1 -1
  113. data/app/lib/actions/katello/repository/sync.rb +16 -0
  114. data/app/lib/actions/katello/repository/update.rb +11 -20
  115. data/app/lib/actions/katello/repository/upload_files.rb +1 -1
  116. data/app/lib/actions/katello/repository_set/enable_repository.rb +1 -1
  117. data/app/lib/actions/katello/repository_set/scan_cdn.rb +1 -1
  118. data/app/lib/actions/katello/upstream_subscriptions/bind_entitlement.rb +1 -1
  119. data/app/lib/actions/pulp3/capsule_content/sync.rb +1 -1
  120. data/app/lib/actions/pulp3/orchestration/content_view_version/export_library.rb +1 -1
  121. data/app/lib/actions/pulp3/orchestration/repository/create.rb +6 -1
  122. data/app/lib/actions/pulp3/orchestration/repository/trigger_update_repo_cert_guard.rb +1 -1
  123. data/app/lib/actions/pulp3/repository/initialize.rb +17 -0
  124. data/app/lib/actions/pulp3/repository/refresh_distribution.rb +1 -1
  125. data/app/lib/katello/api/constraints/register_with_activation_key_constraint.rb +11 -0
  126. data/app/lib/katello/concerns/base_template_scope_extensions.rb +1 -1
  127. data/app/lib/katello/http_resource.rb +6 -6
  128. data/app/lib/katello/messaging/stomp_connection.rb +4 -4
  129. data/app/lib/katello/resources/candlepin/activation_key.rb +1 -1
  130. data/app/lib/katello/resources/candlepin/owner.rb +1 -1
  131. data/app/lib/katello/resources/candlepin/product.rb +1 -1
  132. data/app/lib/katello/resources/candlepin.rb +1 -1
  133. data/app/lib/katello/resources/cdn/katello_cdn.rb +3 -3
  134. data/app/lib/katello/resources/cdn.rb +1 -1
  135. data/app/lib/katello/resources/discovery/container.rb +5 -3
  136. data/app/lib/katello/resources/discovery/yum.rb +3 -1
  137. data/app/lib/katello/resources/registry.rb +0 -3
  138. data/app/lib/katello/util/candlepin_repository_checker.rb +2 -2
  139. data/app/lib/katello/util/cveak_migrator.rb +38 -0
  140. data/app/lib/katello/util/deb.rb +9 -0
  141. data/app/lib/katello/util/deduplication_migrator.rb +8 -8
  142. data/app/lib/katello/util/model.rb +2 -2
  143. data/app/lib/katello/util/search.rb +5 -5
  144. data/app/lib/katello/util/task_status.rb +19 -19
  145. data/app/lib/katello/util/url_matcher.rb +3 -3
  146. data/app/lib/katello/validators/content_view_environment_org_validator.rb +2 -1
  147. data/app/lib/katello/validators/katello_url_format_validator.rb +2 -2
  148. data/app/mailers/katello/errata_mailer.rb +1 -4
  149. data/app/models/katello/activation_key.rb +123 -27
  150. data/app/models/katello/alternate_content_source.rb +5 -5
  151. data/app/models/katello/authorization/activation_key.rb +1 -1
  152. data/app/models/katello/authorization/content_view_environment.rb +7 -0
  153. data/app/models/katello/cdn_configuration.rb +1 -1
  154. data/app/models/katello/concerns/content_facet_host_extensions.rb +24 -2
  155. data/app/models/katello/concerns/host_managed_extensions.rb +11 -6
  156. data/app/models/katello/concerns/organization_extensions.rb +4 -4
  157. data/app/models/katello/concerns/redhat_extensions.rb +1 -1
  158. data/app/models/katello/concerns/smart_proxy_extensions.rb +84 -39
  159. data/app/models/katello/content.rb +3 -3
  160. data/app/models/katello/content_view.rb +15 -18
  161. data/app/models/katello/content_view_environment.rb +56 -15
  162. data/app/models/katello/content_view_environment_activation_key.rb +20 -0
  163. data/app/models/katello/content_view_erratum_filter_rule.rb +1 -1
  164. data/app/models/katello/content_view_filter.rb +2 -2
  165. data/app/models/katello/content_view_history.rb +1 -1
  166. data/app/models/katello/content_view_repository.rb +1 -1
  167. data/app/models/katello/content_view_version.rb +3 -3
  168. data/app/models/katello/content_view_version_export_history.rb +2 -2
  169. data/app/models/katello/content_view_version_import_history.rb +1 -1
  170. data/app/models/katello/events/delete_latest_content_view_version.rb +1 -1
  171. data/app/models/katello/flatpak_remote.rb +11 -0
  172. data/app/models/katello/flatpak_remote_repository.rb +12 -0
  173. data/app/models/katello/flatpak_remote_repository_manifest.rb +10 -0
  174. data/app/models/katello/glue/candlepin/activation_key.rb +1 -1
  175. data/app/models/katello/glue/candlepin/candlepin_object.rb +1 -1
  176. data/app/models/katello/glue/candlepin/pool.rb +1 -1
  177. data/app/models/katello/glue/pulp/repos.rb +1 -1
  178. data/app/models/katello/host/content_facet.rb +33 -17
  179. data/app/models/katello/host/info_provider.rb +2 -4
  180. data/app/models/katello/host/subscription_facet.rb +2 -2
  181. data/app/models/katello/host_available_module_stream.rb +1 -1
  182. data/app/models/katello/installed_product.rb +2 -2
  183. data/app/models/katello/kt_environment.rb +11 -6
  184. data/app/models/katello/ping.rb +2 -3
  185. data/app/models/katello/repository.rb +40 -6
  186. data/app/models/katello/rhel_lifecycle_status.rb +10 -10
  187. data/app/models/katello/root_repository.rb +14 -18
  188. data/app/models/katello/task_status.rb +1 -1
  189. data/app/models/katello/upstream_pool.rb +2 -2
  190. data/app/presenters/katello/product_content_presenter.rb +2 -2
  191. data/app/presenters/katello/repository_presenter.rb +3 -3
  192. data/app/presenters/katello/sync_status_presenter.rb +3 -3
  193. data/app/services/cert/certs.rb +6 -2
  194. data/app/services/katello/candlepin_event_listener.rb +1 -1
  195. data/app/services/katello/event_monitor/poller_thread.rb +1 -1
  196. data/app/services/katello/event_queue.rb +1 -1
  197. data/app/services/katello/product_content_finder.rb +10 -10
  198. data/app/services/katello/product_content_importer.rb +1 -1
  199. data/app/services/katello/pulp3/alternate_content_source.rb +2 -2
  200. data/app/services/katello/pulp3/ansible_collection.rb +1 -1
  201. data/app/services/katello/pulp3/api/apt.rb +4 -0
  202. data/app/services/katello/pulp3/content.rb +1 -0
  203. data/app/services/katello/pulp3/content_view_version/export.rb +3 -10
  204. data/app/services/katello/pulp3/content_view_version/export_validator.rb +1 -1
  205. data/app/services/katello/pulp3/content_view_version/import.rb +2 -2
  206. data/app/services/katello/pulp3/content_view_version/import_gpg_keys.rb +1 -1
  207. data/app/services/katello/pulp3/content_view_version/importable_products.rb +2 -2
  208. data/app/services/katello/pulp3/content_view_version/importable_repositories.rb +4 -4
  209. data/app/services/katello/pulp3/content_view_version/metadata_generator.rb +2 -2
  210. data/app/services/katello/pulp3/deb.rb +35 -1
  211. data/app/services/katello/pulp3/docker_manifest.rb +1 -1
  212. data/app/services/katello/pulp3/docker_manifest_list.rb +6 -2
  213. data/app/services/katello/pulp3/docker_tag.rb +1 -1
  214. data/app/services/katello/pulp3/erratum.rb +2 -2
  215. data/app/services/katello/pulp3/file_unit.rb +1 -1
  216. data/app/services/katello/pulp3/generic_content_unit.rb +1 -1
  217. data/app/services/katello/pulp3/module_stream.rb +2 -2
  218. data/app/services/katello/pulp3/repository/ansible_collection.rb +1 -1
  219. data/app/services/katello/pulp3/repository/apt.rb +22 -16
  220. data/app/services/katello/pulp3/repository/docker.rb +2 -2
  221. data/app/services/katello/pulp3/repository/file.rb +1 -1
  222. data/app/services/katello/pulp3/repository/generic.rb +1 -1
  223. data/app/services/katello/pulp3/repository/yum.rb +7 -7
  224. data/app/services/katello/pulp3/repository.rb +15 -9
  225. data/app/services/katello/pulp3/repository_mirror.rb +3 -3
  226. data/app/services/katello/registration_manager.rb +23 -6
  227. data/app/services/katello/repository_type.rb +3 -3
  228. data/app/services/katello/smart_proxy_helper.rb +3 -3
  229. data/app/services/katello/ui_notifications/content_view/delete_latest_version_failure.rb +1 -1
  230. data/app/services/katello/ui_notifications/subscriptions/expire_soon.rb +3 -3
  231. data/app/services/katello/ui_notifications/subscriptions/manifest_expire_soon_warning.rb +3 -3
  232. data/app/services/katello/ui_notifications/task_notification.rb +2 -2
  233. data/app/services/katello/upstream_connection_checker.rb +1 -1
  234. data/app/views/katello/api/v2/activation_keys/base.json.rabl +43 -8
  235. data/app/views/katello/api/v2/alternate_content_sources/base.json.rabl +1 -1
  236. data/app/views/katello/api/v2/capsule_content/sync_status.json.rabl +5 -5
  237. data/app/views/katello/api/v2/common/_metadata.json.rabl +1 -1
  238. data/app/views/katello/api/v2/content_credentials/show.json.rabl +1 -1
  239. data/app/views/katello/api/v2/content_facet/base.json.rabl +15 -6
  240. data/app/views/katello/api/v2/content_facet/show.json.rabl +1 -1
  241. data/app/views/katello/api/v2/content_view_environments/index.json.rabl +7 -0
  242. data/app/views/katello/api/v2/content_view_environments/show.json.rabl +33 -0
  243. data/app/views/katello/api/v2/content_view_filter_rules/show.json.rabl +1 -1
  244. data/app/views/katello/api/v2/content_view_filters/show.json.rabl +1 -1
  245. data/app/views/katello/api/v2/content_view_versions/base.json.rabl +3 -3
  246. data/app/views/katello/api/v2/content_views/base.json.rabl +3 -3
  247. data/app/views/katello/api/v2/content_views/show.json.rabl +1 -1
  248. data/app/views/katello/api/v2/debs/backend.json.rabl +7 -0
  249. data/app/views/katello/api/v2/debs/base.json.rabl +4 -0
  250. data/app/views/katello/api/v2/debs/show.json.rabl +2 -0
  251. data/app/views/katello/api/v2/docker_manifest_lists/show.json.rabl +1 -0
  252. data/app/views/katello/api/v2/docker_tags/_base.json.rabl +2 -2
  253. data/app/views/katello/api/v2/environments/show.json.rabl +4 -4
  254. data/app/views/katello/api/v2/gpg_keys/show.json.rabl +1 -1
  255. data/app/views/katello/api/v2/host_collections/base.json.rabl +1 -1
  256. data/app/views/katello/api/v2/hosts/base.json.rabl +2 -2
  257. data/app/views/katello/api/v2/package_groups/base.json.rabl +2 -2
  258. data/app/views/katello/api/v2/products/show.json.rabl +2 -2
  259. data/app/views/katello/api/v2/repositories/show.json.rabl +1 -1
  260. data/app/views/katello/api/v2/repository_sets/show.json.rabl +1 -1
  261. data/app/views/katello/api/v2/subscriptions/base.json.rabl +1 -1
  262. data/app/views/katello/api/v2/subscriptions/show.json.rabl +3 -3
  263. data/app/views/katello/api/v2/sync_plans/show.json.rabl +1 -1
  264. data/config/initializers/inflections.rb +11 -0
  265. data/config/katello.yaml.example +4 -10
  266. data/config/routes/api/registry.rb +0 -2
  267. data/config/routes/api/rhsm.rb +1 -4
  268. data/config/routes/api/v2.rb +2 -3
  269. data/db/migrate/20140716211853_repo_rename_feed_to_url.rb +1 -1
  270. data/db/migrate/20141003210742_add_docker_container_registry_url_to_providers.rb +1 -1
  271. data/db/migrate/20150224083608_remove_docker_registry_url.rb +1 -1
  272. data/db/migrate/20160808002834_add_files.rb +1 -1
  273. data/db/migrate/20161014133811_move_content_view_version_description_to_histories.rb +1 -1
  274. data/db/migrate/20200818192230_update_system_purpose_status.rb +1 -1
  275. data/db/migrate/20201012172713_remove_gpg_key_perms.rb +1 -1
  276. data/db/migrate/20210322142311_add_auth_url_token_to_root_repositories.rb +1 -1
  277. data/db/migrate/20211220185935_clean_duplicate_content_units.rb +2 -2
  278. data/db/migrate/20230717150442_change_change_content_source_job_template_name.rb +1 -1
  279. data/db/migrate/20240207191223_remove_entitlement_mode_host_statuses.rb +1 -1
  280. data/db/migrate/20240508100434_add_content_id_to_katello_repository.rb +5 -0
  281. data/db/migrate/20240730163043_add_content_view_environment_activation_key.rb +87 -0
  282. data/db/migrate/20240806130902_add_more_deb_fields.rb +15 -0
  283. data/db/migrate/20240903194428_add_priority_to_content_view_environment_activation_key.rb +5 -0
  284. data/db/migrate/20241007200316_add_fields_to_katello_docker_manifest_list.rb +8 -0
  285. data/db/migrate/20241007212705_add_bootc_facts_to_content_facet.rb +27 -0
  286. data/db/migrate/20241025151105_remove_pulp3_migrated_hrefs_from_content_tables.rb +10 -0
  287. data/db/migrate/20241030181402_create_katello_flatpak_tables.rb +41 -0
  288. data/db/seeds.d/106-mail_notifications.rb +9 -9
  289. data/db/seeds.d/108-subcription-bookmarks.rb +1 -1
  290. data/db/seeds.d/109-katello-notification-blueprints.rb +21 -21
  291. data/db/seeds.d/110-content-view-autopublish.rb +5 -5
  292. data/db/seeds.d/111-container-image-bookmarks.rb +1 -1
  293. data/db/seeds.d/111-upgrade_tasks.rb +1 -1
  294. data/engines/bastion/lib/bastion/engine.rb +1 -1
  295. data/engines/bastion/lib/bastion.rb +1 -1
  296. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-repository-sets.controller.js +16 -0
  297. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-info.html +29 -15
  298. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-repository-sets.html +13 -0
  299. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/views/activation-keys.html +2 -0
  300. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-host-collections-modal.controller.js +2 -0
  301. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-host-collections-modal.html +4 -4
  302. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/debs/debs.routes.js +9 -0
  303. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/debs/details/views/deb-dependencies.html +54 -0
  304. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/debs/details/views/deb-info.html +13 -1
  305. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/debs/details/views/deb.html +8 -1
  306. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/views/apply-errata-confirm.html +1 -1
  307. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +4 -0
  308. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +11 -0
  309. data/engines/bastion_katello/app/assets/stylesheets/bastion_katello/activation_keys.scss +1 -1
  310. data/engines/bastion_katello/lib/bastion_katello/engine.rb +1 -1
  311. data/lib/katello/engine.rb +17 -15
  312. data/lib/katello/permission_creator.rb +51 -49
  313. data/lib/katello/permissions/host_permissions.rb +4 -4
  314. data/lib/katello/permissions/organization_permissions.rb +4 -4
  315. data/lib/katello/permissions/registry_permissions.rb +1 -1
  316. data/lib/katello/permissions/roles_permissions.rb +1 -1
  317. data/lib/katello/permissions/user_permissions.rb +1 -1
  318. data/lib/katello/plugin.rb +14 -8
  319. data/lib/katello/repository_types/docker.rb +4 -2
  320. data/lib/katello/repository_types/ostree.rb +5 -3
  321. data/lib/katello/repository_types/python.rb +1 -1
  322. data/lib/katello/repository_types/yum.rb +2 -1
  323. data/lib/katello/scheduled_jobs.rb +1 -1
  324. data/lib/katello/tasks/migrate_structure_content_for_deb.rake +105 -0
  325. data/lib/katello/tasks/receptor/extract_orgs.rake +1 -1
  326. data/lib/katello/tasks/reimport.rake +1 -1
  327. data/lib/katello/tasks/repository.rake +19 -9
  328. data/lib/katello/tasks/upgrades/4.1/reupdate_content_import_export_perms.rake +1 -1
  329. data/lib/katello/tasks/upgrades/4.3/fix_url_auth.rake +1 -1
  330. data/lib/katello/version.rb +1 -1
  331. data/locale/action_names.rb +92 -1
  332. data/locale/bn/LC_MESSAGES/katello.mo +0 -0
  333. data/locale/bn/katello.po +259 -28
  334. data/locale/bn_IN/LC_MESSAGES/katello.mo +0 -0
  335. data/locale/bn_IN/katello.po +258 -27
  336. data/locale/ca/LC_MESSAGES/katello.mo +0 -0
  337. data/locale/ca/katello.po +258 -27
  338. data/locale/cs/LC_MESSAGES/katello.mo +0 -0
  339. data/locale/cs/katello.po +258 -30
  340. data/locale/cs_CZ/LC_MESSAGES/katello.mo +0 -0
  341. data/locale/cs_CZ/katello.po +258 -27
  342. data/locale/de/LC_MESSAGES/katello.mo +0 -0
  343. data/locale/de/katello.po +259 -28
  344. data/locale/de_AT/LC_MESSAGES/katello.mo +0 -0
  345. data/locale/de_AT/katello.po +258 -27
  346. data/locale/de_DE/LC_MESSAGES/katello.mo +0 -0
  347. data/locale/de_DE/katello.po +258 -27
  348. data/locale/el/LC_MESSAGES/katello.mo +0 -0
  349. data/locale/el/katello.po +258 -27
  350. data/locale/en/LC_MESSAGES/katello.mo +0 -0
  351. data/locale/en/katello.po +258 -27
  352. data/locale/en_GB/LC_MESSAGES/katello.mo +0 -0
  353. data/locale/en_GB/katello.po +258 -27
  354. data/locale/en_US/LC_MESSAGES/katello.mo +0 -0
  355. data/locale/en_US/katello.po +258 -27
  356. data/locale/es/LC_MESSAGES/katello.mo +0 -0
  357. data/locale/es/katello.po +259 -28
  358. data/locale/et_EE/LC_MESSAGES/katello.mo +0 -0
  359. data/locale/et_EE/katello.po +258 -27
  360. data/locale/fr/LC_MESSAGES/katello.mo +0 -0
  361. data/locale/fr/katello.po +259 -28
  362. data/locale/gl/LC_MESSAGES/katello.mo +0 -0
  363. data/locale/gl/katello.po +258 -27
  364. data/locale/gu/LC_MESSAGES/katello.mo +0 -0
  365. data/locale/gu/katello.po +258 -27
  366. data/locale/he_IL/LC_MESSAGES/katello.mo +0 -0
  367. data/locale/he_IL/katello.po +258 -27
  368. data/locale/hi/LC_MESSAGES/katello.mo +0 -0
  369. data/locale/hi/katello.po +258 -27
  370. data/locale/id/LC_MESSAGES/katello.mo +0 -0
  371. data/locale/id/katello.po +258 -27
  372. data/locale/it/LC_MESSAGES/katello.mo +0 -0
  373. data/locale/it/katello.po +259 -28
  374. data/locale/ja/LC_MESSAGES/katello.mo +0 -0
  375. data/locale/ja/katello.po +259 -28
  376. data/locale/ka/LC_MESSAGES/katello.mo +0 -0
  377. data/locale/ka/katello.po +259 -28
  378. data/locale/katello.pot +1041 -696
  379. data/locale/kn/LC_MESSAGES/katello.mo +0 -0
  380. data/locale/kn/katello.po +258 -27
  381. data/locale/ko/LC_MESSAGES/katello.mo +0 -0
  382. data/locale/ko/katello.po +259 -28
  383. data/locale/ml_IN/LC_MESSAGES/katello.mo +0 -0
  384. data/locale/ml_IN/katello.po +258 -27
  385. data/locale/mr/LC_MESSAGES/katello.mo +0 -0
  386. data/locale/mr/katello.po +258 -27
  387. data/locale/nl_NL/LC_MESSAGES/katello.mo +0 -0
  388. data/locale/nl_NL/katello.po +258 -27
  389. data/locale/or/LC_MESSAGES/katello.mo +0 -0
  390. data/locale/or/katello.po +258 -27
  391. data/locale/pa/LC_MESSAGES/katello.mo +0 -0
  392. data/locale/pa/katello.po +258 -27
  393. data/locale/pl/LC_MESSAGES/katello.mo +0 -0
  394. data/locale/pl/katello.po +258 -27
  395. data/locale/pl_PL/LC_MESSAGES/katello.mo +0 -0
  396. data/locale/pl_PL/katello.po +258 -27
  397. data/locale/pt/LC_MESSAGES/katello.mo +0 -0
  398. data/locale/pt/katello.po +258 -27
  399. data/locale/pt_BR/LC_MESSAGES/katello.mo +0 -0
  400. data/locale/pt_BR/katello.po +259 -28
  401. data/locale/ro/LC_MESSAGES/katello.mo +0 -0
  402. data/locale/ro/katello.po +258 -27
  403. data/locale/ro_RO/LC_MESSAGES/katello.mo +0 -0
  404. data/locale/ro_RO/katello.po +258 -27
  405. data/locale/ru/LC_MESSAGES/katello.mo +0 -0
  406. data/locale/ru/katello.po +259 -28
  407. data/locale/sl/LC_MESSAGES/katello.mo +0 -0
  408. data/locale/sl/katello.po +258 -27
  409. data/locale/sv_SE/LC_MESSAGES/katello.mo +0 -0
  410. data/locale/sv_SE/katello.po +258 -27
  411. data/locale/ta/LC_MESSAGES/katello.mo +0 -0
  412. data/locale/ta/katello.po +259 -28
  413. data/locale/ta_IN/LC_MESSAGES/katello.mo +0 -0
  414. data/locale/ta_IN/katello.po +258 -27
  415. data/locale/te/LC_MESSAGES/katello.mo +0 -0
  416. data/locale/te/katello.po +258 -27
  417. data/locale/tr/LC_MESSAGES/katello.mo +0 -0
  418. data/locale/tr/katello.po +258 -27
  419. data/locale/vi/LC_MESSAGES/katello.mo +0 -0
  420. data/locale/vi/katello.po +258 -27
  421. data/locale/vi_VN/LC_MESSAGES/katello.mo +0 -0
  422. data/locale/vi_VN/katello.po +258 -27
  423. data/locale/zh/LC_MESSAGES/katello.mo +0 -0
  424. data/locale/zh/katello.po +258 -27
  425. data/locale/zh_CN/LC_MESSAGES/katello.mo +0 -0
  426. data/locale/zh_CN/katello.po +259 -28
  427. data/locale/zh_TW/LC_MESSAGES/katello.mo +0 -0
  428. data/locale/zh_TW/katello.po +259 -28
  429. data/vendor/assets/javascripts/katello/chosen.jquery.js +2 -2
  430. data/vendor/assets/javascripts/katello/jquery.ba-bbq.js +1 -1
  431. data/vendor/assets/javascripts/katello/jquery.hoverIntent.js +2 -2
  432. data/webpack/ForemanColumnExtensions/index.js +1 -1
  433. data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard/ContentViewDetailsCard.js +113 -86
  434. data/webpack/components/extensions/HostDetails/DetailsTabCards/HwPropertiesCard.js +7 -2
  435. data/webpack/components/extensions/HostDetails/Tabs/DebsTab/DebsTab.js +31 -4
  436. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.js +1 -1
  437. data/webpack/components/extensions/RegistrationCommands/fields/ActivationKeys.js +1 -7
  438. data/webpack/components/extensions/RegistrationCommands/helpers.js +15 -0
  439. data/webpack/components/extensions/RegistrationCommands/index.js +3 -9
  440. data/webpack/global_index.js +11 -4
  441. data/webpack/redux/actions/RedHatRepositories/helpers.js +2 -0
  442. data/webpack/scenes/ActivationKeys/Details/ActivationKeyDetails.js +4 -0
  443. data/webpack/scenes/ActivationKeys/Details/components/CVEDetailsCard.js +37 -0
  444. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailConfig.js +1 -2
  445. data/webpack/scenes/Hosts/ChangeContentSource/helpers.js +2 -8
  446. data/webpack/scenes/SmartProxy/ExpandableCvDetails.js +22 -2
  447. data/webpack/scenes/SmartProxy/ExpandedSmartProxyRepositories.js +39 -20
  448. data/webpack/scenes/SmartProxy/SmartProxyContentActions.js +2 -1
  449. data/webpack/scenes/SmartProxy/SmartProxyExpandableTable.js +6 -4
  450. data/webpack/scenes/SmartProxy/__tests__/SmartProxyContentTest.js +62 -0
  451. metadata +134 -76
  452. data/app/lib/katello/api/constraints/activation_key_constraint.rb +0 -7
  453. /data/app/lib/katello/{api → routing}/mapper_extensions.rb +0 -0
@@ -7,11 +7,16 @@ module Katello
7
7
  include ForemanTasks::Concerns::ActionSubject
8
8
  include ScopedSearchExtensions
9
9
 
10
+ has_many :content_view_environment_activation_keys, :class_name => "Katello::ContentViewEnvironmentActivationKey",
11
+ :dependent => :destroy, :inverse_of => :activation_key
12
+ has_many :content_view_environments, :through => :content_view_environment_activation_keys,
13
+ :class_name => "Katello::ContentViewEnvironment", :source => :content_view_environment
14
+
15
+ has_many :content_views, :through => :content_view_environments, :class_name => "Katello::ContentView"
16
+ has_many :lifecycle_environments, :through => :content_view_environments, :class_name => "Katello::KTEnvironment"
17
+
10
18
  belongs_to :organization, :inverse_of => :activation_keys
11
- belongs_to :environment, :class_name => "KTEnvironment", :inverse_of => :activation_keys
12
19
  belongs_to :user, :inverse_of => :activation_keys, :class_name => "::User"
13
- belongs_to :content_view, :class_name => "Katello::ContentView", :inverse_of => :activation_keys
14
-
15
20
  has_many :key_host_collections, :class_name => "Katello::KeyHostCollection", :dependent => :destroy
16
21
  has_many :host_collections, :through => :key_host_collections
17
22
 
@@ -25,9 +30,6 @@ module Katello
25
30
  has_many :activation_key_purpose_addons, :class_name => "Katello::ActivationKeyPurposeAddon", :dependent => :destroy, :inverse_of => :activation_key
26
31
  has_many :purpose_addons, :class_name => "Katello::PurposeAddon", :through => :activation_key_purpose_addons
27
32
 
28
- alias_method :lifecycle_environment, :environment
29
-
30
- before_validation :set_default_content_view, :unless => :persisted?
31
33
  before_destroy :validate_destroyable!
32
34
  accepts_nested_attributes_for :purpose_addons
33
35
 
@@ -36,7 +38,6 @@ module Katello
36
38
  validates :name, :presence => true
37
39
  validates :name, :format => { without: /,/, message: _('cannot contain commas') }
38
40
  validates :name, :uniqueness => {:scope => :organization_id}
39
- validate :environment_exists
40
41
  validates :max_hosts, :numericality => {:less_than => 2**31, :allow_nil => true}
41
42
  validates_each :max_hosts do |record, attr, value|
42
43
  if record.unlimited_hosts
@@ -54,15 +55,33 @@ module Katello
54
55
  end
55
56
  end
56
57
  end
57
- validates_with Validators::ContentViewEnvironmentValidator
58
+ validates_with Katello::Validators::GeneratedContentViewValidator
59
+ validate :check_cves
58
60
 
59
- scope :in_environment, ->(env) { where(:environment_id => env) }
61
+ scope :with_environments, ->(lifecycle_environments) do
62
+ joins(:content_view_environment_activation_keys => :content_view_environment).
63
+ where("#{::Katello::ContentViewEnvironment.table_name}.environment_id" => lifecycle_environments)
64
+ end
65
+
66
+ scope :with_content_views, ->(content_views) do
67
+ joins(:content_view_environment_activation_keys => :content_view_environment).
68
+ where("#{::Katello::ContentViewEnvironment.table_name}.content_view_id" => content_views)
69
+ end
70
+
71
+ scope :with_content_view_environments, ->(content_view_environments) do
72
+ joins(:content_view_environment_activation_keys => :content_view_environment).
73
+ where("#{::Katello::ContentViewEnvironment.table_name}.id" => content_view_environments)
74
+ end
60
75
 
61
76
  scoped_search :on => :name, :complete_value => true
62
77
  scoped_search :on => :organization_id, :complete_value => true, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
63
- scoped_search :rename => :environment, :on => :name, :relation => :environment, :complete_value => true
64
- scoped_search :rename => :content_view, :on => :name, :relation => :content_view, :complete_value => true
65
- scoped_search :on => :content_view_id, :complete_value => true, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
78
+
79
+ scoped_search :relation => :content_views, :on => :name, :complete_value => true, :rename => :content_view, :only_explicit => true
80
+ scoped_search :relation => :content_views, :on => :id, :complete_value => true, :rename => :content_view_id, :only_explicit => true
81
+
82
+ scoped_search :relation => :lifecycle_environments, :on => :id, :complete_value => true, :rename => :lifecycle_environment_id, :only_explicit => true
83
+ scoped_search :relation => :lifecycle_environments, :on => :name, :complete_value => true, :rename => :environment, :only_explicit => true
84
+
66
85
  scoped_search :on => :description, :complete_value => true
67
86
  scoped_search :on => :name, :relation => :subscriptions, :rename => :subscription_name, :complete_value => true, :ext_method => :find_by_subscription_name
68
87
  scoped_search :on => :id, :relation => :subscriptions, :rename => :subscription_id, :complete_value => true,
@@ -71,14 +90,85 @@ module Katello
71
90
  scoped_search :on => :purpose_role, :rename => :role, :complete_value => true
72
91
  scoped_search :on => :name, :rename => :addon, :relation => :purpose_addon, :complete_value => true, :ext_method => :find_by_purpose_addons
73
92
 
74
- def environment_exists
75
- if environment_id && environment.nil?
76
- errors.add(:environment, _("ID: %s doesn't exist ") % environment_id)
77
- elsif !environment.nil? && environment.organization != self.organization
78
- errors.add(:environment, _("name: %s doesn't exist ") % environment.name)
93
+ def self.in_environments(envs)
94
+ with_environments(envs)
95
+ end
96
+
97
+ def content_view_environments=(new_cves)
98
+ if new_cves.length > 1 && !Setting['allow_multiple_content_views']
99
+ fail ::Katello::Errors::MultiEnvironmentNotSupportedError,
100
+ _("Assigning an activation key to multiple content view environments is not enabled.")
79
101
  end
102
+ super(new_cves)
103
+ Katello::ContentViewEnvironmentActivationKey.reprioritize_for_activation_key(self, new_cves)
104
+ self.content_view_environments.reload unless self.new_record?
80
105
  end
81
106
 
107
+ def multi_content_view_environment?
108
+ # returns false if there are no content view environments
109
+ content_view_environments.size > 1
110
+ end
111
+
112
+ def single_content_view_environment?
113
+ # also returns false if there are no content view environments
114
+ content_view_environments.size == 1
115
+ end
116
+
117
+ def single_content_view
118
+ if multi_content_view_environment?
119
+ Rails.logger.warn _("Activation key %s has more than one content view. Use #content_views instead.") % name
120
+ end
121
+ content_view_environments&.first&.content_view
122
+ end
123
+
124
+ def content_view
125
+ single_content_view
126
+ end
127
+
128
+ def environment
129
+ single_lifecycle_environment
130
+ end
131
+
132
+ def single_lifecycle_environment
133
+ if multi_content_view_environment?
134
+ Rails.logger.warn _("Activation key %s has more than one lifecycle environment. Use #lifecycle_environments instead.") % name
135
+ end
136
+ content_view_environments&.first&.lifecycle_environment
137
+ end
138
+
139
+ # rubocop:disable Metrics/CyclomaticComplexity
140
+ # rubocop:disable Metrics/PerceivedComplexity
141
+ def assign_single_environment(
142
+ content_view_id: nil, lifecycle_environment_id: nil, environment_id: nil,
143
+ content_view: nil, lifecycle_environment: nil, environment: nil
144
+ )
145
+ lifecycle_environment_id ||= environment_id || lifecycle_environment&.id || environment&.id || self.single_lifecycle_environment&.id
146
+ content_view_id ||= content_view&.id || self.single_content_view&.id
147
+
148
+ unless lifecycle_environment_id
149
+ fail _("Lifecycle environment must be specified")
150
+ end
151
+
152
+ unless content_view_id
153
+ fail _("Content view must be specified")
154
+ end
155
+
156
+ content_view_environment = ::Katello::ContentViewEnvironment
157
+ .where(:content_view_id => content_view_id, :environment_id => lifecycle_environment_id)
158
+ .first_or_create do |cve|
159
+ Rails.logger.info("ContentViewEnvironment not found for content view '#{cve.content_view_name}' and environment '#{cve.environment&.name}'; creating a new one.")
160
+ end
161
+ fail _("Unable to create ContentViewEnvironment. Check the logs for more information.") if content_view_environment.nil?
162
+
163
+ if self.content_view_environments.include?(content_view_environment)
164
+ Rails.logger.info("Activation key '#{name}' already has the content view environment '#{content_view_environment.content_view_name}' and environment '#{content_view_environment.environment&.name}'.")
165
+ else
166
+ self.content_view_environments = [content_view_environment]
167
+ end
168
+ end
169
+ # rubocop:enable Metrics/CyclomaticComplexity
170
+ # rubocop:enable Metrics/PerceivedComplexity
171
+
82
172
  def usage_count
83
173
  subscription_facet_activation_keys.count
84
174
  end
@@ -92,11 +182,15 @@ module Katello
92
182
  end
93
183
 
94
184
  def available_releases
95
- if self.environment
96
- self.environment.available_releases
97
- else
98
- self.organization.library.available_releases
185
+ releases = self.content_view_environments.flat_map do |cve|
186
+ cve.content_view.version(cve.lifecycle_environment).available_releases
99
187
  end
188
+ return self.organization.library.available_releases if releases.blank?
189
+ releases
190
+ end
191
+
192
+ def content_view_environment_labels
193
+ content_view_environments.map(&:label).join(',')
100
194
  end
101
195
 
102
196
  def available_subscriptions
@@ -133,8 +227,9 @@ module Katello
133
227
  def copy(new_name)
134
228
  new_key = ActivationKey.new
135
229
  new_key.name = new_name
136
- new_key.attributes = self.attributes.slice("description", "environment_id", "organization_id", "content_view_id", "max_hosts", "unlimited_hosts")
230
+ new_key.attributes = self.attributes.slice("description", "organization_id", "max_hosts", "unlimited_hosts")
137
231
  new_key.host_collection_ids = self.host_collection_ids
232
+ new_key.content_view_environments = content_view_environments
138
233
  new_key
139
234
  end
140
235
 
@@ -190,12 +285,13 @@ module Katello
190
285
  true
191
286
  end
192
287
 
193
- private
194
-
195
- def set_default_content_view
196
- if self.environment && self.content_view.nil?
197
- self.content_view = self.environment.try(:default_content_view)
288
+ def check_cves
289
+ cves_not_in_org = self.content_view_environments.any? do |cve|
290
+ cve.content_view.organization != cve.environment.organization ||
291
+ self.organization != cve.content_view.organization
198
292
  end
293
+
294
+ errors.add(:base, _("Cannot add content view environments from a different organization")) if cves_not_in_org
199
295
  end
200
296
 
201
297
  apipie :class, desc: "A class representing #{model_name.human} object" do
@@ -40,25 +40,25 @@ module Katello
40
40
  # verify ssl must be validated this way due to presence: <bool> failing on a value of false
41
41
  validates :verify_ssl, if: -> { custom? || rhui? }, inclusion: {
42
42
  in: [true, false],
43
- message: "must be provided for custom or rhui ACS"
43
+ message: "must be provided for custom or rhui ACS",
44
44
  }
45
45
  validates :verify_ssl, if: :simplified?, inclusion: {
46
46
  in: [nil],
47
- message: "cannot be provided for simplified ACS"
47
+ message: "cannot be provided for simplified ACS",
48
48
  }
49
49
  validates :alternate_content_source_type, inclusion: {
50
50
  in: ->(_) { ACS_TYPES },
51
51
  allow_blank: false,
52
- message: ->(_, _) { _("is not a valid type. Must be one of the following: %s") % ACS_TYPES.join(',') }
52
+ message: ->(_, _) { _("is not a valid type. Must be one of the following: %s") % ACS_TYPES.join(',') },
53
53
  }
54
54
  validates :content_type, inclusion: {
55
55
  in: ->(_) { RepositoryTypeManager.defined_repository_types.keys & CONTENT_TYPES },
56
56
  allow_blank: false,
57
- message: ->(_, _) { _("is not allowed for ACS. Must be one of the following: %s") % (RepositoryTypeManager.defined_repository_types.keys & CONTENT_TYPES).sort.join(',') }
57
+ message: ->(_, _) { _("is not allowed for ACS. Must be one of the following: %s") % (RepositoryTypeManager.defined_repository_types.keys & CONTENT_TYPES).sort.join(',') },
58
58
  }
59
59
  validates :content_type, if: -> { rhui? }, inclusion: {
60
60
  in: [::Katello::Repository::YUM_TYPE],
61
- message: "'%{value}' is not valid for RHUI ACS"
61
+ message: "'%{value}' is not valid for RHUI ACS",
62
62
  }
63
63
  validate :constraint_acs_update, on: :update
64
64
  validates_with Validators::AlternateContentSourcePathValidator, :attributes => [:base_url, :subpaths], :if => :custom?
@@ -34,7 +34,7 @@ module Katello
34
34
  end
35
35
 
36
36
  def all_editable?(content_view, environments)
37
- key_query = ActivationKey.where(:content_view_id => content_view, :environment_id => environments)
37
+ key_query = ActivationKey.with_content_views(content_view).with_environments(environments)
38
38
  key_query.count == key_query.editable.count
39
39
  end
40
40
  end
@@ -5,5 +5,12 @@ module Katello
5
5
  def readable?
6
6
  self.content_view.readable? && self.environment.readable?
7
7
  end
8
+
9
+ module ClassMethods
10
+ def readable
11
+ where(:content_view_id => ::Katello::ContentView.readable,
12
+ :environment_id => ::Katello::KTEnvironment.readable)
13
+ end
14
+ end
8
15
  end
9
16
  end
@@ -19,7 +19,7 @@ module Katello
19
19
  validates :upstream_organization_label, presence: true, if: :network_sync?
20
20
 
21
21
  validates :url, presence: true, unless: :export_sync?
22
- validates_with Validators::KatelloUrlFormatValidator, attributes: :url, unless: :export_sync?
22
+ validates_with Validators::KatelloURLFormatValidator, attributes: :url, unless: :export_sync?
23
23
  validates_with Validators::KatelloLabelFormatValidator, attributes: :upstream_organization_label, if: proc { upstream_organization_label.present? }
24
24
  validate :non_redhat_configuration, if: :network_sync?
25
25
 
@@ -8,13 +8,13 @@ module Katello
8
8
  :security_needed => Katello::ErrataStatus::NEEDED_SECURITY_ERRATA,
9
9
  :errata_needed => Katello::ErrataStatus::NEEDED_ERRATA,
10
10
  :updated => Katello::ErrataStatus::UP_TO_DATE,
11
- :unknown => Katello::ErrataStatus::UNKNOWN
11
+ :unknown => Katello::ErrataStatus::UNKNOWN,
12
12
  }.freeze
13
13
 
14
14
  TRACE_STATUS_MAP = {
15
15
  :reboot_needed => Katello::TraceStatus::REQUIRE_REBOOT,
16
16
  :process_restart_needed => Katello::TraceStatus::REQUIRE_PROCESS_RESTART,
17
- :updated => Katello::TraceStatus::UP_TO_DATE
17
+ :updated => Katello::TraceStatus::UP_TO_DATE,
18
18
  }.freeze
19
19
 
20
20
  has_one :errata_status_object, :class_name => 'Katello::ErrataStatus', :foreign_key => 'host_id', :dependent => :destroy
@@ -53,6 +53,17 @@ module Katello
53
53
  scoped_search :relation => :bound_root_repositories, :on => :name, :rename => :repository, :complete_value => true, :ext_method => :find_by_repository_name, :only_explicit => true
54
54
  scoped_search :relation => :bound_content, :on => :label, :rename => :repository_content_label, :complete_value => true, :ext_method => :find_by_repository_content_label, :only_explicit => true
55
55
 
56
+ scoped_search relation: :content_facet, on: :bootc_booted_image, complete_value: true, only_explicit: true
57
+ scoped_search relation: :content_facet, on: :bootc_booted_digest, complete_value: true, only_explicit: true
58
+ scoped_search relation: :content_facet, on: :bootc_available_image, complete_value: true, only_explicit: true
59
+ scoped_search relation: :content_facet, on: :bootc_available_digest, complete_value: true, only_explicit: true
60
+ scoped_search relation: :content_facet, on: :bootc_staged_image, complete_value: true, only_explicit: true
61
+ scoped_search relation: :content_facet, on: :bootc_staged_digest, complete_value: true, only_explicit: true
62
+ scoped_search relation: :content_facet, on: :bootc_rollback_image, complete_value: true, only_explicit: true
63
+ scoped_search relation: :content_facet, on: :bootc_rollback_digest, complete_value: true, only_explicit: true
64
+ scoped_search relation: :content_facet, on: :bootc_booted_image, rename: :image_mode, only_explicit: true, ext_method: :find_by_image_mode,
65
+ operators: ['='], complete_value: { true: true, false: false}
66
+
56
67
  # preserve options set by facets framework, but add new :reject_if statement
57
68
  accepts_nested_attributes_for(
58
69
  :content_facet,
@@ -77,6 +88,17 @@ module Katello
77
88
  end
78
89
 
79
90
  module ClassMethods
91
+ def find_by_image_mode(_key, _operator, value)
92
+ # operator is always '='
93
+ state = ::Foreman::Cast.to_bool(value)
94
+ if state
95
+ hosts = ::Host::Managed.joins(:content_facet).select(:id).where.not("#{::Katello::Host::ContentFacet.table_name}.bootc_booted_image" => nil)
96
+ else
97
+ hosts = ::Host::Managed.joins(:content_facet).select(:id).where("#{::Katello::Host::ContentFacet.table_name}.bootc_booted_image" => nil)
98
+ end
99
+ { :conditions => "#{::Host::Managed.table_name}.id IN (#{hosts.to_sql})" }
100
+ end
101
+
80
102
  def find_by_applicable_errata(_key, operator, value)
81
103
  conditions = sanitize_sql_for_conditions(["#{Katello::Erratum.table_name}.errata_id #{operator} ?", value_to_sql(operator, value)])
82
104
  hosts = ::Host::Managed.joins(:applicable_errata).where(conditions)
@@ -89,7 +89,7 @@ module Katello
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,
92
- :installable_errata, :installable_rpms, to: :content_facet, allow_nil: true
92
+ :installable_errata, :installable_rpms, :image_mode_host?, to: :content_facet, allow_nil: true
93
93
 
94
94
  delegate :release_version, :purpose_role, :purpose_usage, to: :subscription_facet, allow_nil: true
95
95
 
@@ -128,6 +128,10 @@ module Katello
128
128
 
129
129
  scope :with_pools_expiring_in_days, ->(days) { joins(:pools).merge(Katello::Pool.expiring_in_days(days)).distinct }
130
130
 
131
+ scope :image_mode, -> do
132
+ joins(:content_facet).where.not("#{::Katello::Host::ContentFacet.table_name}.bootc_booted_image" => nil)
133
+ end
134
+
131
135
  scoped_search :relation => :host_collections, :on => :id, :complete_value => false, :rename => :host_collection_id, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
132
136
  scoped_search :relation => :host_collections, :on => :name, :complete_value => true, :rename => :host_collection
133
137
  scoped_search :relation => :installed_packages, :on => :nvra, :complete_value => true, :rename => :installed_package, :only_explicit => true
@@ -236,11 +240,11 @@ module Katello
236
240
  hosts = debs.joins(:host_installed_debs).select("#{Katello::HostInstalledDeb.table_name}.host_id as host_id").pluck(:host_id)
237
241
  if hosts.empty?
238
242
  {
239
- :conditions => "1=0"
243
+ :conditions => "1=0",
240
244
  }
241
245
  else
242
246
  {
243
- :conditions => "#{::Host::Managed.table_name}.id IN (#{hosts.join(',')})"
247
+ :conditions => "#{::Host::Managed.table_name}.id IN (#{hosts.join(',')})",
244
248
  }
245
249
  end
246
250
  end
@@ -339,7 +343,7 @@ module Katello
339
343
  {
340
344
  name: module_stream["name"],
341
345
  stream: module_stream["stream"],
342
- context: module_stream["context"]
346
+ context: module_stream["context"],
343
347
  }
344
348
  end
345
349
  if streams.any?
@@ -382,7 +386,7 @@ module Katello
382
386
  host_id: self.id,
383
387
  available_module_stream_id: new_id,
384
388
  installed_profiles: module_stream["installed_profiles"],
385
- status: status
389
+ status: status,
386
390
  }
387
391
  end
388
392
  HostAvailableModuleStream.insert_all(hams_to_create) if hams_to_create.any?
@@ -610,7 +614,8 @@ class ::Host::Managed::Jail < Safemode::Jail
610
614
  :host_collections, :pools, :hypervisor_host, :installed_debs,
611
615
  :installed_packages, :traces_helpers, :advisory_ids, :package_names_for_job_template,
612
616
  :filtered_entitlement_quantity_consumed, :bound_repositories,
613
- :single_content_view, :single_lifecycle_environment, :release_version
617
+ :single_content_view, :single_lifecycle_environment, :release_version,
618
+ :purpose_role, :purpose_usage
614
619
  end
615
620
 
616
621
  class ActiveRecord::Associations::CollectionProxy::Jail < Safemode::Jail
@@ -33,7 +33,7 @@ module Katello
33
33
  has_many :product_contents, :through => :products
34
34
  has_many :repositories, :through => :products
35
35
  has_one :cdn_configuration, :class_name => "Katello::CdnConfiguration", :dependent => :destroy, :inverse_of => :organization
36
-
36
+ has_many :flatpak_remotes, :class_name => "Katello::FlatpakRemote", :dependent => :destroy, :inverse_of => :organization
37
37
  #older association
38
38
  has_many :org_tasks, :dependent => :destroy, :class_name => "Katello::TaskStatus", :inverse_of => :organization
39
39
 
@@ -201,7 +201,7 @@ module Katello
201
201
  defaults = {
202
202
  :message => _("Informable Type must be one of the following [ %{list} ]") %
203
203
  { :list => ALLOWED_DEFAULT_INFO_TYPES.join(", ") },
204
- :error => RuntimeError
204
+ :error => RuntimeError,
205
205
  }
206
206
  options = defaults.merge(options)
207
207
 
@@ -214,9 +214,9 @@ module Katello
214
214
  products.any?(&:syncable_content?)
215
215
  end
216
216
 
217
- def enabled_product_content_for(roots)
217
+ def enabled_product_content_for(content_ids)
218
218
  Katello::ProductContent.joins(:content).where(:product_id => self.products.enabled,
219
- "#{::Katello::Content.table_name}.cp_content_id" => roots.select(:content_id))
219
+ "#{::Katello::Content.table_name}.cp_content_id" => content_ids)
220
220
  end
221
221
 
222
222
  def enabled_product_content
@@ -32,7 +32,7 @@ module Katello
32
32
  'name' => name,
33
33
  'major' => major.to_s,
34
34
  'minor' => minor.to_s,
35
- 'family' => 'Redhat'
35
+ 'family' => 'Redhat',
36
36
  }
37
37
 
38
38
  return ::Redhat.create!(params)
@@ -1,4 +1,3 @@
1
- require 'proxy_api'
2
1
  require 'proxy_api/pulp'
3
2
  require 'proxy_api/pulp_node'
4
3
  require 'proxy_api/container_gateway'
@@ -63,7 +62,7 @@ module Katello
63
62
 
64
63
  validates :download_policy, inclusion: {
65
64
  :in => DOWNLOAD_POLICIES,
66
- :message => _("must be one of the following: %s") % DOWNLOAD_POLICIES.join(', ')
65
+ :message => _("must be one of the following: %s") % DOWNLOAD_POLICIES.join(', '),
67
66
  }
68
67
  scope :with_content, -> { with_features(PULP_FEATURE, PULP_NODE_FEATURE, PULP3_FEATURE) }
69
68
 
@@ -141,43 +140,88 @@ module Katello
141
140
  URI.parse(self.url).host != self.registration_host
142
141
  end
143
142
 
144
- def update_content_counts!
145
- # {:content_view_versions=>{87=>{:repositories=>{1=>{:metadata=>{},:counts=>{:rpms=>98, :module_streams=>9898}}}}}
146
- new_content_counts = { content_view_versions: {} }
147
- smart_proxy_helper = ::Katello::SmartProxyHelper.new(self)
148
- repos = smart_proxy_helper.repositories_available_to_capsule
149
-
150
- repos&.each do |repo|
151
- repo_mirror_service = repo.backend_service(self).with_mirror_adapter
152
- repo_content_counts = repo_mirror_service.latest_content_counts
153
- translated_counts = {metadata: {}, counts: {}}
154
- translated_counts[:metadata] = {
155
- env_id: repo.environment_id,
156
- library_instance_id: repo.library_instance_or_self.id,
157
- product_id: repo.product_id,
158
- content_type: repo.content_type
159
- }
160
- repo_content_counts&.each do |name, count|
161
- count = count[:count]
162
- # Some content units in Pulp have the same model
163
- if name == 'rpm.package' && repo.content_counts['srpm'] > 0
164
- translated_counts[:counts]['srpm'] = repo_mirror_service.count_by_pulpcore_type(::Katello::Pulp3::Srpm)
165
- translated_counts[:counts]['rpm'] = count - translated_counts[:counts]['srpm']
166
- elsif name == 'container.manifest' && repo.content_counts['docker_manifest_list'] > 0
167
- translated_counts[:counts]['docker_manifest_list'] = repo_mirror_service.count_by_pulpcore_type(::Katello::Pulp3::DockerManifestList)
168
- translated_counts[:counts]['docker_manifest'] = count - translated_counts[:counts]['docker_manifest_list']
169
- else
170
- translated_counts[:counts][::Katello::Pulp3::PulpContentUnit.katello_name_from_pulpcore_name(name, repo)] = count
171
- end
143
+ def update_content_counts!(environment: nil, content_view: nil, repository: nil)
144
+ if environment.nil? && content_view.nil? && repository.nil?
145
+ global_content_counts
146
+ else
147
+ smart_proxy_helper = ::Katello::SmartProxyHelper.new(self)
148
+ repos = repository ? [repository] : smart_proxy_helper.repositories_available_to_capsule(environment, content_view)
149
+ self.with_lock do
150
+ repos_content_count(repos)
172
151
  end
173
- new_content_counts[:content_view_versions][repo.content_view_version_id] ||= { repositories: {}}
174
- # Store counts on capsule of archived repos which are reused across environment copies
175
- # of the archived repo corresponding to each environment CV version is promoted to.
176
- new_content_counts[:content_view_versions][repo.content_view_version_id][:repositories][repo.id] = translated_counts
177
152
  end
153
+ end
154
+
155
+ #{"content_view_versions"=>
156
+ # {"5"=>
157
+ # {"repositories"=>
158
+ # {"20"=>{"counts"=>{"rpm"=>32, "erratum"=>4}, "metadata"=>{"env_id"=>2, "product_id"=>1, "content_type"=>"yum", "library_instance_id"=>14}},
159
+ # "21"=>{"counts"=>{"file"=>3}, "metadata"=>{"env_id"=>2, "product_id"=>1, "content_type"=>"file", "library_instance_id"=>15}},
160
+ # "22"=>{"counts"=>{"file"=>3}, "metadata"=>{"env_id"=>3, "product_id"=>1, "content_type"=>"file", "library_instance_id"=>15}},
161
+ # "23"=>{"counts"=>{"rpm"=>32, "erratum"=>4}, "metadata"=>{"env_id"=>3, "product_id"=>1, "content_type"=>"yum", "library_instance_id"=>14}}}}}}
162
+ #
163
+
164
+ def repos_content_count(repos, reset: false)
165
+ new_content_counts = initialize_content_counts(reset: reset)
166
+ repos.each do |repo|
167
+ process_repository(repo, new_content_counts)
168
+ end
169
+ remove_unavailable_versions(new_content_counts)
178
170
  update(content_counts: new_content_counts)
179
171
  end
180
172
 
173
+ def initialize_content_counts(reset: false)
174
+ if reset
175
+ { content_view_versions: {} }.with_indifferent_access
176
+ else
177
+ (content_counts&.deep_dup || { content_view_versions: {} }).with_indifferent_access
178
+ end
179
+ end
180
+
181
+ def process_repository(repo, content_counts)
182
+ repo_mirror_service = repo.backend_service(self).with_mirror_adapter
183
+ repo_content_counts = repo_mirror_service.latest_content_counts
184
+ translated_counts = translate_counts(repo, repo_mirror_service, repo_content_counts)
185
+ content_counts[:content_view_versions][repo.content_view_version_id.to_s] ||= { repositories: {}}
186
+ content_counts[:content_view_versions][repo.content_view_version_id.to_s][:repositories][repo.id.to_s] = translated_counts
187
+ end
188
+
189
+ def translate_counts(repo, repo_mirror_service, repo_content_counts)
190
+ translated_counts = {metadata: {}, counts: {}}
191
+ translated_counts[:metadata] = {
192
+ env_id: repo.environment_id,
193
+ library_instance_id: repo.library_instance_or_self.id,
194
+ product_id: repo.product_id,
195
+ content_type: repo.content_type,
196
+ }
197
+ repo_content_counts&.each do |name, count|
198
+ count = count[:count]
199
+ if name == 'rpm.package' && repo.content_counts['srpm'] > 0
200
+ translated_counts[:counts]['srpm'] = repo_mirror_service.count_by_pulpcore_type(::Katello::Pulp3::Srpm)
201
+ translated_counts[:counts]['rpm'] = count - translated_counts[:counts]['srpm']
202
+ elsif name == 'container.manifest' && repo.content_counts['docker_manifest_list'] > 0
203
+ translated_counts[:counts]['docker_manifest_list'] = repo_mirror_service.count_by_pulpcore_type(::Katello::Pulp3::DockerManifestList)
204
+ translated_counts[:counts]['docker_manifest'] = count - translated_counts[:counts]['docker_manifest_list']
205
+ else
206
+ translated_counts[:counts][::Katello::Pulp3::PulpContentUnit.katello_name_from_pulpcore_name(name, repo)] = count
207
+ end
208
+ end
209
+ translated_counts
210
+ end
211
+
212
+ def remove_unavailable_versions(content_counts)
213
+ version_ids_available_to_proxy = Katello::ContentViewVersion.in_environment(lifecycle_environments)&.pluck(:id)&.uniq
214
+ version_ids_in_count_map = content_counts[:content_view_versions].keys&.map(&:to_i)
215
+ version_ids_to_remove = version_ids_in_count_map - version_ids_available_to_proxy
216
+ version_ids_to_remove.each { |id| content_counts[:content_view_versions].delete(id.to_s) }
217
+ end
218
+
219
+ def global_content_counts
220
+ smart_proxy_helper = ::Katello::SmartProxyHelper.new(self)
221
+ repos = smart_proxy_helper.repositories_available_to_capsule
222
+ repos_content_count(repos, reset: true)
223
+ end
224
+
181
225
  def sync_container_gateway
182
226
  if has_feature?(::SmartProxy::CONTAINER_GATEWAY_FEATURE)
183
227
  update_container_repo_list
@@ -253,6 +297,7 @@ module Katello
253
297
  end
254
298
 
255
299
  def pulp3_ssl_configuration(config, connection_adapter = Faraday.default_adapter)
300
+ config.ssl_ca_file = ::Cert::Certs.backend_ca_cert_file(:pulp)
256
301
  case connection_adapter
257
302
  when :excon
258
303
  config.ssl_client_cert = ::Cert::Certs.ssl_client_cert_filename
@@ -261,7 +306,7 @@ module Katello
261
306
  config.ssl_client_cert = ::Cert::Certs.ssl_client_cert
262
307
  config.ssl_client_key = ::Cert::Certs.ssl_client_key
263
308
  else
264
- fail "Unexpected connection_adapter #{Faraday.default_adapter}! Cannot continue, this is likely a bug."
309
+ fail "Unexpected connection_adapter #{connection_adapter}! Cannot continue, this is likely a bug."
265
310
  end
266
311
  end
267
312
 
@@ -276,8 +321,8 @@ module Katello
276
321
  used: -1,
277
322
  free: -1,
278
323
  percentage: -1,
279
- label: 'cloud-storage'
280
- }.with_indifferent_access
324
+ label: 'cloud-storage',
325
+ }.with_indifferent_access,
281
326
  ]
282
327
  else
283
328
  [
@@ -287,8 +332,8 @@ module Katello
287
332
  used: storage['used'],
288
333
  free: storage['free'],
289
334
  percentage: (storage['used'] / storage['total'].to_f * 100).to_i,
290
- label: 'pulp_dir'
291
- }.with_indifferent_access
335
+ label: 'pulp_dir',
336
+ }.with_indifferent_access,
292
337
  ]
293
338
  end
294
339
  end
@@ -73,18 +73,18 @@ module Katello
73
73
  current_subs == new_url_subs
74
74
  end
75
75
 
76
- def self.substitute_content_path(arch: nil, releasever: nil, content_path:)
76
+ def self.substitute_content_path(content_path:, arch: nil, releasever: nil)
77
77
  arch = nil if arch == "noarch"
78
78
  substitutions = {
79
79
  :releasever => releasever,
80
- :basearch => arch
80
+ :basearch => arch,
81
81
  }.compact
82
82
  path = substitutions.inject(content_path) do |path_url, (key, value)|
83
83
  path_url.gsub("$#{key}", value)
84
84
  end
85
85
  {
86
86
  path: path,
87
- substitutions: substitutions
87
+ substitutions: substitutions,
88
88
  }
89
89
  end
90
90
  end