katello 3.18.0.rc1 → 4.0.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 (345) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/rhsm/candlepin_dynflow_proxy_controller.rb +0 -19
  3. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +1 -3
  4. data/app/controllers/katello/api/v2/api_controller.rb +1 -2
  5. data/app/controllers/katello/api/v2/capsule_content_controller.rb +2 -2
  6. data/app/controllers/katello/api/v2/content_credentials_controller.rb +24 -24
  7. data/app/controllers/katello/api/v2/content_export_incrementals_controller.rb +98 -0
  8. data/app/controllers/katello/api/v2/content_exports_controller.rb +88 -0
  9. data/app/controllers/katello/api/v2/content_imports_controller.rb +59 -0
  10. data/app/controllers/katello/api/v2/content_view_filters_controller.rb +16 -7
  11. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +57 -92
  12. data/app/controllers/katello/api/v2/content_views_controller.rb +12 -3
  13. data/app/controllers/katello/api/v2/host_debs_controller.rb +1 -0
  14. data/app/controllers/katello/api/v2/host_errata_controller.rb +2 -2
  15. data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +2 -3
  16. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +20 -7
  17. data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +1 -1
  18. data/app/controllers/katello/api/v2/products_controller.rb +9 -9
  19. data/app/controllers/katello/api/v2/repositories_controller.rb +5 -19
  20. data/app/controllers/katello/api/v2/repository_sets_controller.rb +24 -14
  21. data/app/controllers/katello/api/v2/simple_content_access_controller.rb +34 -0
  22. data/app/controllers/katello/api/v2/subscriptions_controller.rb +1 -1
  23. data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +8 -4
  24. data/app/controllers/katello/concerns/api/v2/authorization.rb +10 -0
  25. data/app/controllers/katello/concerns/api/v2/bulk_hosts_extensions.rb +22 -18
  26. data/app/controllers/katello/concerns/authorization/api/v2/content_views_controller.rb +1 -1
  27. data/app/controllers/katello/concerns/registration_controller_extensions.rb +16 -0
  28. data/app/helpers/katello/sync_management_helper.rb +0 -2
  29. data/app/lib/actions/candlepin/environment/create.rb +1 -1
  30. data/app/lib/actions/candlepin/environment/set_content.rb +1 -1
  31. data/app/lib/actions/helpers/smart_proxy_sync_history_helper.rb +24 -0
  32. data/app/lib/actions/katello/activation_key/create.rb +9 -11
  33. data/app/lib/actions/katello/applicability/hosts/bulk_generate.rb +6 -2
  34. data/app/lib/actions/katello/capsule_content/sync.rb +8 -8
  35. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +31 -8
  36. data/app/lib/actions/katello/check_matching_content.rb +17 -0
  37. data/app/lib/actions/katello/content_view/environment_create.rb +6 -8
  38. data/app/lib/actions/katello/content_view/promote_to_environment.rb +1 -1
  39. data/app/lib/actions/katello/content_view/publish.rb +6 -5
  40. data/app/lib/actions/katello/content_view_version/import.rb +5 -11
  41. data/app/lib/actions/katello/content_view_version/import_library.rb +17 -0
  42. data/app/lib/actions/katello/content_view_version/incremental_update.rb +30 -10
  43. data/app/lib/actions/katello/host/hypervisors_update.rb +4 -4
  44. data/app/lib/actions/katello/host/update_system_purpose.rb +1 -1
  45. data/app/lib/actions/katello/host/upload_package_profile.rb +3 -1
  46. data/app/lib/actions/katello/host/upload_profiles.rb +8 -6
  47. data/app/lib/actions/katello/organization/create.rb +3 -5
  48. data/app/lib/actions/katello/organization/destroy.rb +1 -1
  49. data/app/lib/actions/katello/organization/manifest_delete.rb +3 -5
  50. data/app/lib/actions/katello/organization/manifest_import.rb +1 -1
  51. data/app/lib/actions/katello/organization/manifest_refresh.rb +1 -1
  52. data/app/lib/actions/katello/repository/check_matching_content.rb +3 -1
  53. data/app/lib/actions/katello/repository/clone_contents.rb +8 -11
  54. data/app/lib/actions/katello/repository/create.rb +0 -8
  55. data/app/lib/actions/katello/repository/filtered_index_content.rb +3 -0
  56. data/app/lib/actions/katello/repository/import_upload.rb +2 -0
  57. data/app/lib/actions/katello/repository/index_content.rb +1 -0
  58. data/app/lib/actions/katello/repository/multi_clone_contents.rb +9 -12
  59. data/app/lib/actions/katello/repository/remove_content.rb +1 -1
  60. data/app/lib/actions/katello/repository/sync.rb +3 -1
  61. data/app/lib/actions/katello/repository/update.rb +1 -8
  62. data/app/lib/actions/katello/repository/upload_files.rb +1 -0
  63. data/app/lib/actions/middleware/execute_if_contents_changed.rb +4 -1
  64. data/app/lib/actions/middleware/record_smart_proxy_sync_history.rb +35 -0
  65. data/app/lib/actions/pulp/consumer/sync_capsule.rb +4 -2
  66. data/app/lib/actions/pulp/orchestration/repository/refresh_repos.rb +0 -6
  67. data/app/lib/actions/pulp/repository/distributor_publish.rb +1 -1
  68. data/app/lib/actions/pulp3/abstract_async_task.rb +1 -0
  69. data/app/lib/actions/pulp3/capsule_content/refresh_distribution.rb +3 -3
  70. data/app/lib/actions/pulp3/capsule_content/sync.rb +1 -0
  71. data/app/lib/actions/pulp3/content_migration.rb +10 -0
  72. data/app/lib/actions/pulp3/content_migration_presenter.rb +59 -0
  73. data/app/lib/actions/pulp3/content_view/delete_repository_references.rb +1 -1
  74. data/app/lib/actions/pulp3/content_view_version/export.rb +6 -1
  75. data/app/lib/actions/pulp3/import_migration.rb +6 -1
  76. data/app/lib/actions/pulp3/orchestration/content_view_version/copy_version_units_to_library.rb +2 -1
  77. data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +30 -9
  78. data/app/lib/actions/pulp3/orchestration/content_view_version/export_library.rb +60 -0
  79. data/app/lib/actions/pulp3/orchestration/content_view_version/import.rb +0 -4
  80. data/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb +4 -1
  81. data/app/lib/actions/pulp3/orchestration/repository/import_upload.rb +16 -3
  82. data/app/lib/actions/pulp3/orchestration/repository/refresh_repos.rb +1 -6
  83. data/app/lib/actions/pulp3/repository/copy_content.rb +1 -1
  84. data/app/lib/actions/pulp3/repository/delete.rb +1 -1
  85. data/app/lib/actions/pulp3/repository/save_version.rb +1 -1
  86. data/app/lib/actions/pulp3/repository/upload_tag.rb +18 -0
  87. data/app/lib/katello/concerns/base_template_scope_extensions.rb +8 -0
  88. data/app/lib/katello/event_daemon/monitor.rb +53 -0
  89. data/app/lib/katello/event_daemon/runner.rb +99 -0
  90. data/app/lib/katello/logging.rb +32 -0
  91. data/app/lib/katello/messaging/connection.rb +1 -7
  92. data/app/lib/katello/validators/content_view_puppet_module_validator.rb +1 -1
  93. data/app/models/katello/activation_key.rb +2 -2
  94. data/app/models/katello/authorization/content_view_filter.rb +15 -0
  95. data/app/models/katello/authorization/content_view_version.rb +25 -2
  96. data/app/models/katello/authorization/content_view_version_export_history.rb +1 -1
  97. data/app/models/katello/authorization/organization.rb +8 -0
  98. data/app/models/katello/candlepin/repository_mapper.rb +1 -1
  99. data/app/models/katello/concerns/operatingsystem_extensions.rb +2 -0
  100. data/app/models/katello/concerns/organization_extensions.rb +2 -2
  101. data/app/models/katello/concerns/pulp_database_unit.rb +7 -0
  102. data/app/models/katello/concerns/redhat_extensions.rb +2 -2
  103. data/app/models/katello/concerns/smart_proxy_extensions.rb +33 -5
  104. data/app/models/katello/content_migration_progress.rb +4 -0
  105. data/app/models/katello/content_view.rb +35 -5
  106. data/app/models/katello/content_view_environment.rb +2 -2
  107. data/app/models/katello/content_view_filter.rb +5 -0
  108. data/app/models/katello/content_view_history.rb +2 -1
  109. data/app/models/katello/content_view_package_filter.rb +1 -1
  110. data/app/models/katello/content_view_puppet_environment.rb +2 -2
  111. data/app/models/katello/content_view_puppet_module.rb +8 -0
  112. data/app/models/katello/content_view_repository.rb +13 -1
  113. data/app/models/katello/content_view_version.rb +2 -1
  114. data/app/models/katello/content_view_version_export_history.rb +26 -1
  115. data/app/models/katello/erratum.rb +3 -1
  116. data/app/models/katello/glue/candlepin/pool.rb +2 -0
  117. data/app/models/katello/glue/pulp/repo.rb +0 -6
  118. data/app/models/katello/glue/pulp/repos.rb +1 -22
  119. data/app/models/katello/host/subscription_facet.rb +4 -0
  120. data/app/models/katello/ping.rb +11 -6
  121. data/app/models/katello/pool.rb +5 -0
  122. data/app/models/katello/product.rb +3 -3
  123. data/app/models/katello/repository.rb +36 -3
  124. data/app/models/katello/smart_proxy_sync_history.rb +8 -0
  125. data/app/models/katello/subscription_status.rb +3 -2
  126. data/app/presenters/katello/host_subscription_presenter.rb +3 -4
  127. data/app/presenters/katello/host_subscriptions_presenter.rb +24 -0
  128. data/app/services/katello/applicability/applicable_content_helper.rb +44 -15
  129. data/app/services/katello/candlepin_event_listener.rb +11 -19
  130. data/app/services/katello/event_monitor/poller_thread.rb +2 -11
  131. data/app/services/katello/pulp/smart_proxy_repository.rb +0 -15
  132. data/app/services/katello/pulp3/api/docker.rb +4 -0
  133. data/app/services/katello/pulp3/content_view_version/export.rb +122 -6
  134. data/app/services/katello/pulp3/content_view_version/import.rb +37 -22
  135. data/app/services/katello/pulp3/content_view_version/import_export_common.rb +6 -16
  136. data/app/services/katello/pulp3/content_view_version/import_validator.rb +84 -0
  137. data/app/services/katello/pulp3/docker_manifest.rb +1 -0
  138. data/app/services/katello/pulp3/docker_tag.rb +1 -0
  139. data/app/services/katello/pulp3/migration.rb +51 -10
  140. data/app/services/katello/pulp3/repository.rb +13 -4
  141. data/app/services/katello/pulp3/repository/docker.rb +5 -0
  142. data/app/services/katello/pulp3/repository/yum.rb +15 -10
  143. data/app/services/katello/pulp3/task.rb +7 -3
  144. data/app/services/katello/pulp3/task_group.rb +10 -0
  145. data/app/services/katello/repository_type.rb +3 -2
  146. data/app/services/katello/smart_proxy_helper.rb +9 -0
  147. data/app/views/foreman/hosts/_registration.html.erb +12 -0
  148. data/app/views/foreman/smart_proxies/_content_tab.html.erb +4 -47
  149. data/app/views/foreman/smart_proxies/show.html.erb +1 -1
  150. data/app/views/katello/api/v2/capsule_content/sync_status.json.rabl +22 -25
  151. data/app/views/katello/api/v2/content_view_version_export_histories/show.json.rabl +1 -0
  152. data/app/views/katello/api/v2/content_views/base.json.rabl +1 -0
  153. data/app/views/katello/api/v2/content_views/show.json.rabl +6 -0
  154. data/app/views/katello/api/v2/organizations/show.json.rabl +7 -9
  155. data/app/views/katello/layouts/react.html.erb +3 -2
  156. data/app/views/overrides/activation_keys/_host_tab_pane.html.erb +1 -5
  157. data/app/views/overrides/organizations/_edit_override.html.erb +1 -4
  158. data/app/views/overrides/smart_proxies/_environment_tab.html.erb +1 -1
  159. data/app/views/overrides/smart_proxies/_environment_tab_pane.html.erb +1 -1
  160. data/config/katello.yaml.example +0 -3
  161. data/config/routes/api/v2.rb +31 -13
  162. data/db/migrate/20150930183738_migrate_content_hosts.rb +1 -1
  163. data/db/migrate/20191204214919_add_content_view_version_counts.rb +0 -1
  164. data/db/migrate/20200514092553_move_katello_fields_from_hostgroups.katello.rb +5 -2
  165. data/db/migrate/20200929200357_create_katello_smart_proxy_sync_history.rb +13 -0
  166. data/db/migrate/20201021150008_add_import_only_to_katello_content_view.rb +5 -0
  167. data/db/migrate/20201119211133_pulp3_migration_progress.rb +9 -0
  168. data/db/migrate/20210119162528_delete_puppet_and_ostree_repos.rb +56 -0
  169. data/db/migrate/20210128231228_add_type_and_from_cvv_to_cvv_export_history.rb +14 -0
  170. data/db/migrate/20210201163238_migrate_background_download_policy_to_migrate.rb +7 -0
  171. data/db/seeds.d/104-proxy.rb +1 -1
  172. data/db/seeds.d/111-upgrade_tasks.rb +2 -1
  173. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.controller.js +1 -1
  174. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/common/views/katello-agent-notice.html +1 -1
  175. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-system-purpose-modal.html +35 -40
  176. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-register-os-client.directive.js +17 -0
  177. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +2 -2
  178. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +2 -2
  179. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-client.html +12 -5
  180. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-deb-client.html +38 -0
  181. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-oracle-client.html +5 -0
  182. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-sles-client.html +28 -0
  183. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register.html +14 -11
  184. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.controller.js +6 -2
  185. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion-activation-keys.controller.js +8 -3
  186. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion-content-hosts.controller.js +9 -3
  187. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-details.controller.js +12 -0
  188. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/package-filter-details.html +2 -2
  189. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-details.html +7 -7
  190. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-info.html +7 -1
  191. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-publish.html +4 -0
  192. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js +17 -3
  193. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/views/content-view-new.html +16 -2
  194. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/views/content-views.html +5 -0
  195. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +78 -7
  196. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/de.po +17 -20
  197. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/es.po +17 -24
  198. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/fr.po +1292 -1170
  199. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/it.po +17 -20
  200. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ja.po +858 -807
  201. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ko.po +18 -19
  202. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/pt_BR.po +17 -24
  203. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ru.po +17 -18
  204. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_CN.po +986 -971
  205. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_TW.po +19 -20
  206. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/translations.js +9 -9
  207. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +2 -2
  208. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +1 -1
  209. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/download-policy.service.js +0 -1
  210. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +1 -1
  211. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/repository-types.service.js +8 -1
  212. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.controller.js +2 -2
  213. data/lib/katello/engine.rb +6 -6
  214. data/lib/katello/middleware/event_daemon.rb +1 -1
  215. data/lib/katello/permission_creator.rb +35 -14
  216. data/lib/katello/plugin.rb +8 -3
  217. data/lib/katello/tasks/delete_orphaned_content.rake +1 -3
  218. data/lib/katello/tasks/jenkins.rake +1 -1
  219. data/lib/katello/tasks/pulp3_content_switchover.rake +1 -1
  220. data/lib/katello/tasks/pulp3_migration.rake +18 -6
  221. data/lib/katello/tasks/pulp3_migration_abort.rake +22 -0
  222. data/lib/katello/tasks/pulp3_migration_stats.rake +28 -8
  223. data/lib/katello/tasks/pulp3_post_migration_check.rake +1 -3
  224. data/lib/katello/tasks/receptor/extract_orgs.rake +1 -1
  225. data/lib/katello/tasks/reimport.rake +1 -1
  226. data/lib/katello/tasks/repository.rake +3 -5
  227. data/lib/katello/tasks/upgrades/4.0/remove_ostree_puppet_content.rake +16 -0
  228. data/lib/katello/version.rb +1 -1
  229. data/lib/proxy_api/container_gateway.rb +21 -0
  230. data/locale/action_names.rb +51 -51
  231. data/locale/bn/katello.edit.po +0 -0
  232. data/locale/bn/katello.po +136 -51
  233. data/locale/cs/katello.edit.po +0 -0
  234. data/locale/cs/katello.po +136 -49
  235. data/locale/de/katello.edit.po +0 -0
  236. data/locale/de/katello.po +136 -48
  237. data/locale/en/katello.edit.po +0 -0
  238. data/locale/en/katello.po +136 -48
  239. data/locale/es/katello.edit.po +0 -0
  240. data/locale/es/katello.po +136 -48
  241. data/locale/fr/katello.edit.po +0 -0
  242. data/locale/fr/katello.po +136 -48
  243. data/locale/gu/katello.edit.po +0 -0
  244. data/locale/gu/katello.po +136 -51
  245. data/locale/hi/katello.edit.po +0 -0
  246. data/locale/hi/katello.po +136 -51
  247. data/locale/it/katello.edit.po +0 -0
  248. data/locale/it/katello.po +136 -48
  249. data/locale/ja/katello.edit.po +0 -0
  250. data/locale/ja/katello.po +136 -48
  251. data/locale/katello.pot +941 -767
  252. data/locale/kn/katello.edit.po +0 -0
  253. data/locale/kn/katello.po +136 -51
  254. data/locale/ko/katello.edit.po +0 -0
  255. data/locale/ko/katello.po +136 -48
  256. data/locale/mr/katello.edit.po +0 -0
  257. data/locale/mr/katello.po +136 -51
  258. data/locale/or/katello.edit.po +0 -0
  259. data/locale/or/katello.po +136 -51
  260. data/locale/pa/katello.edit.po +0 -0
  261. data/locale/pa/katello.po +136 -51
  262. data/locale/pt/katello.edit.po +0 -0
  263. data/locale/pt/katello.po +136 -51
  264. data/locale/pt_BR/katello.edit.po +0 -0
  265. data/locale/pt_BR/katello.po +136 -48
  266. data/locale/ru/katello.edit.po +0 -0
  267. data/locale/ru/katello.po +136 -48
  268. data/locale/ta/katello.edit.po +0 -0
  269. data/locale/ta/katello.po +136 -51
  270. data/locale/te/katello.edit.po +0 -0
  271. data/locale/te/katello.po +136 -51
  272. data/locale/zh_CN/katello.edit.po +0 -0
  273. data/locale/zh_CN/katello.po +136 -48
  274. data/locale/zh_TW/katello.edit.po +0 -0
  275. data/locale/zh_TW/katello.po +136 -48
  276. data/package.json +1 -1
  277. data/webpack/__mocks__/foremanReact/Root/Context/ForemanContext.js +0 -1
  278. data/webpack/__mocks__/foremanReact/components/Pagination/PaginationHooks.js +2 -0
  279. data/webpack/__mocks__/foremanReact/components/common/dates/LongDateTime.js +5 -0
  280. data/webpack/{scenes/ContentViews/Details/Repositories → components/SelectableDropdown}/SelectableDropdown.js +20 -3
  281. data/webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js +45 -0
  282. data/webpack/components/SelectableDropdown/index.js +3 -0
  283. data/webpack/components/Table/TableWrapper.js +2 -1
  284. data/webpack/components/Table/helpers.js +14 -0
  285. data/webpack/components/TypeAhead/TypeAhead.js +2 -1
  286. data/webpack/components/TypeAhead/pf3Search/TypeAheadSearch.js +2 -1
  287. data/webpack/components/TypeAhead/pf4Search/TypeAheadSearch.js +0 -1
  288. data/webpack/containers/Application/overrides.scss +6 -0
  289. data/webpack/index.js +6 -0
  290. data/webpack/redux/actions/RedHatRepositories/helpers.js +5 -5
  291. data/webpack/scenes/ContentViews/ContentViewsActions.js +31 -2
  292. data/webpack/scenes/ContentViews/ContentViewsConstants.js +5 -1
  293. data/webpack/scenes/ContentViews/Copy/ContentViewCopySelectors.js +16 -0
  294. data/webpack/scenes/ContentViews/Copy/CopyContentViewForm.js +77 -0
  295. data/webpack/scenes/ContentViews/Copy/CopyContentViewModal.js +44 -0
  296. data/webpack/scenes/ContentViews/Copy/__tests__/contentViewCopyResult.fixtures.json +42 -0
  297. data/webpack/scenes/ContentViews/Copy/__tests__/copyContentView.test.js +39 -0
  298. data/webpack/scenes/ContentViews/Copy/index.js +4 -0
  299. data/webpack/scenes/ContentViews/Create/ContentViewCreateSelectors.js +16 -0
  300. data/webpack/scenes/ContentViews/Create/ContentViewFormComponents.js +58 -0
  301. data/webpack/scenes/ContentViews/Create/CreateContentViewForm.js +175 -0
  302. data/webpack/scenes/ContentViews/Create/CreateContentViewModal.js +27 -0
  303. data/webpack/scenes/ContentViews/Create/__tests__/contentViewCreateResult.fixtures.json +42 -0
  304. data/webpack/scenes/ContentViews/Create/__tests__/createContentView.test.js +92 -0
  305. data/webpack/scenes/ContentViews/Create/index.js +4 -0
  306. data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +16 -0
  307. data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +20 -1
  308. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +17 -7
  309. data/webpack/scenes/ContentViews/Details/ContentViewInfo.js +19 -13
  310. data/webpack/scenes/ContentViews/Details/Filters/ContentType.js +40 -0
  311. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilters.js +124 -0
  312. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.fixtures.json +134 -0
  313. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.test.js +92 -0
  314. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +44 -25
  315. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.test.js +17 -7
  316. data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetail.test.js +24 -0
  317. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +53 -3
  318. data/webpack/scenes/ContentViews/Table/tableDataGenerator.js +4 -3
  319. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +41 -0
  320. data/webpack/scenes/ContentViews/helpers.js +13 -0
  321. data/webpack/scenes/SmartProxy/Content.js +17 -0
  322. data/webpack/scenes/SmartProxy/SmartProxyContentActions.js +11 -0
  323. data/webpack/scenes/SmartProxy/SmartProxyContentConstants.js +3 -0
  324. data/webpack/scenes/SmartProxy/SmartProxyContentSelectors.js +16 -0
  325. data/webpack/scenes/SmartProxy/SmartProxyContentTable.js +152 -0
  326. data/webpack/scenes/SmartProxy/__tests__/SmartProxyContentResult.fixtures.json +140 -0
  327. data/webpack/scenes/SmartProxy/__tests__/SmartProxyContentTest.js +38 -0
  328. data/webpack/scenes/SmartProxy/index.js +4 -0
  329. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +13 -11
  330. data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +3 -3
  331. data/webpack/scenes/Subscriptions/Manifest/__tests__/ManifestActions.test.js +2 -2
  332. data/webpack/scenes/Subscriptions/Manifest/__tests__/SimpleContentAccess.test.js +2 -2
  333. data/webpack/test-utils/react-testing-lib-wrapper.js +8 -2
  334. data/webpack/utils/helpers.js +3 -0
  335. metadata +110 -31
  336. data/app/controllers/katello/api/v2/gpg_keys_controller.rb +0 -114
  337. data/app/overrides/disable_turbolinks_on_proxies_index.rb +0 -5
  338. data/app/services/katello/event_daemon.rb +0 -135
  339. data/app/services/katello/pulp/content_counts_calculator.rb +0 -60
  340. data/lib/katello/tasks/common.rake +0 -7
  341. data/lib/katello/tasks/reports.rake +0 -4
  342. data/lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake +0 -32
  343. data/webpack/__mocks__/foremanReact/components/common/Fill/GlobalFill.js +0 -3
  344. data/webpack/components/TypeAhead/pf4Search/TypeAheadSearch.scss +0 -5
  345. data/webpack/scenes/ContentViews/Table/actionResolver.js +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7163fd6dce0ae11188b016225be2effa59131c5bcc4a4b3482a749dfba7ef545
4
- data.tar.gz: 202f81621e52adce6d318faa95fa9a527c0e3fc0f25bab3c3cb2ca7133cb12e3
3
+ metadata.gz: 3942a71eb36eb3e5c9e6adcf139e30a2443a038eea11c417e55c6b590580465f
4
+ data.tar.gz: f59fa795ac9c2298450020e4c8f90409691374acc1f09e1c49a88e661d06cdd6
5
5
  SHA512:
6
- metadata.gz: 29f15645418ab0683328f83b804dc3fdf45d7f93ce4d23578a558310e0f1ad3cb7f2d98fe74ba3d16181505df56f081092aacb2bb028364995ac15413674862a
7
- data.tar.gz: 99b0a150d0d689951d63b2acb37a0bbab702bfb5a13739572e764f9b49eeda60bb3451b6cc6a7aae4c20886755b499637213afef91eb565a92e2c887a4dcc376
6
+ metadata.gz: ff801d6c4540553020d70162d030def3a7782771f58fe8e85a81def49dd1abdb4abeab3b039ce56a2741636e745bba0887e0713ae534809e952ab0fc0482ba23
7
+ data.tar.gz: 4920f4ab7232331cc2d79a56f05625811a71f334e8909bab61a7d74cbbb8fbf345a9394a888bf44ca94dac9ae17dd4f53a069f6a7fd822926377dd8b9dc1c6ed
@@ -4,8 +4,6 @@ module Katello
4
4
  include ForemanTasks::Triggers
5
5
  include AbstractController::Callbacks
6
6
 
7
- before_action :deprecated, only: :deb_package_profile
8
-
9
7
  skip_before_action :authorize, :only => [:upload_package_profile, :upload_profiles, :deb_package_profile]
10
8
  before_action :find_host, :only => [:upload_package_profile, :upload_profiles, :deb_package_profile]
11
9
  before_action :authorize_client_or_user, :only => [:upload_package_profile, :upload_profiles, :deb_package_profile]
@@ -31,19 +29,6 @@ module Katello
31
29
  render :json => Resources::Candlepin::Consumer.get(@host.subscription_facet.uuid)
32
30
  end
33
31
 
34
- api :PUT, "/systems/:id/deb_package_profile", N_("Update installed deb packages")
35
- param :deb_package_profile, Hash, :required => true do
36
- param :deb_packages, Array, :required => true do
37
- param :name, String, :required => true
38
- param :architecture, String, :required => true
39
- param :version, String, :required => true
40
- end
41
- end
42
- param :id, String, :desc => N_("UUID of the system"), :required => true
43
- def deb_package_profile
44
- upload_profiles
45
- end
46
-
47
32
  def find_host(uuid = nil)
48
33
  params = request.path_parameters
49
34
  uuid ||= params[:id]
@@ -65,9 +50,5 @@ module Katello
65
50
  authorized = (User.current.uuid == @host.subscription_facet.uuid) if @host && User.consumer?
66
51
  authorized
67
52
  end
68
-
69
- def deprecated
70
- ::Foreman::Deprecation.api_deprecation_warning("it will be removed in Katello 4.0. Please use /consumers/:id/profiles instead.")
71
- end
72
53
  end
73
54
  end
@@ -41,8 +41,6 @@ module Katello
41
41
  body_json['displayMessage'] = body_json['message']
42
42
  end
43
43
  response.body = body_json.to_s
44
-
45
- # rubocop:disable Lint/SuppressedException
46
44
  rescue JSON::ParserError
47
45
  # Not a json response, leave as-is
48
46
  end
@@ -370,7 +368,7 @@ module Katello
370
368
 
371
369
  if (ak_names = params[:activation_keys])
372
370
  fail HttpErrors::NotFound, _("Organization not found") if organization.nil?
373
- ak_names = ak_names.split(",")
371
+ ak_names = ak_names.split(",").uniq.compact
374
372
  activation_keys = ak_names.map do |ak_name|
375
373
  activation_key = organization.activation_keys.find_by(:name => ak_name)
376
374
  fail HttpErrors::NotFound, _("Couldn't find activation key '%s'") % ak_name unless activation_key
@@ -39,8 +39,7 @@ module Katello
39
39
  end
40
40
 
41
41
  def deprecate_katello_agent
42
- ::Foreman::Deprecation.api_deprecation_warning("Remote actions using katello-agent are deprecated and will be removed in Katello 4.0. " \
43
- "You may consider switching to Remote Execution.")
42
+ ::Foreman::Deprecation.api_deprecation_warning("Katello-agent is deprecated and will be removed in a future release.")
44
43
  end
45
44
 
46
45
  def full_result_response(collection)
@@ -93,14 +93,14 @@ module Katello
93
93
 
94
94
  def find_editable_capsule
95
95
  @capsule = SmartProxy.unscoped.authorized(:manage_capsule_content).find(params[:id])
96
- unless @capsule&.has_feature?(SmartProxy::PULP_NODE_FEATURE)
96
+ unless @capsule&.pulp_mirror?
97
97
  fail _("This request may only be performed on a Smart proxy that has the Pulp Node feature.")
98
98
  end
99
99
  end
100
100
 
101
101
  def find_capsule
102
102
  @capsule = SmartProxy.unscoped.authorized(:view_capsule_content).find(params[:id])
103
- unless @capsule&.has_feature?(SmartProxy::PULP_NODE_FEATURE)
103
+ unless @capsule&.pulp_mirror?
104
104
  fail _("This request may only be performed on a Smart proxy that has the Pulp Node feature.")
105
105
  end
106
106
  end
@@ -10,9 +10,9 @@ module Katello
10
10
  end
11
11
 
12
12
  def_param_group :content_credential do
13
- param :name, :identifier, :action_aware => true, :required => true, :desc => N_("identifier of the content credential")
14
- param :content_type, String, :action_aware => true, :required => true, :desc => N_("type of content")
15
- param :content, String, :action_aware => true, :required => true, :desc => N_("public key block in DER encoding or certificate content")
13
+ param :name, :identifier, :action_aware => true, :required => true, :desc => N_('Name of the Content Credential')
14
+ param :content_type, String, :action_aware => true, :required => true, :desc => N_('Type of content: "cert", "gpg_key"')
15
+ param :content, String, :action_aware => true, :required => true, :desc => N_('Public key block in DER encoding or certificate content')
16
16
  end
17
17
 
18
18
  resource_description do
@@ -22,13 +22,13 @@ module Katello
22
22
  Content Credentials are used to store credentials like GPG Keys and Certificates for the authentication
23
23
  to Products / Repositories.
24
24
  DESC
25
- api_version "v2"
25
+ api_version 'v2'
26
26
  end
27
27
 
28
- api :GET, "/content_credentials", N_("List content credentials")
29
- param :organization_id, :number, :desc => N_("organization identifier"), :required => true
30
- param :name, String, :desc => N_("name of the Content Credential"), :required => false
31
- param :content_type, String, :desc => N_("type of content"), :required => false
28
+ api :GET, "/content_credentials", N_('List Content Credentials')
29
+ param :organization_id, :number, :desc => N_('Organization identifier'), :required => true
30
+ param :name, String, :desc => N_('Name of the Content Credential'), :required => false
31
+ param :content_type, String, :desc => N_('Type of content'), :required => false
32
32
  param_group :search, Api::V2::ApiController
33
33
  def index
34
34
  respond(:collection => scoped_search(index_relation.distinct, :name, :asc))
@@ -41,15 +41,15 @@ module Katello
41
41
  query
42
42
  end
43
43
 
44
- api :POST, "/content_credentials", N_("Create a content credential")
45
- param :organization_id, :number, :desc => N_("organization identifier"), :required => true
44
+ api :POST, "/content_credentials", N_('Create a Content Credential')
45
+ param :organization_id, :number, :desc => N_('Organization identifier'), :required => true
46
46
  param_group :content_credential, :as => :create
47
47
  def create
48
48
  filepath = params.try(:[], :file_path).try(:path)
49
49
 
50
50
  content = nil
51
51
  if filepath
52
- content = File.open(filepath, "rb") { |file| file.read }
52
+ content = File.open(filepath, 'rb') { |file| file.read }
53
53
  else
54
54
  content = params[:content]
55
55
  end
@@ -58,45 +58,45 @@ module Katello
58
58
  respond_for_create(:resource => content_credential)
59
59
  end
60
60
 
61
- api :GET, "/content_credentials/:id", N_("Show a content credential")
62
- param :id, :number, :desc => N_("content credential numeric identifier"), :required => true
61
+ api :GET, "/content_credentials/:id", N_('Show a Content Credential')
62
+ param :id, :number, :desc => N_('Content Credential numeric identifier'), :required => true
63
63
  def show
64
64
  respond_for_show(:resource => @content_credential)
65
65
  end
66
66
 
67
- api :PUT, "/content_credentials/:id", N_("Update a content credential")
68
- param :id, :number, :desc => N_("content credential numeric identifier"), :required => true
67
+ api :PUT, "/content_credentials/:id", N_('Update a Content Credential')
68
+ param :id, :number, :desc => N_('Content Credential ID'), :required => true
69
69
  param_group :content_credential
70
70
  def update
71
71
  sync_task(::Actions::Katello::GpgKey::Update, @content_credential, content_credential_params.to_h)
72
72
  respond_for_show(:resource => @content_credential)
73
73
  end
74
74
 
75
- api :DELETE, "/content_credentials/:id", N_("Destroy a content credential")
76
- param :id, :number, :desc => N_("content credential numeric identifier"), :required => true
75
+ api :DELETE, "/content_credentials/:id", N_('Destroy a Content Credential')
76
+ param :id, :number, :desc => N_('Content Credential ID'), :required => true
77
77
  def destroy
78
78
  @content_credential.destroy
79
79
  respond_for_destroy
80
80
  end
81
81
 
82
- api :GET, "/content_credentials/:id/content", N_("Return the content of a content credential, used directly by yum")
82
+ api :GET, "/content_credentials/:id/content", N_('Return the content of a Content Credential, used directly by yum')
83
83
  param :id, :number, :required => true
84
84
  def content
85
85
  render(:plain => @content_credential.content, :layout => false)
86
86
  end
87
87
 
88
- api :POST, "/content_credentials/:id/content", N_("Upload content credential contents")
89
- param :id, :number, :desc => N_("content credential numeric identifier"), :required => true
90
- param :content, File, :desc => N_("file contents"), :required => true
88
+ api :POST, "/content_credentials/:id/content", N_('Upload Content Credential contents')
89
+ param :id, :number, :desc => N_('Content Credential ID'), :required => true
90
+ param :content, File, :desc => N_('File contents'), :required => true
91
91
  def set_content
92
92
  filepath = params.try(:[], :content).try(:path)
93
93
 
94
94
  if filepath
95
- content = File.open(filepath, "rb") { |file| file.read }
95
+ content = File.open(filepath, 'rb') { |file| file.read }
96
96
  @content_credential.update!(:content => content)
97
- render :json => {:status => "success"}
97
+ render :json => {:status => 'success'}
98
98
  else
99
- fail HttpErrors::BadRequest, _("No file uploaded")
99
+ fail HttpErrors::BadRequest, _('No file uploaded')
100
100
  end
101
101
  end
102
102
 
@@ -0,0 +1,98 @@
1
+ module Katello
2
+ class Api::V2::ContentExportIncrementalsController < Api::V2::ApiController
3
+ before_action :fail_if_not_pulp3, :only => [:version, :library]
4
+ before_action :find_exportable_organization, :only => [:library]
5
+ before_action :find_exportable_content_view_version, :only => [:version]
6
+ before_action :find_library_export_view, :only => [:library]
7
+ before_action :find_history, :only => [:version, :library]
8
+
9
+ api :POST, "/content_export_incrementals/version", N_("Performs an incremental-export of a content view version.")
10
+ param :id, :number, :desc => N_("Content view version identifier"), :required => true
11
+ param :destination_server, String, :desc => N_("Destination Server name"), :required => false
12
+ param :chunk_size_mb, :number, :desc => N_("Split the exported content into archives "\
13
+ "no greater than the specified size in megabytes."), :required => false
14
+ param :from_history_id, :number, :desc => N_("Export history identifier used for incremental export. "\
15
+ "If not provided the most recent export history will be used."), :required => false
16
+ param :fail_on_missing_content, :bool, :desc => N_("Fails if any of the repositories belonging to this version"\
17
+ " are unexportable. False by default."), :required => false
18
+ def version
19
+ tasks = async_task(::Actions::Pulp3::Orchestration::ContentViewVersion::Export,
20
+ content_view_version: @version,
21
+ destination_server: params[:destination_server],
22
+ chunk_size: params[:chunk_size_mb],
23
+ from_history: @history,
24
+ fail_on_missing_content: ::Foreman::Cast.to_bool(params[:fail_on_missing_content]))
25
+
26
+ respond_for_async :resource => tasks
27
+ end
28
+
29
+ api :POST, "/content_export_incrementals/library", N_("Performs an incremental-export of the repositories in library.")
30
+ param :organization_id, :number, :desc => N_("Organization identifier"), :required => true
31
+ param :destination_server, String, :desc => N_("Destination Server name"), :required => false
32
+ param :chunk_size_mb, :number, :desc => N_("Split the exported content into archives "\
33
+ "no greater than the specified size in megabytes."), :required => false
34
+ param :from_history_id, :number, :desc => N_("Export history identifier used for incremental export. "\
35
+ "If not provided the most recent export history will be used."), :required => false
36
+ param :fail_on_missing_content, :bool, :desc => N_("Fails if any of the repositories belonging to this organization"\
37
+ " are unexportable. False by default."), :required => false
38
+ def library
39
+ tasks = async_task(::Actions::Pulp3::Orchestration::ContentViewVersion::ExportLibrary,
40
+ @organization,
41
+ destination_server: params[:destination_server],
42
+ chunk_size: params[:chunk_size_mb],
43
+ from_history: @history,
44
+ fail_on_missing_content: ::Foreman::Cast.to_bool(params[:fail_on_missing_content]))
45
+ respond_for_async :resource => tasks
46
+ end
47
+
48
+ private
49
+
50
+ def find_exportable_content_view_version
51
+ @version = ContentViewVersion.exportable.find_by_id(params[:id])
52
+ throw_resource_not_found(name: 'content view version', id: params[:id]) if @version.blank?
53
+ @view = @version.content_view
54
+ end
55
+
56
+ def find_library_export_view
57
+ @view = ::Katello::Pulp3::ContentViewVersion::Export.find_library_export_view(destination_server: params[:destination_server],
58
+ organization: @organization,
59
+ create_by_default: false)
60
+ if @view.blank?
61
+ msg = _("Unable to incrementally export. Do a Full Export on the library content "\
62
+ "before updating from the latest increment.")
63
+ fail HttpErrors::BadRequest, msg
64
+ end
65
+ end
66
+
67
+ def find_history
68
+ if params[:from_history_id].present?
69
+ @history = ::Katello::ContentViewVersionExportHistory.find(params[:from_history_id])
70
+ if @history.blank?
71
+ throw_resource_not_found(name: 'export history',
72
+ id: params[:from_history_id])
73
+ end
74
+ else
75
+ @history = ::Katello::ContentViewVersionExportHistory.
76
+ latest(@view,
77
+ destination_server: params[:destination_server])
78
+ if @history.blank?
79
+ msg = _("No existing export history was found to perform an incremental export. A full export must be performed")
80
+ fail HttpErrors::NotFound, msg
81
+ end
82
+ end
83
+ end
84
+
85
+ def find_exportable_organization
86
+ find_organization
87
+ unless @organization.can_export_library_content?
88
+ throw_resource_not_found(name: 'organization', id: params[:organization_id])
89
+ end
90
+ end
91
+
92
+ def fail_if_not_pulp3
93
+ unless SmartProxy.pulp_primary.pulp3_repository_type_support?(Katello::Repository::YUM_TYPE)
94
+ fail HttpErrors::BadRequest, _("Invalid usage for Pulp 2 repositories. Use export for Yum repositories")
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,88 @@
1
+ module Katello
2
+ class Api::V2::ContentExportsController < Api::V2::ApiController
3
+ before_action :fail_if_not_pulp3, :only => [:version, :library]
4
+ before_action :find_exportable_organization, :only => [:library]
5
+ before_action :find_exportable_content_view_version, :only => [:version]
6
+
7
+ api :GET, "/content_exports", N_("List export histories")
8
+ param :content_view_version_id, :number, :desc => N_("Content view version identifier"), :required => false
9
+ param :content_view_id, :number, :desc => N_("Content view identifier"), :required => false
10
+ param :destination_server, String, :desc => N_("Destination Server name"), :required => false
11
+ param :organization_id, :number, :desc => N_("Organization identifier"), :required => false
12
+ param :id, :number, :desc => N_("Content view version export history identifier"), :required => false
13
+ param :type, ::Katello::ContentViewVersionExportHistory::EXPORT_TYPES,
14
+ :desc => N_("Export Types"),
15
+ :required => false
16
+ param_group :search, Api::V2::ApiController
17
+ add_scoped_search_description_for(ContentViewVersionExportHistory)
18
+ def index
19
+ history = ContentViewVersionExportHistory.readable
20
+ history = history.where(:id => params[:id]) unless params[:id].blank?
21
+ history = history.where(:content_view_version_id => params[:content_view_version_id]) unless params[:content_view_version_id].blank?
22
+ history = history.where(:destination_server => params[:destination_server]) unless params[:destination_server].blank?
23
+ history = history.where(:export_type => params[:type]) unless params[:type].blank?
24
+ history = history.with_organization_id(params[:organization_id]) unless params[:organization_id].blank?
25
+ history = history.with_content_view_id(params[:content_view_id]) unless params[:content_view_id].blank?
26
+ respond_with_template_collection("index", 'content_view_version_export_histories',
27
+ :collection => scoped_search(history, 'id', 'asc', resource_class: ContentViewVersionExportHistory))
28
+ end
29
+
30
+ api :GET, "/content_exports/api_status", N_("true if the export api is pulp3 ready and usable. This API is intended for use by hammer-cli only.")
31
+ def api_status
32
+ ::Foreman::Deprecation.api_deprecation_warning("/content_exports/api_status is being deprecated and will be removed in a future version of Katello.")
33
+ render json: { api_usable: SmartProxy.pulp_primary.pulp3_repository_type_support?(Katello::Repository::YUM_TYPE) }, status: :ok
34
+ end
35
+
36
+ api :POST, "/content_exports/version", N_("Performs a full-export of a content view version.")
37
+ param :id, :number, :desc => N_("Content view version identifier"), :required => true
38
+ param :destination_server, String, :desc => N_("Destination Server name"), :required => false
39
+ param :chunk_size_mb, :number, :desc => N_("Split the exported content into archives "\
40
+ "no greater than the specified size in megabytes."), :required => false
41
+ param :fail_on_missing_content, :bool, :desc => N_("Fails if any of the repositories belonging to this version"\
42
+ " are unexportable. False by default."), :required => false
43
+ def version
44
+ tasks = async_task(::Actions::Pulp3::Orchestration::ContentViewVersion::Export,
45
+ content_view_version: @version,
46
+ destination_server: params[:destination_server],
47
+ chunk_size: params[:chunk_size_mb],
48
+ fail_on_missing_content: ::Foreman::Cast.to_bool(params[:fail_on_missing_content]))
49
+ respond_for_async :resource => tasks
50
+ end
51
+
52
+ api :POST, "/content_exports/library", N_("Performs a full-export of the repositories in library.")
53
+ param :organization_id, :number, :desc => N_("Organization identifier"), :required => true
54
+ param :destination_server, String, :desc => N_("Destination Server name"), :required => false
55
+ param :chunk_size_mb, :number, :desc => N_("Split the exported content into archives "\
56
+ "no greater than the specified size in megabytes."), :required => false
57
+ param :fail_on_missing_content, :bool, :desc => N_("Fails if any of the repositories belonging to this organization"\
58
+ " are unexportable. False by default."), :required => false
59
+ def library
60
+ tasks = async_task(::Actions::Pulp3::Orchestration::ContentViewVersion::ExportLibrary,
61
+ @organization,
62
+ destination_server: params[:destination_server],
63
+ chunk_size: params[:chunk_size_mb],
64
+ fail_on_missing_content: ::Foreman::Cast.to_bool(params[:fail_on_missing_content]))
65
+ respond_for_async :resource => tasks
66
+ end
67
+
68
+ private
69
+
70
+ def find_exportable_content_view_version
71
+ @version = ContentViewVersion.exportable.find_by_id(params[:id])
72
+ throw_resource_not_found(name: 'content view version', id: params[:id]) if @version.blank?
73
+ end
74
+
75
+ def find_exportable_organization
76
+ find_organization
77
+ unless @organization.can_export_library_content?
78
+ throw_resource_not_found(name: 'organization', id: params[:organization_id])
79
+ end
80
+ end
81
+
82
+ def fail_if_not_pulp3
83
+ unless SmartProxy.pulp_primary.pulp3_repository_type_support?(Katello::Repository::YUM_TYPE)
84
+ fail HttpErrors::BadRequest, _("Invalid usage for Pulp 2 repositories. Use export for Yum repositories")
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,59 @@
1
+ module Katello
2
+ class Api::V2::ContentImportsController < Api::V2::ApiController
3
+ before_action :find_publishable_content_view, :only => [:version]
4
+ before_action :find_importable_organization, :only => [:library]
5
+ before_action :find_default_content_view, :only => [:library]
6
+
7
+ api :POST, "/content_imports/version", N_("Import a content view version")
8
+ param :content_view_id, :number, :desc => N_("Content view identifier"), :required => true
9
+ param :path, String, :desc => N_("Directory containing the exported Content View Version"), :required => true
10
+ param :metadata, Hash, :desc => N_("Metadata taken from the upstream export history for this Content View Version"), :required => true
11
+ def version
12
+ if @view.default?
13
+ fail HttpErrors::BadRequest, _("Cannot use this end point for importing to library. "\
14
+ "If you intented to upload to library, use the library endpoint.")
15
+ end
16
+
17
+ task = async_task(::Actions::Katello::ContentViewVersion::Import, @view, path: params[:path], metadata: metadata_params.to_h)
18
+ respond_for_async :resource => task
19
+ end
20
+
21
+ api :POST, "/content_imports/library", N_("Import a content view version to the library")
22
+ param :organization_id, :number, :desc => N_("Organization identifier"), :required => true
23
+ param :path, String, :desc => N_("Directory containing the exported Content View Version"), :required => true
24
+ param :metadata, Hash, :desc => N_("Metadata taken from the upstream export history for this Content View Version"), :required => true
25
+ def library
26
+ task = async_task(::Actions::Katello::ContentViewVersion::ImportLibrary, @organization, path: params[:path], metadata: metadata_params.to_h)
27
+ respond_for_async :resource => task
28
+ end
29
+
30
+ private
31
+
32
+ def find_publishable_content_view
33
+ @view = ContentView.publishable.find(params[:content_view_id])
34
+ throw_resource_not_found(name: 'content_view', id: params[:content_view_id]) if @view.blank?
35
+ end
36
+
37
+ def find_default_content_view
38
+ @view = @organization&.default_content_view
39
+ throw_resource_not_found(name: 'organization', id: params[:organization_id]) if @view.blank?
40
+ end
41
+
42
+ def find_importable_organization
43
+ find_organization
44
+ throw_resource_not_found(name: 'organization', id: params[:organization_id]) unless @organization.can_import_library_content?
45
+ end
46
+
47
+ def metadata_params
48
+ params.require(:metadata).permit(
49
+ :organization,
50
+ :content_view,
51
+ :repository_mapping,
52
+ :toc,
53
+ content_view_version: [:major, :minor]
54
+ ).tap do |nested|
55
+ nested[:repository_mapping] = params[:metadata].require(:repository_mapping).permit!
56
+ end
57
+ end
58
+ end
59
+ end