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
@@ -1,4 +1,4 @@
1
- $(document).ready(function() {
1
+ $(document).on('loadJS', function() {
2
2
  $('body').on('click', '#download_debug_cert_key', function(e) {
3
3
  e.preventDefault();
4
4
  window.location.href = $("#download_debug_cert_key").data("url");
@@ -360,21 +360,21 @@ KT.content_actions = (function () {
360
360
 
361
361
  KT.content.populateRepoStatus();
362
362
 
363
- $("#select_all").click(KT.content.select_all);
364
- $("#select_none").click(KT.content.select_none);
365
- $("#collapse_all").click(KT.content.collapse_all);
366
- $("#expand_all").click(KT.content.expand_all);
363
+ $("#select_all").on("click", KT.content.select_all);
364
+ $("#select_none").on("click", KT.content.select_none);
365
+ $("#collapse_all").on("click", KT.content.collapse_all);
366
+ $("#expand_all").on("click", KT.content.expand_all);
367
367
 
368
368
  KT.content.showAll();
369
369
  KT.content.select_repo();
370
370
 
371
- $("#products_table").delegate(".cancel_sync", "click", function () {
371
+ $("#products_table").on("click", ".cancel_sync", function () {
372
372
  var repo_id = $(this).parents("tr").attr("data-id");
373
373
  KT.content_actions.cancelSync(repo_id, $(this));
374
374
  });
375
375
 
376
376
  $("#sync_product_form")
377
- .bind("ajax:success", function (evt, data, status, xhr) {
377
+ .on("ajax:success", function (evt, data, status, xhr) {
378
378
  var ids = [];
379
379
  $.each(data, function (index, item) {
380
380
  ids.push(item.id);
@@ -383,13 +383,13 @@ $("#sync_product_form")
383
383
  });
384
384
  KT.content_actions.addSyncing(ids);
385
385
  })
386
- .bind("ajax:beforeSend", function (evt, data, status, xhr) {
386
+ .on("ajax:beforeSend", function (evt, data, status, xhr) {
387
387
  if ($("input[name='repoids[]']:checked").length === 0) {
388
388
  return false;
389
389
  }
390
390
  });
391
391
 
392
- $("#sync_toggle").change(function () {
392
+ $("#sync_toggle").on("change", function () {
393
393
  var img = "<img src='" + KT.common.spinner_path() + "'>";
394
394
  $("#sync_toggle_cont").append(img);
395
395
  if ($(this).is(":checked")) {
@@ -401,5 +401,5 @@ $("#sync_toggle").change(function () {
401
401
  });
402
402
 
403
403
  $.each($("input[name='repoids[]']"), function (index, checkbox) {
404
- $(checkbox).click(KT.content.select_repo);
404
+ $(checkbox).on("click", KT.content.select_repo);
405
405
  });
@@ -20,13 +20,13 @@ KT.env_content_view_selector = (function() {
20
20
  saved_content_view_id = current_content_view_id;
21
21
 
22
22
  env_select = KT.path_select(env_div_id, name, envs, {select_mode:'single', inline: true});
23
- $(document).unbind(env_select.get_select_event());
23
+ $(document).off(env_select.get_select_event());
24
24
 
25
25
  // select the current environment
26
26
  env_select.select(current_env_id);
27
27
 
28
28
  // if the user changes the environment, update the available content views
29
- $(document).bind(env_select.get_select_event(), function(event) {
29
+ $(document).on(env_select.get_select_event(), function(event) {
30
30
  update_content_views(KT.utils.keys(env_select.get_selected()));
31
31
  enable_buttons();
32
32
  });
@@ -34,7 +34,7 @@ KT.env_content_view_selector = (function() {
34
34
  // render the content view selector and the save/cancel buttons
35
35
  render_selector(content_view_div, selector_buttons_div, content_views, current_content_view_id);
36
36
 
37
- $('#content_view_select').unbind('change').change(function() {
37
+ $('#content_view_select').off('change').on("change", function() {
38
38
  enable_buttons();
39
39
  });
40
40
  disable_buttons();
@@ -44,7 +44,7 @@ KT.env_content_view_selector = (function() {
44
44
  },
45
45
  register_cancel = function() {
46
46
  var cancel_button = $('.cancel_env_content_view');
47
- cancel_button.unbind('click').click(function(e) {
47
+ cancel_button.off('click').on("click", function(e) {
48
48
  var current_env = KT.utils.values(env_select.get_selected());
49
49
 
50
50
  if ((current_env.length === 0) || (current_env[0]['id'] !== saved_env_id)) {
@@ -60,7 +60,7 @@ KT.env_content_view_selector = (function() {
60
60
  },
61
61
  register_save = function() {
62
62
  var save_button = $('.save_env_content_view');
63
- save_button.unbind('click').click(function(e) {
63
+ save_button.off('click').on("click", function(e) {
64
64
  e.preventDefault();
65
65
  disable_buttons();
66
66
 
@@ -52,7 +52,7 @@ KT.path_select = function(div_id, name, environments, options_in){
52
52
  }
53
53
 
54
54
  if(options.submit_button_text){
55
- path_selector.find('.KT_path_select_submit_button').click(function(e){
55
+ path_selector.find('.KT_path_select_submit_button').on("click", function(e){
56
56
  if(!options.inline) {
57
57
  path_selector.hide();
58
58
  }
@@ -61,7 +61,7 @@ KT.path_select = function(div_id, name, environments, options_in){
61
61
  }
62
62
 
63
63
  if(options.cancel_button_text){
64
- path_selector.find('.KT_path_select_cancel_button').click(function(e){
64
+ path_selector.find('.KT_path_select_cancel_button').on("click", function(e){
65
65
  clear_selected();
66
66
  if(!options.inline) {
67
67
  path_selector.hide();
@@ -77,7 +77,7 @@ KT.path_select = function(div_id, name, environments, options_in){
77
77
  path_selector.hide();
78
78
 
79
79
  if(options.activate_on_click) {
80
- div.click(function(e) { path_selector.show(); });
80
+ div.on("click", function(e) { path_selector.show(); });
81
81
  } else {
82
82
  div.hoverIntent({
83
83
  over:function(){ path_selector.show(); },
@@ -96,7 +96,7 @@ KT.path_select = function(div_id, name, environments, options_in){
96
96
  disable_all();
97
97
  }
98
98
 
99
- $(document).mouseup(function(e){
99
+ $(document).on("mouseup", function(e){
100
100
  if(path_selector.has(e.target).length === 0 && !options.inline) {
101
101
  path_selector.hide();
102
102
  }
@@ -259,11 +259,11 @@ KT.path_select = function(div_id, name, environments, options_in){
259
259
  }
260
260
  if(!options.inline){
261
261
  path_selector.show();
262
- scroll_obj.bind('#' + KT.common.escapeId(paths_id));
262
+ scroll_obj.on('#' + KT.common.escapeId(paths_id));
263
263
  path_selector.hide();
264
264
  }
265
265
  else {
266
- scroll_obj.bind('#' + KT.common.escapeId(paths_id));
266
+ scroll_obj.on('#' + KT.common.escapeId(paths_id));
267
267
  }
268
268
  },
269
269
  get_submit_event = function(){
@@ -1,4 +1,4 @@
1
- $(document).ready(function(){
1
+ $(document).on('loadJS', function(){
2
2
  var form_id = $('#new_subpanel'),
3
3
  form_submit_id = form_id.find('.subpanel_create'),
4
4
  url_after_submit = form_submit_id.data('url_after_submit');
@@ -118,7 +118,7 @@ module Katello
118
118
  schema: "label",
119
119
  organization: segments[2],
120
120
  product: segments[3],
121
- name: segments[4]
121
+ name: segments[4],
122
122
  }
123
123
  elsif segments.length >= 8 && segments[0] == "" && segments[1] == "v2" &&
124
124
  segments[2] == "id" && (segments[6] == "blobs" || segments[6] == "manifests")
@@ -128,7 +128,7 @@ module Katello
128
128
  schema: "id",
129
129
  organization: segments[3],
130
130
  product: segments[4],
131
- name: segments[5]
131
+ name: segments[5],
132
132
  }
133
133
  else
134
134
  return {valid_format: false}
@@ -354,7 +354,7 @@ module Katello
354
354
  container_push_name: @container_path_input,
355
355
  container_push_name_format: @container_push_name_format
356
356
  )
357
- sync_task(::Actions::Katello::Repository::CreateRoot, root, @container_path_input)
357
+ sync_task(::Actions::Katello::Repository::CreateContainerPushRoot, root, @container_path_input)
358
358
  end
359
359
  end
360
360
 
@@ -505,7 +505,7 @@ module Katello
505
505
  # We're keeping the 'expires_at' field for now to maintain compatibility with existing
506
506
  # smart-proxies during 4.11 upgrades. This is not a part of OAuth2 spec.
507
507
  # TODO - Remove 'expires_at' in Katello 4.13 or later.
508
- expires_at: expiry_time.rfc3339
508
+ expires_at: expiry_time.rfc3339,
509
509
  }
510
510
  end
511
511
 
@@ -639,7 +639,7 @@ module Katello
639
639
 
640
640
  authenticate # to set current_user, not to enforce
641
641
  options = {
642
- resource_class: Katello::Repository
642
+ resource_class: Katello::Repository,
643
643
  }
644
644
  params[:per_page] = params[:n] || 25
645
645
  params[:search] = params[:q]
@@ -649,7 +649,7 @@ module Katello
649
649
 
650
650
  results = {
651
651
  num_results: search_results[:subtotal],
652
- query: params[:search]
652
+ query: params[:search],
653
653
  }
654
654
  results[:results] = search_results[:results].collect do |repository|
655
655
  { name: repository[:container_repository_name], description: repository[:description] }
@@ -672,7 +672,7 @@ module Katello
672
672
  tags.sort!
673
673
  render json: {
674
674
  name: @repository.container_repository_name,
675
- tags: tags
675
+ tags: tags,
676
676
  }
677
677
  end
678
678
 
@@ -115,7 +115,7 @@ module Katello
115
115
  :id => env.cp_id,
116
116
  :name => env.label,
117
117
  :display_name => env.name,
118
- :description => env.content_view.description
118
+ :description => env.content_view.description,
119
119
  }
120
120
  end
121
121
 
@@ -390,6 +390,11 @@ module Katello
390
390
  activation_key = organization.activation_keys.find_by(:name => ak_name)
391
391
  fail HttpErrors::NotFound, _("Couldn't find activation key '%s'") % ak_name unless activation_key
392
392
 
393
+ if activation_key.multi_content_view_environment? && !Setting['allow_multiple_content_views']
394
+ fail HttpErrors::BadRequest, _("Activation key '%s' is associated to multiple environments"\
395
+ " and registering to multiple environments is not enabled.") % ak_name
396
+ end
397
+
393
398
  if !activation_key.unlimited_hosts && activation_key.usage_count >= activation_key.max_hosts
394
399
  fail Errors::MaxHostsReachedException, _("Max Hosts (%{limit}) reached for activation key '%{name}'") %
395
400
  { :limit => activation_key.max_hosts, :name => activation_key.name }
@@ -1,19 +1,43 @@
1
1
  module Katello
2
- class Api::V2::ActivationKeysController < Api::V2::ApiController
2
+ class Api::V2::ActivationKeysController < Api::V2::ApiController # rubocop:disable Metrics/ClassLength
3
3
  include Katello::Concerns::FilteredAutoCompleteSearch
4
4
  include Katello::Concerns::Api::V2::ContentOverridesController
5
+ include Katello::Concerns::Api::V2::MultiCVParamsHandling
5
6
  before_action :verify_presence_of_organization_or_environment, :only => [:index]
6
- before_action :find_environment, :only => [:index, :create, :update]
7
7
  before_action :find_optional_organization, :only => [:index, :create, :show]
8
- before_action :find_content_view, :only => [:index]
9
8
  before_action :find_authorized_katello_resource, :only => [:show, :update, :destroy, :available_releases,
10
9
  :available_host_collections, :add_host_collections, :remove_host_collections,
11
10
  :content_override, :add_subscriptions, :remove_subscriptions,
12
11
  :subscriptions]
12
+ before_action :find_content_view_environments, :only => [:create, :update]
13
13
  before_action :verify_simple_content_access_disabled, :only => [:add_subscriptions]
14
14
  before_action :validate_release_version, :only => [:create, :update]
15
15
 
16
- wrap_parameters :include => (ActivationKey.attribute_names + %w(host_collection_ids service_level auto_attach purpose_role purpose_usage purpose_addons content_view_environment))
16
+ wrap_parameters :include => (ActivationKey.attribute_names + %w(host_collection_ids service_level auto_attach purpose_role purpose_usage purpose_addons content_view_environments))
17
+
18
+ def_param_group :activation_key do
19
+ param :organization_id, :number, :desc => N_("organization identifier"), :required => true
20
+ param :description, String, :desc => N_("description")
21
+ param :max_hosts, :number, :desc => N_("maximum number of registered content hosts")
22
+ param :unlimited_hosts, :bool, :desc => N_("can the activation key have unlimited hosts")
23
+ param :release_version, String, :desc => N_("content release version")
24
+ param :service_level, String, :desc => N_("service level")
25
+ param :auto_attach, :bool, :desc => N_("auto attach subscriptions upon registration"), deprecated: true
26
+ param :purpose_usage, String, :desc => N_("Sets the system purpose usage")
27
+ param :purpose_role, String, :desc => N_("Sets the system purpose usage")
28
+ param :purpose_addons, Array, :desc => N_("Sets the system add-ons")
29
+
30
+ param :environment, Hash, :desc => N_("Hash containing the Id of the single lifecycle environment to be associated with the activation key."), deprecated: true
31
+ param :content_view_id, Integer, :desc => N_("Id of the single content view to be associated with the activation key.")
32
+ param :environment_id, Integer, :desc => N_("Id of the single lifecycle environment to be associated with the activation key.")
33
+ param :content_view_environments, Array, :desc => N_("Comma-separated list of content view environment labels to be associated with the activation key,"\
34
+ " in the format of 'lifecycle_environment_label/content_view_label'."\
35
+ " Ignored if content_view_environment_ids is specified, or if content_view_id and lifecycle_environment_id are specified."\
36
+ " Requires allow_multiple_content_views setting to be on.")
37
+ param :content_view_environment_ids, Array, :desc => N_("Array of content view environment ids to be associated with the activation key."\
38
+ " Ignored if content_view_id and lifecycle_environment_id are specified."\
39
+ " Requires allow_multiple_content_views setting to be on.")
40
+ end
17
41
 
18
42
  api :GET, "/activation_keys", N_("List activation keys")
19
43
  api :GET, "/environments/:environment_id/activation_keys"
@@ -22,31 +46,27 @@ module Katello
22
46
  param :environment_id, :number, :desc => N_("environment identifier")
23
47
  param :content_view_id, :number, :desc => N_("content view identifier")
24
48
  param :name, String, :desc => N_("activation key name to filter by")
49
+ param :content_view_environments, Array, :desc => N_("Comma-separated list of content view environment labels associated with the activation key,"\
50
+ " in the format of 'lifecycle_environment_label/content_view_label'."\
51
+ " Ignored if content_view_environment_ids is specified, or if content_view_id and lifecycle_environment_id are specified."\
52
+ " Requires allow_multiple_content_views setting to be on.")
53
+ param :content_view_environment_ids, Array, :desc => N_("Array of content view environment ids associated with the activation key. " \
54
+ "Ignored if content_view_id and lifecycle_environment_id are specified."\
55
+ "Requires allow_multiple_content_views setting to be on.")
56
+
25
57
  param_group :search, Api::V2::ApiController
26
58
  add_scoped_search_description_for(ActivationKey)
27
59
  def index
28
- activation_key_includes = [:content_view, :environment, :host_collections, :organization]
60
+ activation_key_includes = [:content_view_environments, :host_collections, :organization]
29
61
  respond(:collection => scoped_search(index_relation.distinct, :name, :asc, :includes => activation_key_includes))
30
62
  end
31
63
 
32
64
  api :POST, "/activation_keys", N_("Create an activation key")
33
- param :organization_id, :number, :desc => N_("organization identifier"), :required => true
34
65
  param :name, String, :desc => N_("name"), :required => true
35
- param :description, String, :desc => N_("description")
36
- param :environment, Hash, :desc => N_("environment")
37
- param :environment_id, :number, :desc => N_("environment id")
38
- param :content_view_id, :number, :desc => N_("content view id")
39
- param :max_hosts, :number, :desc => N_("maximum number of registered content hosts")
40
- param :unlimited_hosts, :bool, :desc => N_("can the activation key have unlimited hosts")
41
- param :release_version, String, :desc => N_("content release version")
42
- param :service_level, String, :desc => N_("service level")
43
- param :auto_attach, :bool, :desc => N_("auto attach subscriptions upon registration"), deprecated: true
44
- param :purpose_usage, String, :desc => N_("Sets the system purpose usage")
45
- param :purpose_role, String, :desc => N_("Sets the system purpose usage")
46
- param :purpose_addons, Array, :desc => N_("Sets the system add-ons")
66
+ param_group :activation_key
47
67
  def create
48
68
  @activation_key = ActivationKey.new(activation_key_params) do |activation_key|
49
- activation_key.environment = @environment if @environment
69
+ activation_key.content_view_environments = @content_view_environments if update_cves?
50
70
  activation_key.organization = @organization
51
71
  activation_key.user = current_user
52
72
  end
@@ -57,21 +77,20 @@ module Katello
57
77
  end
58
78
 
59
79
  api :PUT, "/activation_keys/:id", N_("Update an activation key")
80
+ param_group :activation_key
60
81
  param :id, :number, :desc => N_("ID of the activation key"), :required => true
61
- param :organization_id, :number, :desc => N_("organization identifier"), :required => true
62
82
  param :name, String, :desc => N_("name"), :required => false
63
- param :description, String, :desc => N_("description")
64
- param :environment_id, :number, :desc => N_("environment id")
65
- param :content_view_id, :number, :desc => N_("content view id")
66
- param :max_hosts, :number, :desc => N_("maximum number of registered content hosts")
67
- param :unlimited_hosts, :bool, :desc => N_("can the activation key have unlimited hosts")
68
- param :release_version, String, :desc => N_("content release version")
69
- param :service_level, String, :desc => N_("service level")
70
- param :auto_attach, :bool, :desc => N_("auto attach subscriptions upon registration")
71
- param :purpose_usage, String, :desc => N_("Sets the system purpose usage")
72
- param :purpose_role, String, :desc => N_("Sets the system purpose usage")
73
- param :purpose_addons, Array, :desc => N_("Sets the system add-ons")
74
83
  def update
84
+ if @content_view_environments.present? || update_cves?
85
+ if single_assignment? && @content_view_environments.length == 1
86
+ @activation_key.assign_single_environment(
87
+ content_view: @content_view_environments.first.content_view,
88
+ lifecycle_environment: @content_view_environments.first.lifecycle_environment
89
+ )
90
+ else
91
+ @activation_key.update!(content_view_environments: @content_view_environments)
92
+ end
93
+ end
75
94
  sync_task(::Actions::Katello::ActivationKey::Update, @activation_key, activation_key_params)
76
95
  respond_for_show(:resource => @activation_key)
77
96
  end
@@ -138,7 +157,7 @@ module Katello
138
157
  response = {
139
158
  :results => @activation_key.available_releases,
140
159
  :total => @activation_key.available_releases.size,
141
- :subtotal => @activation_key.available_releases.size
160
+ :subtotal => @activation_key.available_releases.size,
142
161
  }
143
162
  respond_for_index :collection => response
144
163
  end
@@ -220,10 +239,10 @@ module Katello
220
239
  validate_content_overrides_enabled(override)
221
240
  end
222
241
  specified_labels.uniq!
223
- existing_labels = organization.contents.where(label: specified_labels).uniq
242
+ existing_labels = organization.contents.where(label: specified_labels).pluck(:label).uniq
224
243
 
225
244
  unless specified_labels.size == existing_labels.size
226
- missing_labels = specified_labels - existing_labels.pluck(:label)
245
+ missing_labels = specified_labels - existing_labels
227
246
  msg = "Content label(s) \"#{missing_labels.join(", ")}\" were not found in the Organization \"#{organization}\""
228
247
  fail HttpErrors::BadRequest, _(msg)
229
248
  end
@@ -247,8 +266,9 @@ module Katello
247
266
  activation_keys = ActivationKey.readable
248
267
  activation_keys = activation_keys.where(:name => params[:name]) if params[:name]
249
268
  activation_keys = activation_keys.where(:organization_id => @organization) if @organization
250
- activation_keys = activation_keys.where(:environment_id => @environment) if @environment
251
- activation_keys = activation_keys.where(:content_view_id => @content_view) if @content_view
269
+ activation_keys = activation_keys.with_content_view_environments(@content_view_environments) if @content_view_environments
270
+ activation_keys = activation_keys.with_content_views(params[:content_view_id]) if params[:content_view_id]
271
+ activation_keys = activation_keys.with_environments(params[:lifecycle_environments]) if params[:lifecycle_environments]
252
272
  activation_keys
253
273
  end
254
274
 
@@ -256,25 +276,84 @@ module Katello
256
276
 
257
277
  def subscription_index
258
278
  subs = @activation_key.subscriptions
259
- subscriptions = {
279
+ {
260
280
  :results => subs,
261
281
  :subtotal => subs.count,
262
282
  :total => subs.count,
263
283
  :page => 1,
264
- :per_page => subs.count
284
+ :per_page => subs.count,
265
285
  }
266
- subscriptions
267
286
  end
268
287
 
269
- def find_environment
270
- environment_id = params[:environment_id]
271
- environment_id = params[:environment][:id] if !environment_id && params[:environment]
272
- return unless environment_id
288
+ def find_cve_for_single
289
+ environment_id = params.dig(:environment, :id) || params[:environment_id]
290
+ content_view_id = params.dig(:content_view, :id) || params[:content_view_id]
291
+ if environment_id.blank? || content_view_id.blank?
292
+ fail HttpErrors::BadRequest, _("Environment ID and content view ID must be provided together")
293
+ end
294
+ cve = ::Katello::ContentViewEnvironment.readable.where(environment_id: environment_id,
295
+ content_view_id: content_view_id).first
296
+ if cve.blank?
297
+ fail HttpErrors::NotFound, _("Couldn't find content view environment with content view ID '%{cv}'"\
298
+ " and environment ID '%{env}'") % { cv: content_view_id, env: environment_id }
299
+ end
300
+ @content_view_environments = [cve]
301
+ end
302
+
303
+ def params_likely_not_from_angularjs?
304
+ # AngularJS sends back the activation key's existing API response values.
305
+ # A side effect of this is that when it sends params[:content_view_environments] or params[:content_view_environment_ids],
306
+ # it incorrectly sends the nested objects from the rabl response, instead of the required single comma-separated string of CVE labels.
307
+ # This would cause fetch_content_view_environments to fail.
308
+ # Therefore, we need a way to (a) detect if the request is from AngularJS, and (b) avoid trying to handle the nested objects as if they were strings.
309
+ # So we look at params[:multi_content_view_environment]. This is a computed value, not meant to be submitted as part of an update request.
310
+ # If it's true or false, it's likely AngularJS.
311
+ # And if the key is omitted, it's likely from Hammer or API, so it's safe to proceed.
312
+ !params.key?(:multi_content_view_environment)
313
+ end
314
+
315
+ def find_content_view_environments
316
+ @content_view_environments = []
317
+ if params[:environment_id] || params[:environment]
318
+ find_cve_for_single
319
+ elsif params_likely_not_from_angularjs? && (params[:content_view_environments] || params[:content_view_environment_ids])
320
+ @content_view_environments = ::Katello::ContentViewEnvironment.fetch_content_view_environments(
321
+ labels: params[:content_view_environments],
322
+ ids: params[:content_view_environment_ids],
323
+ organization: @organization || @activation_key&.organization)
324
+ if @content_view_environments.blank?
325
+ handle_errors(labels: params[:content_view_environments],
326
+ ids: params[:content_view_environment_ids])
327
+ end
328
+ end
329
+ handle_blank_cve_params
330
+ @organization ||= @content_view_environments.first&.organization
331
+ end
332
+
333
+ def handle_blank_cve_params
334
+ if params.key?(:environment) && params.key?(:content_view)
335
+ return # AngularJS sends nested environment and content_view params, but with blank _id values
336
+ end
337
+ # Activation keys do not require CVEs to be associated. So it's possible the user intends to clear them.
338
+ if params.key?(:environment_id) && params[:environment_id].blank? && params.key?(:content_view_id) && params[:content_view_id].blank?
339
+ @content_view_environments = []
340
+ elsif params.key?(:content_view_environments) && params[:content_view_environments].blank?
341
+ @content_view_environments = []
342
+ elsif params.key?(:content_view_environment_ids) && params[:content_view_environment_ids].blank?
343
+ @content_view_environments = []
344
+ end
345
+ end
346
+
347
+ # AngularJS sends :environment and :content_view_id
348
+ def single_assignment?
349
+ (params.key?(:environment) || params.key?(:environment_id)) &&
350
+ (params.key?(:content_view) || params.key?(:content_view_id))
351
+ end
273
352
 
274
- @environment = KTEnvironment.readable.find_by(id: environment_id)
275
- fail HttpErrors::NotFound, _("Couldn't find environment '%s'") % params[:environment_id] if @environment.nil?
276
- @organization = @environment.organization
277
- @environment
353
+ def update_cves?
354
+ single_assignment? ||
355
+ params.key?(:content_view_environments) || # multi
356
+ params.key?(:content_view_environment_ids)
278
357
  end
279
358
 
280
359
  def find_host_collections
@@ -293,14 +372,6 @@ module Katello
293
372
  fail HttpErrors::BadRequest, _("Either organization ID or environment ID needs to be specified")
294
373
  end
295
374
 
296
- def find_content_view
297
- if params.include?(:content_view_id)
298
- cv_id = params[:content_view_id]
299
- @content_view = ContentView.readable.find_by(:id => cv_id)
300
- fail HttpErrors::NotFound, _("Couldn't find content view '%s'") % cv_id if @content_view.nil?
301
- end
302
- end
303
-
304
375
  def permitted_params
305
376
  params.require(:activation_key).permit(:name,
306
377
  :description,
@@ -316,14 +387,15 @@ module Katello
316
387
  :purpose_usage,
317
388
  :purpose_addon_ids,
318
389
  :content_overrides => [],
319
- :host_collection_ids => []).to_h
390
+ :host_collection_ids => [],
391
+ :content_view_environments => [],
392
+ :content_view_environment_ids => []).to_h
320
393
  end
321
394
 
322
395
  def activation_key_params
323
- key_params = permitted_params
396
+ key_params = permitted_params.except(:environment_id, :content_view_id,
397
+ :content_view_environments, :content_view_environment_ids)
324
398
 
325
- key_params[:environment_id] = params[:environment][:id] if params[:environment].try(:[], :id)
326
- key_params[:content_view_id] = params[:content_view][:id] if params[:content_view].try(:[], :id)
327
399
  unless params[:purpose_addons].nil?
328
400
  key_params[:purpose_addon_ids] = params[:purpose_addons].map { |addon| ::Katello::PurposeAddon.find_or_create_by(name: addon).id }
329
401
  end
@@ -170,7 +170,7 @@ module Katello
170
170
  :selectable => selectable.blank? ? total : selectable,
171
171
  :page => page,
172
172
  :per_page => per_page,
173
- :error => error
173
+ :error => error,
174
174
  }
175
175
  end
176
176
 
@@ -26,13 +26,6 @@ module Katello
26
26
  render json: @capsule.content_counts.to_json
27
27
  end
28
28
 
29
- api :POST, '/capsules/:id/content/update_counts', N_('Update content counts for the smart proxy')
30
- param :id, Integer, :desc => N_('Id of the smart proxy'), :required => true
31
- def update_counts
32
- task = async_task(::Actions::Katello::CapsuleContent::UpdateContentCounts, @capsule)
33
- respond_for_async :resource => task
34
- end
35
-
36
29
  api :GET, '/capsules/:id/content/lifecycle_environments', N_('List the lifecycle environments attached to the smart proxy')
37
30
  param_group :lifecycle_environments
38
31
  def lifecycle_environments
@@ -77,7 +70,7 @@ module Katello
77
70
  :environment_id => @environment.try(:id),
78
71
  :content_view_id => @content_view.try(:id),
79
72
  :repository_id => @repository.try(:id),
80
- :skip_metadata_check => skip_metadata_check
73
+ :skip_metadata_check => skip_metadata_check,
81
74
  }
82
75
  sync_options[:environment_ids] = @capsule.lifecycle_environments&.pluck(:id) unless (@environment || @content_view || @repository)
83
76
  task = async_task(::Actions::Katello::CapsuleContent::Sync,
@@ -86,6 +79,24 @@ module Katello
86
79
  respond_for_async :resource => task
87
80
  end
88
81
 
82
+ api :POST, '/capsules/:id/content/update_counts', N_('Update content counts for the smart proxy')
83
+ param :id, Integer, :desc => N_('Id of the smart proxy'), :required => true
84
+ param :environment_id, Integer, :desc => N_('Id of the environment to limit the content counting on')
85
+ param :content_view_id, Integer, :desc => N_('Id of the content view to limit the content counting on')
86
+ param :repository_id, Integer, :desc => N_('Id of the repository to limit the content counting on')
87
+ def update_counts
88
+ find_environment if params[:environment_id]
89
+ find_content_view if params[:content_view_id]
90
+ find_repository if params[:repository_id]
91
+ count_options = {
92
+ :environment_id => @environment.try(:id),
93
+ :content_view_id => @content_view.try(:id),
94
+ :repository_id => @repository.try(:id),
95
+ }
96
+ task = async_task(::Actions::Katello::CapsuleContent::UpdateContentCounts, @capsule, count_options)
97
+ respond_for_async :resource => task
98
+ end
99
+
89
100
  api :GET, '/capsules/:id/content/sync', N_('Get current smart proxy synchronization status')
90
101
  param :id, Integer, :desc => N_('Id of the smart proxy'), :required => true
91
102
  param :organization_id, Integer, :desc => N_('Id of the organization to get the status for'), :required => false
@@ -126,7 +137,7 @@ module Katello
126
137
  repair_options = {
127
138
  :environment_id => @environment.try(:id),
128
139
  :content_view_id => @content_view.try(:id),
129
- :repository_id => @repository.try(:id)
140
+ :repository_id => @repository.try(:id),
130
141
  }
131
142
  repair_options[:environment_ids] = @capsule.lifecycle_environments&.pluck(:id) unless (@environment || @content_view || @repository)
132
143
 
@@ -142,7 +153,7 @@ module Katello
142
153
  collection = {
143
154
  :results => environments,
144
155
  :total => environments.size,
145
- :subtotal => environments.size
156
+ :subtotal => environments.size,
146
157
  }
147
158
  respond_for_index(:collection => collection, :template => :lifecycle_environments)
148
159
  end
@@ -25,7 +25,7 @@ module Katello
25
25
  {
26
26
  :results => results.uniq,
27
27
  :subtotal => results.count,
28
- :total => results.count
28
+ :total => results.count,
29
29
  }
30
30
  end
31
31