katello 4.14.0 → 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 (432) 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 +22 -18
  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 +2 -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 -14
  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/content_view/delete_repository_references.rb +6 -2
  121. data/app/lib/actions/pulp3/orchestration/content_view_version/export_library.rb +1 -1
  122. data/app/lib/actions/pulp3/orchestration/repository/create.rb +6 -1
  123. data/app/lib/actions/pulp3/orchestration/repository/trigger_update_repo_cert_guard.rb +1 -1
  124. data/app/lib/actions/pulp3/repository/initialize.rb +17 -0
  125. data/app/lib/actions/pulp3/repository/refresh_distribution.rb +1 -1
  126. data/app/lib/katello/api/constraints/register_with_activation_key_constraint.rb +11 -0
  127. data/app/lib/katello/concerns/base_template_scope_extensions.rb +1 -1
  128. data/app/lib/katello/http_resource.rb +6 -6
  129. data/app/lib/katello/messaging/stomp_connection.rb +4 -4
  130. data/app/lib/katello/resources/candlepin/activation_key.rb +1 -1
  131. data/app/lib/katello/resources/candlepin/owner.rb +1 -1
  132. data/app/lib/katello/resources/candlepin/product.rb +1 -1
  133. data/app/lib/katello/resources/candlepin.rb +1 -1
  134. data/app/lib/katello/resources/cdn/katello_cdn.rb +3 -3
  135. data/app/lib/katello/resources/cdn.rb +1 -1
  136. data/app/lib/katello/resources/discovery/container.rb +5 -3
  137. data/app/lib/katello/resources/discovery/yum.rb +3 -1
  138. data/app/lib/katello/resources/registry.rb +0 -3
  139. data/app/lib/katello/util/candlepin_repository_checker.rb +2 -2
  140. data/app/lib/katello/util/cveak_migrator.rb +38 -0
  141. data/app/lib/katello/util/deb.rb +9 -0
  142. data/app/lib/katello/util/deduplication_migrator.rb +8 -8
  143. data/app/lib/katello/util/model.rb +2 -2
  144. data/app/lib/katello/util/search.rb +5 -5
  145. data/app/lib/katello/util/task_status.rb +19 -19
  146. data/app/lib/katello/util/url_matcher.rb +3 -3
  147. data/app/lib/katello/validators/content_view_environment_org_validator.rb +2 -1
  148. data/app/lib/katello/validators/katello_url_format_validator.rb +2 -2
  149. data/app/mailers/katello/errata_mailer.rb +1 -4
  150. data/app/models/katello/activation_key.rb +123 -27
  151. data/app/models/katello/alternate_content_source.rb +5 -5
  152. data/app/models/katello/authorization/activation_key.rb +1 -1
  153. data/app/models/katello/authorization/content_view_environment.rb +7 -0
  154. data/app/models/katello/cdn_configuration.rb +1 -1
  155. data/app/models/katello/concerns/content_facet_host_extensions.rb +24 -2
  156. data/app/models/katello/concerns/host_managed_extensions.rb +29 -22
  157. data/app/models/katello/concerns/organization_extensions.rb +4 -4
  158. data/app/models/katello/concerns/redhat_extensions.rb +1 -1
  159. data/app/models/katello/concerns/smart_proxy_extensions.rb +84 -39
  160. data/app/models/katello/content.rb +3 -3
  161. data/app/models/katello/content_view.rb +15 -18
  162. data/app/models/katello/content_view_environment.rb +56 -15
  163. data/app/models/katello/content_view_environment_activation_key.rb +20 -0
  164. data/app/models/katello/content_view_erratum_filter_rule.rb +1 -1
  165. data/app/models/katello/content_view_filter.rb +2 -2
  166. data/app/models/katello/content_view_history.rb +1 -1
  167. data/app/models/katello/content_view_repository.rb +1 -1
  168. data/app/models/katello/content_view_version.rb +3 -3
  169. data/app/models/katello/content_view_version_export_history.rb +2 -2
  170. data/app/models/katello/content_view_version_import_history.rb +1 -1
  171. data/app/models/katello/events/delete_latest_content_view_version.rb +1 -1
  172. data/app/models/katello/flatpak_remote.rb +11 -0
  173. data/app/models/katello/flatpak_remote_repository.rb +12 -0
  174. data/app/models/katello/flatpak_remote_repository_manifest.rb +10 -0
  175. data/app/models/katello/glue/candlepin/activation_key.rb +1 -1
  176. data/app/models/katello/glue/candlepin/candlepin_object.rb +1 -1
  177. data/app/models/katello/glue/candlepin/pool.rb +1 -1
  178. data/app/models/katello/glue/pulp/repos.rb +1 -1
  179. data/app/models/katello/host/content_facet.rb +33 -17
  180. data/app/models/katello/host/info_provider.rb +2 -4
  181. data/app/models/katello/host/subscription_facet.rb +3 -3
  182. data/app/models/katello/host_available_module_stream.rb +1 -1
  183. data/app/models/katello/installed_product.rb +2 -2
  184. data/app/models/katello/kt_environment.rb +11 -6
  185. data/app/models/katello/ping.rb +2 -3
  186. data/app/models/katello/repository.rb +40 -6
  187. data/app/models/katello/rhel_lifecycle_status.rb +10 -10
  188. data/app/models/katello/root_repository.rb +14 -18
  189. data/app/models/katello/task_status.rb +1 -1
  190. data/app/models/katello/upstream_pool.rb +2 -2
  191. data/app/presenters/katello/product_content_presenter.rb +2 -2
  192. data/app/presenters/katello/repository_presenter.rb +3 -3
  193. data/app/presenters/katello/sync_status_presenter.rb +3 -3
  194. data/app/services/cert/certs.rb +6 -2
  195. data/app/services/katello/candlepin_event_listener.rb +1 -1
  196. data/app/services/katello/event_monitor/poller_thread.rb +1 -1
  197. data/app/services/katello/event_queue.rb +1 -1
  198. data/app/services/katello/product_content_finder.rb +10 -10
  199. data/app/services/katello/product_content_importer.rb +1 -1
  200. data/app/services/katello/pulp3/alternate_content_source.rb +2 -2
  201. data/app/services/katello/pulp3/ansible_collection.rb +1 -1
  202. data/app/services/katello/pulp3/api/apt.rb +4 -0
  203. data/app/services/katello/pulp3/content.rb +1 -0
  204. data/app/services/katello/pulp3/content_view_version/export.rb +3 -10
  205. data/app/services/katello/pulp3/content_view_version/export_validator.rb +1 -1
  206. data/app/services/katello/pulp3/content_view_version/import.rb +2 -2
  207. data/app/services/katello/pulp3/content_view_version/import_gpg_keys.rb +1 -1
  208. data/app/services/katello/pulp3/content_view_version/importable_products.rb +2 -2
  209. data/app/services/katello/pulp3/content_view_version/importable_repositories.rb +4 -4
  210. data/app/services/katello/pulp3/content_view_version/metadata_generator.rb +2 -2
  211. data/app/services/katello/pulp3/deb.rb +35 -1
  212. data/app/services/katello/pulp3/docker_manifest.rb +1 -1
  213. data/app/services/katello/pulp3/docker_manifest_list.rb +6 -2
  214. data/app/services/katello/pulp3/docker_tag.rb +1 -1
  215. data/app/services/katello/pulp3/erratum.rb +2 -2
  216. data/app/services/katello/pulp3/file_unit.rb +1 -1
  217. data/app/services/katello/pulp3/generic_content_unit.rb +1 -1
  218. data/app/services/katello/pulp3/module_stream.rb +2 -2
  219. data/app/services/katello/pulp3/repository/ansible_collection.rb +1 -1
  220. data/app/services/katello/pulp3/repository/apt.rb +22 -16
  221. data/app/services/katello/pulp3/repository/docker.rb +2 -2
  222. data/app/services/katello/pulp3/repository/file.rb +1 -1
  223. data/app/services/katello/pulp3/repository/generic.rb +1 -1
  224. data/app/services/katello/pulp3/repository/yum.rb +7 -7
  225. data/app/services/katello/pulp3/repository.rb +15 -9
  226. data/app/services/katello/pulp3/repository_mirror.rb +3 -3
  227. data/app/services/katello/registration_manager.rb +23 -6
  228. data/app/services/katello/repository_type.rb +3 -3
  229. data/app/services/katello/smart_proxy_helper.rb +3 -3
  230. data/app/services/katello/ui_notifications/content_view/delete_latest_version_failure.rb +1 -1
  231. data/app/services/katello/ui_notifications/subscriptions/expire_soon.rb +3 -3
  232. data/app/services/katello/ui_notifications/subscriptions/manifest_expire_soon_warning.rb +3 -3
  233. data/app/services/katello/ui_notifications/task_notification.rb +2 -2
  234. data/app/services/katello/upstream_connection_checker.rb +1 -1
  235. data/app/views/foreman/job_templates/install_errata_by_search_query.erb +1 -1
  236. data/app/views/foreman/job_templates/install_errata_by_search_query_-_katello_ansible_default.erb +1 -1
  237. data/app/views/katello/api/v2/activation_keys/base.json.rabl +43 -8
  238. data/app/views/katello/api/v2/alternate_content_sources/base.json.rabl +1 -1
  239. data/app/views/katello/api/v2/capsule_content/sync_status.json.rabl +5 -5
  240. data/app/views/katello/api/v2/common/_metadata.json.rabl +1 -1
  241. data/app/views/katello/api/v2/content_credentials/show.json.rabl +1 -1
  242. data/app/views/katello/api/v2/content_facet/base.json.rabl +15 -6
  243. data/app/views/katello/api/v2/content_facet/show.json.rabl +1 -1
  244. data/app/views/katello/api/v2/content_view_environments/index.json.rabl +7 -0
  245. data/app/views/katello/api/v2/content_view_environments/show.json.rabl +33 -0
  246. data/app/views/katello/api/v2/content_view_filter_rules/show.json.rabl +1 -1
  247. data/app/views/katello/api/v2/content_view_filters/show.json.rabl +1 -1
  248. data/app/views/katello/api/v2/content_view_versions/base.json.rabl +3 -3
  249. data/app/views/katello/api/v2/content_views/base.json.rabl +4 -3
  250. data/app/views/katello/api/v2/content_views/show.json.rabl +1 -2
  251. data/app/views/katello/api/v2/debs/backend.json.rabl +7 -0
  252. data/app/views/katello/api/v2/debs/base.json.rabl +4 -0
  253. data/app/views/katello/api/v2/debs/show.json.rabl +2 -0
  254. data/app/views/katello/api/v2/docker_manifest_lists/show.json.rabl +1 -0
  255. data/app/views/katello/api/v2/docker_tags/_base.json.rabl +2 -2
  256. data/app/views/katello/api/v2/environments/show.json.rabl +4 -4
  257. data/app/views/katello/api/v2/gpg_keys/show.json.rabl +1 -1
  258. data/app/views/katello/api/v2/host_collections/base.json.rabl +1 -1
  259. data/app/views/katello/api/v2/hosts/base.json.rabl +2 -2
  260. data/app/views/katello/api/v2/package_groups/base.json.rabl +2 -2
  261. data/app/views/katello/api/v2/products/show.json.rabl +2 -2
  262. data/app/views/katello/api/v2/repositories/show.json.rabl +1 -1
  263. data/app/views/katello/api/v2/repository_sets/show.json.rabl +1 -1
  264. data/app/views/katello/api/v2/subscriptions/base.json.rabl +1 -1
  265. data/app/views/katello/api/v2/subscriptions/show.json.rabl +3 -3
  266. data/app/views/katello/api/v2/sync_plans/show.json.rabl +1 -1
  267. data/app/views/katello/sync_management/index.html.erb +2 -2
  268. data/config/initializers/inflections.rb +11 -0
  269. data/config/katello.yaml.example +4 -10
  270. data/config/routes/api/registry.rb +0 -2
  271. data/config/routes/api/rhsm.rb +1 -4
  272. data/config/routes/api/v2.rb +2 -3
  273. data/db/migrate/20140716211853_repo_rename_feed_to_url.rb +1 -1
  274. data/db/migrate/20141003210742_add_docker_container_registry_url_to_providers.rb +1 -1
  275. data/db/migrate/20150224083608_remove_docker_registry_url.rb +1 -1
  276. data/db/migrate/20160808002834_add_files.rb +1 -1
  277. data/db/migrate/20161014133811_move_content_view_version_description_to_histories.rb +1 -1
  278. data/db/migrate/20200818192230_update_system_purpose_status.rb +1 -1
  279. data/db/migrate/20201012172713_remove_gpg_key_perms.rb +1 -1
  280. data/db/migrate/20210322142311_add_auth_url_token_to_root_repositories.rb +1 -1
  281. data/db/migrate/20211220185935_clean_duplicate_content_units.rb +2 -2
  282. data/db/migrate/20230717150442_change_change_content_source_job_template_name.rb +1 -1
  283. data/db/migrate/20240207191223_remove_entitlement_mode_host_statuses.rb +1 -1
  284. data/db/migrate/20240508100434_add_content_id_to_katello_repository.rb +5 -0
  285. data/db/migrate/20240730163043_add_content_view_environment_activation_key.rb +87 -0
  286. data/db/migrate/20240806130902_add_more_deb_fields.rb +15 -0
  287. data/db/migrate/20240903194428_add_priority_to_content_view_environment_activation_key.rb +5 -0
  288. data/db/migrate/20241007200316_add_fields_to_katello_docker_manifest_list.rb +8 -0
  289. data/db/migrate/20241007212705_add_bootc_facts_to_content_facet.rb +27 -0
  290. data/db/migrate/20241025151105_remove_pulp3_migrated_hrefs_from_content_tables.rb +10 -0
  291. data/db/migrate/20241030181402_create_katello_flatpak_tables.rb +41 -0
  292. data/db/seeds.d/106-mail_notifications.rb +9 -9
  293. data/db/seeds.d/108-subcription-bookmarks.rb +1 -1
  294. data/db/seeds.d/109-katello-notification-blueprints.rb +21 -21
  295. data/db/seeds.d/110-content-view-autopublish.rb +5 -5
  296. data/db/seeds.d/111-container-image-bookmarks.rb +1 -1
  297. data/db/seeds.d/111-upgrade_tasks.rb +1 -1
  298. data/engines/bastion/app/assets/javascripts/bastion/i18n/i18n.module.js +4 -0
  299. data/engines/bastion/lib/bastion/engine.rb +1 -1
  300. data/engines/bastion/lib/bastion.rb +1 -1
  301. data/engines/bastion/vendor/assets/javascripts/bastion/angular-gettext/angular-gettext.js +5 -1
  302. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-repository-sets.controller.js +16 -0
  303. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-info.html +29 -15
  304. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-repository-sets.html +13 -0
  305. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/views/activation-keys.html +2 -0
  306. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-host-collections-modal.controller.js +2 -0
  307. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-host-collections-modal.html +4 -4
  308. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js +0 -1
  309. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/debs/debs.routes.js +9 -0
  310. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/debs/details/views/deb-dependencies.html +54 -0
  311. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/debs/details/views/deb-info.html +13 -1
  312. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/debs/details/views/deb.html +8 -1
  313. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/views/apply-errata-confirm.html +1 -1
  314. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +4 -0
  315. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +11 -0
  316. data/engines/bastion_katello/app/assets/stylesheets/bastion_katello/activation_keys.scss +1 -1
  317. data/engines/bastion_katello/lib/bastion_katello/engine.rb +1 -1
  318. data/lib/katello/engine.rb +17 -15
  319. data/lib/katello/permission_creator.rb +51 -49
  320. data/lib/katello/permissions/host_permissions.rb +4 -4
  321. data/lib/katello/permissions/organization_permissions.rb +4 -4
  322. data/lib/katello/permissions/registry_permissions.rb +1 -1
  323. data/lib/katello/permissions/roles_permissions.rb +1 -1
  324. data/lib/katello/permissions/user_permissions.rb +1 -1
  325. data/lib/katello/plugin.rb +14 -8
  326. data/lib/katello/repository_types/docker.rb +4 -2
  327. data/lib/katello/repository_types/ostree.rb +5 -3
  328. data/lib/katello/repository_types/python.rb +1 -1
  329. data/lib/katello/repository_types/yum.rb +2 -1
  330. data/lib/katello/scheduled_jobs.rb +1 -1
  331. data/lib/katello/tasks/migrate_structure_content_for_deb.rake +105 -0
  332. data/lib/katello/tasks/receptor/extract_orgs.rake +1 -1
  333. data/lib/katello/tasks/reimport.rake +1 -1
  334. data/lib/katello/tasks/repository.rake +19 -9
  335. data/lib/katello/tasks/upgrades/4.1/reupdate_content_import_export_perms.rake +1 -1
  336. data/lib/katello/tasks/upgrades/4.3/fix_url_auth.rake +1 -1
  337. data/lib/katello/version.rb +1 -1
  338. data/locale/action_names.rb +92 -1
  339. data/locale/bn/LC_MESSAGES/katello.mo +0 -0
  340. data/locale/bn/katello.po +259 -28
  341. data/locale/bn_IN/katello.po +258 -27
  342. data/locale/ca/LC_MESSAGES/katello.mo +0 -0
  343. data/locale/ca/katello.po +258 -27
  344. data/locale/cs/katello.po +258 -30
  345. data/locale/cs_CZ/LC_MESSAGES/katello.mo +0 -0
  346. data/locale/cs_CZ/katello.po +258 -27
  347. data/locale/de/LC_MESSAGES/katello.mo +0 -0
  348. data/locale/de/katello.po +259 -28
  349. data/locale/de_AT/katello.po +258 -27
  350. data/locale/de_DE/katello.po +258 -27
  351. data/locale/el/LC_MESSAGES/katello.mo +0 -0
  352. data/locale/el/katello.po +258 -27
  353. data/locale/en/katello.po +258 -27
  354. data/locale/en_GB/katello.po +258 -27
  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/katello.po +258 -27
  359. data/locale/fr/LC_MESSAGES/katello.mo +0 -0
  360. data/locale/fr/katello.po +259 -28
  361. data/locale/gl/katello.po +258 -27
  362. data/locale/gu/katello.po +258 -27
  363. data/locale/he_IL/katello.po +258 -27
  364. data/locale/hi/katello.po +258 -27
  365. data/locale/id/katello.po +258 -27
  366. data/locale/it/LC_MESSAGES/katello.mo +0 -0
  367. data/locale/it/katello.po +259 -28
  368. data/locale/ja/LC_MESSAGES/katello.mo +0 -0
  369. data/locale/ja/katello.po +259 -28
  370. data/locale/ka/LC_MESSAGES/katello.mo +0 -0
  371. data/locale/ka/katello.po +259 -28
  372. data/locale/katello.pot +1041 -696
  373. data/locale/kn/katello.po +258 -27
  374. data/locale/ko/LC_MESSAGES/katello.mo +0 -0
  375. data/locale/ko/katello.po +259 -28
  376. data/locale/ml_IN/katello.po +258 -27
  377. data/locale/mr/katello.po +258 -27
  378. data/locale/nl_NL/LC_MESSAGES/katello.mo +0 -0
  379. data/locale/nl_NL/katello.po +258 -27
  380. data/locale/or/katello.po +258 -27
  381. data/locale/pa/katello.po +258 -27
  382. data/locale/pl/LC_MESSAGES/katello.mo +0 -0
  383. data/locale/pl/katello.po +258 -27
  384. data/locale/pl_PL/katello.po +258 -27
  385. data/locale/pt/katello.po +258 -27
  386. data/locale/pt_BR/LC_MESSAGES/katello.mo +0 -0
  387. data/locale/pt_BR/katello.po +259 -28
  388. data/locale/ro/katello.po +258 -27
  389. data/locale/ro_RO/katello.po +258 -27
  390. data/locale/ru/LC_MESSAGES/katello.mo +0 -0
  391. data/locale/ru/katello.po +259 -28
  392. data/locale/sl/katello.po +258 -27
  393. data/locale/sv_SE/katello.po +258 -27
  394. data/locale/ta/LC_MESSAGES/katello.mo +0 -0
  395. data/locale/ta/katello.po +259 -28
  396. data/locale/ta_IN/katello.po +258 -27
  397. data/locale/te/katello.po +258 -27
  398. data/locale/tr/katello.po +258 -27
  399. data/locale/vi/katello.po +258 -27
  400. data/locale/vi_VN/katello.po +258 -27
  401. data/locale/zh/katello.po +258 -27
  402. data/locale/zh_CN/LC_MESSAGES/katello.mo +0 -0
  403. data/locale/zh_CN/katello.po +259 -28
  404. data/locale/zh_TW/LC_MESSAGES/katello.mo +0 -0
  405. data/locale/zh_TW/katello.po +259 -28
  406. data/vendor/assets/javascripts/katello/chosen.jquery.js +2 -2
  407. data/vendor/assets/javascripts/katello/jquery.ba-bbq.js +1 -1
  408. data/vendor/assets/javascripts/katello/jquery.hoverIntent.js +2 -2
  409. data/webpack/ForemanColumnExtensions/index.js +1 -1
  410. data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard/ContentViewDetailsCard.js +113 -86
  411. data/webpack/components/extensions/HostDetails/DetailsTabCards/HwPropertiesCard.js +7 -2
  412. data/webpack/components/extensions/HostDetails/Tabs/DebsTab/DebsTab.js +31 -4
  413. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.js +1 -1
  414. data/webpack/components/extensions/RegistrationCommands/fields/ActivationKeys.js +1 -7
  415. data/webpack/components/extensions/RegistrationCommands/helpers.js +15 -0
  416. data/webpack/components/extensions/RegistrationCommands/index.js +3 -9
  417. data/webpack/global_index.js +11 -4
  418. data/webpack/redux/actions/RedHatRepositories/helpers.js +8 -6
  419. data/webpack/scenes/ActivationKeys/Details/ActivationKeyDetails.js +4 -0
  420. data/webpack/scenes/ActivationKeys/Details/components/CVEDetailsCard.js +37 -0
  421. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailConfig.js +1 -2
  422. data/webpack/scenes/Hosts/ChangeContentSource/helpers.js +2 -8
  423. data/webpack/scenes/SmartProxy/ExpandableCvDetails.js +22 -2
  424. data/webpack/scenes/SmartProxy/ExpandedSmartProxyRepositories.js +39 -20
  425. data/webpack/scenes/SmartProxy/SmartProxyContentActions.js +2 -1
  426. data/webpack/scenes/SmartProxy/SmartProxyExpandableTable.js +6 -4
  427. data/webpack/scenes/SmartProxy/__tests__/SmartProxyContentTest.js +62 -0
  428. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +6 -4
  429. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +1 -1
  430. metadata +86 -76
  431. data/app/lib/katello/api/constraints/activation_key_constraint.rb +0 -7
  432. /data/app/lib/katello/{api → routing}/mapper_extensions.rb +0 -0
@@ -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
@@ -38,8 +38,6 @@ module Katello
38
38
 
39
39
  has_many :filters, :dependent => :destroy, :class_name => "Katello::ContentViewFilter"
40
40
 
41
- has_many :activation_keys, :class_name => "Katello::ActivationKey", :dependent => :restrict_with_exception
42
-
43
41
  has_many :content_view_environment_content_facets, :class_name => "Katello::ContentViewEnvironmentContentFacet",
44
42
  :through => :content_view_environments
45
43
  has_many :content_facets, :class_name => "Katello::Host::ContentFacet", :through => :content_view_environment_content_facets,
@@ -47,6 +45,11 @@ module Katello
47
45
  has_many :hosts, :class_name => "::Host::Managed", :through => :content_facets,
48
46
  :inverse_of => :content_views
49
47
 
48
+ has_many :content_view_environment_activation_keys, :class_name => "Katello::ContentViewEnvironmentActivationKey",
49
+ :through => :content_view_environments
50
+ has_many :activation_keys, :class_name => "Katello::ActivationKey", :through => :content_view_environment_activation_keys,
51
+ :inverse_of => :content_views
52
+
50
53
  has_many :hostgroup_content_facets, :class_name => "Katello::Hostgroup::ContentFacet",
51
54
  :inverse_of => :content_view, :dependent => :nullify
52
55
  has_many :hostgroups, :class_name => "::Hostgroup", :through => :hostgroup_content_facets,
@@ -121,7 +124,7 @@ module Katello
121
124
  kcv = Katello::ContentView.table_name
122
125
  kcvc = Katello::ContentViewComponent.table_name
123
126
  { :conditions => "#{kcv}.composite = 't' AND #{kcv}.id IN (SELECT #{kcvc}.composite_content_view_id FROM #{kcvc} WHERE #{kcvc}.content_view_id IN (SELECT #{kcv}.id FROM #{kcv} WHERE #{kcv}.name #{operator} ?))",
124
- :parameter => [value]
127
+ :parameter => [value],
125
128
  }
126
129
  end
127
130
 
@@ -141,7 +144,7 @@ module Katello
141
144
  library_import: 3,
142
145
  repository_import: 4,
143
146
  library_export_syncable: 5,
144
- repository_export_syncable: 6
147
+ repository_export_syncable: 6,
145
148
  }, _prefix: true
146
149
 
147
150
  set_crud_hooks :content_view
@@ -298,7 +301,7 @@ module Katello
298
301
  {
299
302
  :version => v.version,
300
303
  :published => v.created_at.to_s,
301
- :environments => v.environments.map { |e| e.name }
304
+ :environments => v.environments.map { |e| e.name },
302
305
  }
303
306
  end
304
307
 
@@ -448,10 +451,7 @@ module Katello
448
451
  # update errata applicability counts for all hosts in the CV & LE
449
452
  Location.no_taxonomy_scope do
450
453
  User.as_anonymous_admin do
451
- ::Katello::Host::ContentFacet.in_content_views_and_environments(
452
- content_views: [self],
453
- lifecycle_environments: [environment]
454
- ).each do |facet|
454
+ ::Katello::Host::ContentFacet.with_content_views(self).with_environments(environment).each do |facet|
455
455
  facet.update_applicability_counts
456
456
  facet.update_errata_status
457
457
  rescue NoMethodError
@@ -699,10 +699,7 @@ module Katello
699
699
  def check_orphaned_content_facets!(environments: [])
700
700
  Location.no_taxonomy_scope do
701
701
  User.as_anonymous_admin do
702
- ::Katello::Host::ContentFacet.in_content_views_and_environments(
703
- content_views: [self],
704
- lifecycle_environments: environments
705
- ).each do |facet|
702
+ ::Katello::Host::ContentFacet.with_content_views(self).with_environments(environments).each do |facet|
706
703
  unless facet.host
707
704
  fail _("Orphaned content facets for deleted hosts exist for the content view and environment. Please run rake task : katello:clean_orphaned_facets and try again!")
708
705
  end
@@ -716,11 +713,11 @@ module Katello
716
713
  errors = []
717
714
 
718
715
  dependencies = { hosts: _("hosts"),
719
- activation_keys: _("activation keys")
716
+ activation_keys: _("activation keys"),
720
717
  }
721
718
 
722
719
  dependencies.each do |key, name|
723
- if (models = self.association(key).scope.in_environment(env)).any?
720
+ if (models = self.association(key).scope.in_environments(env)).any?
724
721
  errors << _("Cannot remove '%{view}' from environment '%{env}' due to associated %{dependent}: %{names}.") %
725
722
  { view: self.name, env: env.name, dependent: name, names: models.map(&:name).join(", ") }
726
723
  end
@@ -736,7 +733,7 @@ module Katello
736
733
 
737
734
  dependencies = { environments: _("environments"),
738
735
  hosts: _("hosts"),
739
- activation_keys: _("activation keys")
736
+ activation_keys: _("activation keys"),
740
737
  }
741
738
 
742
739
  dependencies.each do |key, name|
@@ -778,7 +775,7 @@ module Katello
778
775
  content_views.push(
779
776
  {
780
777
  id: cv_id,
781
- name: cv_name
778
+ name: cv_name,
782
779
  }
783
780
  )
784
781
  end
@@ -893,7 +890,7 @@ module Katello
893
890
 
894
891
  def blocking_task
895
892
  blocking_task_labels = [
896
- ::Actions::Katello::ContentView::Publish.name
893
+ ::Actions::Katello::ContentView::Publish.name,
897
894
  ]
898
895
  ForemanTasks::Task::DynflowTask.where(:label => blocking_task_labels)
899
896
  .where.not(state: 'stopped')
@@ -15,6 +15,9 @@ module Katello
15
15
  has_many :content_view_environment_content_facets, :class_name => "Katello::ContentViewEnvironmentContentFacet", :dependent => :destroy, :inverse_of => :content_view_environment
16
16
  has_many :content_facets, through: :content_view_environment_content_facets, :class_name => "::Katello::Host::ContentFacet", :inverse_of => :content_view_environments
17
17
 
18
+ has_many :content_view_environment_activation_keys, :class_name => "Katello::ContentViewEnvironmentActivationKey", :dependent => :destroy, :inverse_of => :content_view_environment
19
+ has_many :activation_keys, through: :content_view_environment_activation_keys, :class_name => "::Katello::ActivationKey", :inverse_of => :content_view_environments
20
+
18
21
  validates_lengths_from_database
19
22
  validates :environment_id, uniqueness: {scope: :content_view_id}, presence: true
20
23
  validates :content_view_id, presence: true
@@ -25,20 +28,24 @@ module Katello
25
28
 
26
29
  scope :non_default, -> { joins(:content_view).where("katello_content_views.default" => false) }
27
30
  scope :default, -> { joins(:content_view).where("katello_content_views.default" => true) }
31
+ scope :non_generated, -> { where(content_view: ::Katello::ContentView.ignore_generated) }
32
+
33
+ scoped_search :on => :id, :complete_value => true
34
+
28
35
  alias :lifecycle_environment :environment
36
+ has_one :organization, :through => :environment
37
+
38
+ def self.in_organization(org)
39
+ where(environment_id: org.kt_environments)
40
+ end
29
41
 
30
42
  def self.for_content_facets(content_facets)
31
- joins(:content_view_environment_content_facets, :content_facets).where("#{Katello::ContentViewEnvironmentContentFacet.table_name}.content_facet_id" => content_facets).uniq
43
+ joins(:content_facets).
44
+ where("#{Katello::ContentViewEnvironmentContentFacet.table_name}.content_facet_id" => content_facets)
32
45
  end
33
46
 
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
47
+ def self.with_label_and_org(label, organization: Organization.current)
48
+ joins(:environment, :content_view).where("#{Katello::KTEnvironment.table_name}.organization_id" => organization, label: label).first
42
49
  end
43
50
 
44
51
  # retrieve the owning environment for this content view environment.
@@ -51,20 +58,54 @@ module Katello
51
58
  end
52
59
 
53
60
  def activation_keys
54
- content_view.activation_keys.in_environment(environment)
61
+ ::Katello::ActivationKey.with_content_views(self.content_view).with_environments(self.environment)
55
62
  end
56
63
 
57
64
  def default_environment?
58
65
  content_view.default? && environment.library?
59
66
  end
60
67
 
61
- def candlepin_name
62
- return environment.label if default_environment?
63
- "#{environment.label}/#{content_view.label}"
68
+ def priority(content_object)
69
+ case content_object
70
+ when Katello::ActivationKey
71
+ content_view_environment_activation_keys.find_by(:activation_key_id => content_object.id).try(:priority)
72
+ when Katello::Host::ContentFacet
73
+ content_view_environment_content_facets.find_by(:content_facet_id => content_object.id).try(:priority)
74
+ end
64
75
  end
65
76
 
66
- def priority(content_facet)
67
- content_view_environment_content_facets.find_by(:content_facet_id => content_facet.id).try(:priority)
77
+ def self.fetch_content_view_environments(organization:, labels: [], ids: [])
78
+ # Must ensure CVEs remain in the same order.
79
+ # Using ActiveRecord .where will return them in a different order.
80
+ id_errors = []
81
+ label_errors = []
82
+ cves = []
83
+ if ids.present?
84
+ ids.each do |id|
85
+ cve = ::Katello::ContentViewEnvironment.find_by(id: id)
86
+ if cve.blank?
87
+ id_errors << id
88
+ else
89
+ cves << cve
90
+ end
91
+ end
92
+ elsif labels.present?
93
+ environment_names = labels.map(&:strip)
94
+ environment_names.each do |name|
95
+ cve = with_label_and_org(name, organization: organization)
96
+ if cve.blank?
97
+ label_errors << name
98
+ else
99
+ cves << cve
100
+ end
101
+ end
102
+ end
103
+ if labels.present? && labels.length != cves.length
104
+ fail HttpErrors::UnprocessableEntity, _("No content view environments found with names: %{names}") % {names: label_errors.join(', ')} if label_errors.present?
105
+ elsif ids.present? && ids.length != cves.length
106
+ fail HttpErrors::UnprocessableEntity, _("No content view environments found with ids: %{ids}") % {ids: id_errors.join(', ')} if id_errors.present?
107
+ end
108
+ cves
68
109
  end
69
110
 
70
111
  private
@@ -0,0 +1,20 @@
1
+ module Katello
2
+ class ContentViewEnvironmentActivationKey < Katello::Model
3
+ belongs_to :content_view_environment, :class_name => "::Katello::ContentViewEnvironment", :inverse_of => :content_view_environment_activation_keys
4
+ belongs_to :activation_key, :class_name => "::Katello::ActivationKey", :inverse_of => :content_view_environment_activation_keys
5
+
6
+ default_scope { order(:priority => :asc) }
7
+
8
+ validates :content_view_environment_id, presence: true
9
+ validates :activation_key_id, presence: true, unless: :new_record?
10
+
11
+ def self.reprioritize_for_activation_key(activation_key, new_cves)
12
+ new_order = new_cves.map do |cve|
13
+ activation_key.content_view_environment_activation_keys.find_by(:content_view_environment_id => cve.id)
14
+ end
15
+ new_order.compact.each_with_index do |cveak, index|
16
+ cveak.update_column(:priority, index)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -23,7 +23,7 @@ module Katello
23
23
  :inclusion => {
24
24
  :in => DATE_TYPES,
25
25
  :allow_blank => false,
26
- :message => (_("must be one of the following: %s") % DATE_TYPES.join(', '))
26
+ :message => (_("must be one of the following: %s") % DATE_TYPES.join(', ')),
27
27
  }
28
28
 
29
29
  def self.in_content_views(content_view_ids)
@@ -41,7 +41,7 @@ module Katello
41
41
  def self.yum(include_module_streams = true)
42
42
  types = [::Katello::ContentViewPackageGroupFilter.name,
43
43
  ::Katello::ContentViewErratumFilter.name,
44
- ::Katello::ContentViewPackageFilter.name
44
+ ::Katello::ContentViewPackageFilter.name,
45
45
  ]
46
46
  types << ::Katello::ContentViewModuleStreamFilter.name if include_module_streams
47
47
  where(:type => types)
@@ -74,7 +74,7 @@ module Katello
74
74
  ContentViewErratumFilter => ERRATA,
75
75
  ContentViewPackageGroupFilter => PACKAGE_GROUP,
76
76
  ContentViewDockerFilter => DOCKER,
77
- ContentViewModuleStreamFilter => MODULE_STREAM
77
+ ContentViewModuleStreamFilter => MODULE_STREAM,
78
78
  }[self.class]
79
79
  end
80
80
 
@@ -33,7 +33,7 @@ module Katello
33
33
  promotion: 2,
34
34
  removal: 3,
35
35
  export: 4,
36
- importing: 5
36
+ importing: 5,
37
37
  }
38
38
 
39
39
  def content_view
@@ -6,7 +6,7 @@ module Katello
6
6
  Repository::FILE_TYPE,
7
7
  Repository::DEB_TYPE,
8
8
  Repository::ANSIBLE_COLLECTION_TYPE,
9
- Katello::RepositoryTypeManager.generic_repository_types(false).keys.flatten
9
+ Katello::RepositoryTypeManager.generic_repository_types(false).keys.flatten,
10
10
  ].flatten.freeze
11
11
 
12
12
  ALLOWED_IMPORT_REPOSITORY_TYPES = Repository::EXPORTABLE_TYPES
@@ -357,7 +357,7 @@ module Katello
357
357
  def auto_publish_composites!
358
358
  metadata = {
359
359
  description: _("Auto Publish - Triggered by '%s'") % self.name,
360
- triggered_by: self.id
360
+ triggered_by: self.id,
361
361
  }
362
362
  self.content_view.auto_publish_components.pluck(:composite_content_view_id).each do |composite_id|
363
363
  ::Katello::EventQueue.push_event(::Katello::Events::AutoPublishCompositeView::EVENT_TYPE, composite_id) do |attrs|
@@ -443,12 +443,12 @@ module Katello
443
443
  repo.slice(:id, :name, :label, :arch, :major, :minor,
444
444
  :content_type, :os_versions, :url, :content_id).merge(redhat: repo.redhat?, root: repo.root.id,
445
445
  product: repo.product.slice(:id, :label))
446
- end
446
+ end,
447
447
  }
448
448
  end
449
449
  self.applied_filters = {
450
450
  applied_filters: applied_filters_and_rules,
451
- dependency_solving: content_view.solve_dependencies
451
+ dependency_solving: content_view.solve_dependencies,
452
452
  }
453
453
  save!
454
454
  end
@@ -18,7 +18,7 @@ module Katello
18
18
  validates :export_type, :presence => true,
19
19
  :inclusion => { :in => EXPORT_TYPES,
20
20
  :allow_blank => false,
21
- :message => _("must be one of the following: %s" % EXPORT_TYPES.join(', '))
21
+ :message => _("must be one of the following: %s" % EXPORT_TYPES.join(', ')),
22
22
  }
23
23
  validates :metadata, :presence => true
24
24
  serialize :metadata, Hash
@@ -51,7 +51,7 @@ module Katello
51
51
  self.export_type ||= self.class.export_type_from_metadata(metadata)
52
52
  end
53
53
 
54
- def self.generate_audit_comment(user:, content_view_version:, from_version: nil, metadata:)
54
+ def self.generate_audit_comment(user:, content_view_version:, metadata:, from_version: nil)
55
55
  export_type = export_type_from_metadata(metadata)
56
56
  if content_view_version.content_view.generated_for_library?
57
57
  export_descriptor = "library export"
@@ -35,7 +35,7 @@ module Katello
35
35
  def self.generate_audit_comment(user:, content_view_name:)
36
36
  truncate_audit_comment(_("Content imported by %{user} into content view '%{name}'") % {
37
37
  user: user.to_label,
38
- name: content_view_name
38
+ name: content_view_name,
39
39
  })
40
40
  end
41
41
  end
@@ -33,7 +33,7 @@ module Katello
33
33
  private
34
34
 
35
35
  def deliver_failure_notification
36
- ::Katello::UINotifications::ContentView::DelelteLatestVersionFailure.deliver!(content_view)
36
+ ::Katello::UINotifications::ContentView::DeleteLatestVersionFailure.deliver!(content_view)
37
37
  end
38
38
  end
39
39
  end
@@ -0,0 +1,11 @@
1
+ module Katello
2
+ class FlatpakRemote < Katello::Model
3
+ has_many :remote_repositories, dependent: :destroy, class_name: 'Katello::FlatpakRemoteRepository'
4
+ has_many :remote_repository_manifests, through: :remote_repositories, source: :remote_repository_manifests
5
+ belongs_to :organization, inverse_of: :flatpak_remotes
6
+
7
+ validates :name, presence: true
8
+ validates :url, presence: true
9
+ validates :organization_id, presence: true
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ module Katello
2
+ class FlatpakRemoteRepository < Katello::Model
3
+ belongs_to :flatpak_remote, inverse_of: :remote_repositories
4
+ has_many :remote_repository_manifests, dependent: :destroy, class_name: 'Katello::FlatpakRemoteRepositoryManifest'
5
+
6
+ validates :flatpak_remote_id, presence: true
7
+ validates :name, presence: true
8
+ validates :label, presence: true
9
+
10
+ alias_attribute :manifests, :remote_repository_manifests
11
+ end
12
+ end
@@ -0,0 +1,10 @@
1
+ module Katello
2
+ class FlatpakRemoteRepositoryManifest < Katello::Model
3
+ belongs_to :remote_repository,
4
+ class_name: 'Katello::FlatpakRemoteRepository',
5
+ foreign_key: 'flatpak_remote_repository_id',
6
+ inverse_of: :remote_repository_manifests
7
+ validates :flatpak_remote_repository_id, presence: true
8
+ validates :name, presence: true
9
+ end
10
+ end
@@ -31,7 +31,7 @@ module Katello
31
31
  key_pools.map do |key_pool|
32
32
  {
33
33
  :amount => (key_pool[:quantity] || 0),
34
- :id => key_pool[:poolId]
34
+ :id => key_pool[:poolId],
35
35
  }.with_indifferent_access
36
36
  end
37
37
  end
@@ -21,7 +21,7 @@ module Katello
21
21
  def import_candlepin_record(record:, organization:)
22
22
  db_attrs = {
23
23
  cp_id: record['id'],
24
- organization: organization
24
+ organization: organization,
25
25
  }
26
26
 
27
27
  yield(db_attrs) if block_given?
@@ -74,7 +74,7 @@ module Katello
74
74
  end
75
75
  end
76
76
 
77
- def determine_subscription(product_id: nil, source_stack_id: nil, organization:)
77
+ def determine_subscription(organization:, product_id: nil, source_stack_id: nil)
78
78
  if source_stack_id
79
79
  self.stacking_subscription(organization, source_stack_id)
80
80
  # isn't it an error if we have a sourceStackID but no stacking subscription?
@@ -95,7 +95,7 @@ module Katello
95
95
  :canceled,
96
96
  :error,
97
97
  :paused,
98
- :running
98
+ :running,
99
99
  ]
100
100
 
101
101
  presented.each do |_repoid, task|