katello 3.17.1 → 3.18.1

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 (276) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/registry/registry_proxies_controller.rb +38 -21
  3. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +3 -1
  4. data/app/controllers/katello/api/v2/activation_keys_controller.rb +10 -15
  5. data/app/controllers/katello/api/v2/capsule_content_controller.rb +2 -2
  6. data/app/controllers/katello/api/v2/content_credentials_controller.rb +1 -8
  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 +84 -0
  9. data/app/controllers/katello/api/v2/content_imports_controller.rb +59 -0
  10. data/app/controllers/katello/api/v2/content_view_components_controller.rb +31 -14
  11. data/app/controllers/katello/api/v2/content_view_filters_controller.rb +17 -8
  12. data/app/controllers/katello/api/v2/content_view_repositories_controller.rb +1 -0
  13. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +65 -71
  14. data/app/controllers/katello/api/v2/content_views_controller.rb +37 -26
  15. data/app/controllers/katello/api/v2/environments_controller.rb +8 -8
  16. data/app/controllers/katello/api/v2/gpg_keys_controller.rb +5 -5
  17. data/app/controllers/katello/api/v2/host_collections_controller.rb +19 -16
  18. data/app/controllers/katello/api/v2/host_debs_controller.rb +1 -0
  19. data/app/controllers/katello/api/v2/host_errata_controller.rb +2 -2
  20. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +37 -7
  21. data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +1 -1
  22. data/app/controllers/katello/api/v2/products_controller.rb +9 -9
  23. data/app/controllers/katello/api/v2/repositories_bulk_actions_controller.rb +1 -1
  24. data/app/controllers/katello/api/v2/repositories_controller.rb +10 -5
  25. data/app/controllers/katello/api/v2/repository_sets_controller.rb +24 -14
  26. data/app/controllers/katello/api/v2/subscriptions_controller.rb +1 -1
  27. data/app/controllers/katello/api/v2/sync_plans_controller.rb +8 -9
  28. data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +9 -2
  29. data/app/controllers/katello/concerns/api/v2/authorization.rb +19 -5
  30. data/app/controllers/katello/concerns/api/v2/bulk_hosts_extensions.rb +22 -18
  31. data/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +21 -0
  32. data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +1 -1
  33. data/app/controllers/katello/concerns/organizations_controller_extensions.rb +2 -1
  34. data/app/controllers/katello/concerns/registration_controller_extensions.rb +16 -0
  35. data/app/helpers/katello/katello_urls_helper.rb +5 -2
  36. data/app/lib/actions/candlepin/product/content_create.rb +2 -0
  37. data/app/lib/actions/candlepin/product/content_update.rb +2 -0
  38. data/app/lib/actions/helpers/smart_proxy_sync_history_helper.rb +24 -0
  39. data/app/lib/actions/katello/capsule_content/sync.rb +1 -1
  40. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +22 -8
  41. data/app/lib/actions/katello/content_view/promote_to_environment.rb +1 -1
  42. data/app/lib/actions/katello/content_view/publish.rb +9 -9
  43. data/app/lib/actions/katello/content_view_version/import.rb +8 -13
  44. data/app/lib/actions/katello/content_view_version/import_library.rb +17 -0
  45. data/app/lib/actions/katello/content_view_version/incremental_update.rb +37 -6
  46. data/app/lib/actions/katello/host/update_system_purpose.rb +31 -0
  47. data/app/lib/actions/katello/host/upload_package_profile.rb +3 -1
  48. data/app/lib/actions/katello/host/upload_profiles.rb +8 -6
  49. data/app/lib/actions/katello/organization/manifest_delete.rb +0 -1
  50. data/app/lib/actions/katello/organization/manifest_import.rb +0 -1
  51. data/app/lib/actions/katello/organization/manifest_refresh.rb +0 -1
  52. data/app/lib/actions/katello/product/content_create.rb +7 -6
  53. data/app/lib/actions/katello/repository/filtered_index_content.rb +10 -1
  54. data/app/lib/actions/katello/repository/import_upload.rb +4 -1
  55. data/app/lib/actions/katello/repository/remove_content.rb +1 -1
  56. data/app/lib/actions/katello/repository/sync.rb +3 -1
  57. data/app/lib/actions/katello/repository/update.rb +5 -1
  58. data/app/lib/actions/katello/repository/upload_files.rb +1 -0
  59. data/app/lib/actions/middleware/record_smart_proxy_sync_history.rb +35 -0
  60. data/app/lib/actions/pulp/consumer/sync_capsule.rb +4 -2
  61. data/app/lib/actions/pulp/repository/distributor_publish.rb +1 -1
  62. data/app/lib/actions/pulp3/capsule_content/sync.rb +1 -0
  63. data/app/lib/actions/pulp3/content_migration.rb +10 -0
  64. data/app/lib/actions/pulp3/content_migration_presenter.rb +59 -0
  65. data/app/lib/actions/pulp3/content_view_version/create_importer.rb +7 -3
  66. data/app/lib/actions/pulp3/content_view_version/export.rb +7 -1
  67. data/app/lib/actions/pulp3/content_view_version/import.rb +7 -3
  68. data/app/lib/actions/pulp3/import_migration.rb +6 -1
  69. data/app/lib/actions/pulp3/orchestration/content_view_version/copy_version_units_to_library.rb +2 -1
  70. data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +42 -16
  71. data/app/lib/actions/pulp3/orchestration/content_view_version/export_library.rb +60 -0
  72. data/app/lib/actions/pulp3/orchestration/content_view_version/import.rb +16 -14
  73. data/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb +4 -1
  74. data/app/lib/actions/pulp3/orchestration/repository/import_upload.rb +16 -3
  75. data/app/lib/actions/pulp3/repository/commit_upload.rb +2 -1
  76. data/app/lib/actions/pulp3/repository/copy_content.rb +1 -1
  77. data/app/lib/actions/pulp3/repository/save_artifact.rb +1 -1
  78. data/app/lib/actions/pulp3/repository/save_version.rb +1 -1
  79. data/app/lib/actions/pulp3/repository/upload_tag.rb +18 -0
  80. data/app/lib/katello/resources/candlepin/consumer.rb +2 -2
  81. data/app/lib/katello/resources/candlepin/owner.rb +5 -0
  82. data/app/lib/katello/resources/candlepin/upstream_consumer.rb +6 -0
  83. data/app/lib/katello/resources/registry.rb +3 -3
  84. data/app/models/katello/authorization/activation_key.rb +4 -0
  85. data/app/models/katello/authorization/content_view.rb +13 -0
  86. data/app/models/katello/authorization/content_view_component.rb +15 -0
  87. data/app/models/katello/authorization/content_view_filter.rb +15 -0
  88. data/app/models/katello/authorization/content_view_version.rb +25 -2
  89. data/app/models/katello/authorization/content_view_version_export_history.rb +1 -1
  90. data/app/models/katello/authorization/gpg_key.rb +12 -4
  91. data/app/models/katello/authorization/lifecycle_environment.rb +8 -0
  92. data/app/models/katello/authorization/organization.rb +8 -0
  93. data/app/models/katello/authorization/sync_plan.rb +16 -0
  94. data/app/models/katello/concerns/operatingsystem_extensions.rb +2 -0
  95. data/app/models/katello/concerns/organization_extensions.rb +4 -5
  96. data/app/models/katello/concerns/pulp_database_unit.rb +7 -0
  97. data/app/models/katello/concerns/smart_proxy_extensions.rb +6 -4
  98. data/app/models/katello/content_migration_progress.rb +4 -0
  99. data/app/models/katello/content_view.rb +30 -4
  100. data/app/models/katello/content_view_component.rb +2 -0
  101. data/app/models/katello/content_view_filter.rb +5 -0
  102. data/app/models/katello/content_view_history.rb +2 -1
  103. data/app/models/katello/content_view_package_filter.rb +1 -1
  104. data/app/models/katello/content_view_puppet_module.rb +8 -0
  105. data/app/models/katello/content_view_repository.rb +13 -1
  106. data/app/models/katello/content_view_version_export_history.rb +8 -1
  107. data/app/models/katello/glue/candlepin/pool.rb +9 -14
  108. data/app/models/katello/glue/pulp/repo.rb +8 -0
  109. data/app/models/katello/gpg_key.rb +1 -1
  110. data/app/models/katello/host/subscription_facet.rb +4 -0
  111. data/app/models/katello/ping.rb +8 -3
  112. data/app/models/katello/repository.rb +33 -0
  113. data/app/models/katello/root_repository.rb +26 -1
  114. data/app/models/katello/smart_proxy_sync_history.rb +8 -0
  115. data/app/models/katello/subscription_status.rb +3 -2
  116. data/app/services/katello/applicability/applicable_content_helper.rb +12 -1
  117. data/app/services/katello/candlepin/event_handler.rb +2 -0
  118. data/app/services/katello/candlepin/message_handler.rb +34 -0
  119. data/app/services/katello/candlepin/upstream_consumer.rb +28 -0
  120. data/app/services/katello/host_status_manager.rb +9 -0
  121. data/app/services/katello/pulp3/api/apt.rb +57 -0
  122. data/app/services/katello/pulp3/api/core.rb +8 -0
  123. data/app/services/katello/pulp3/api/docker.rb +4 -0
  124. data/app/services/katello/pulp3/content_view_version/export.rb +125 -8
  125. data/app/services/katello/pulp3/content_view_version/import.rb +39 -34
  126. data/app/services/katello/pulp3/content_view_version/import_export_common.rb +6 -16
  127. data/app/services/katello/pulp3/content_view_version/import_validator.rb +84 -0
  128. data/app/services/katello/pulp3/deb.rb +38 -0
  129. data/app/services/katello/pulp3/docker_manifest.rb +1 -0
  130. data/app/services/katello/pulp3/docker_tag.rb +1 -0
  131. data/app/services/katello/pulp3/migration.rb +51 -10
  132. data/app/services/katello/pulp3/pulp_content_unit.rb +5 -0
  133. data/app/services/katello/pulp3/repository.rb +7 -1
  134. data/app/services/katello/pulp3/repository/ansible_collection.rb +9 -0
  135. data/app/services/katello/pulp3/repository/apt.rb +63 -0
  136. data/app/services/katello/pulp3/repository/docker.rb +9 -0
  137. data/app/services/katello/pulp3/repository/yum.rb +14 -8
  138. data/app/services/katello/pulp3/repository_mirror.rb +9 -4
  139. data/app/services/katello/pulp3/task.rb +4 -0
  140. data/app/services/katello/pulp3/task_group.rb +4 -0
  141. data/app/services/katello/repository_type.rb +2 -1
  142. data/app/services/katello/smart_proxy_helper.rb +9 -0
  143. data/app/views/dashboard/_subscription_widget.html.erb +0 -5
  144. data/app/views/foreman/hosts/_registration.html.erb +12 -0
  145. data/app/views/katello/api/v2/content_view_version_export_histories/show.json.rabl +1 -1
  146. data/app/views/katello/api/v2/content_views/base.json.rabl +1 -0
  147. data/app/views/katello/api/v2/content_views/show.json.rabl +6 -0
  148. data/app/views/katello/api/v2/repositories/base.json.rabl +1 -1
  149. data/app/views/katello/layouts/react.html.erb +3 -2
  150. data/app/views/overrides/activation_keys/_host_tab_pane.html.erb +1 -5
  151. data/app/views/overrides/organizations/_index_row_override.html.erb +1 -1
  152. data/config/routes/api/v2.rb +24 -2
  153. data/config/routes/overrides.rb +1 -0
  154. data/db/migrate/20200929200357_create_katello_smart_proxy_sync_history.rb +13 -0
  155. data/db/migrate/20201008204114_add_os_versions_to_katello_root_repositories.rb +5 -0
  156. data/db/migrate/20201012172713_remove_gpg_key_perms.rb +23 -0
  157. data/db/migrate/20201012192035_add_metadata_to_katello_content_view_version_export_history.rb +5 -0
  158. data/db/migrate/20201021150008_add_import_only_to_katello_content_view.rb +5 -0
  159. data/db/migrate/20201119211133_pulp3_migration_progress.rb +9 -0
  160. data/db/seeds.d/111-upgrade_tasks.rb +2 -1
  161. data/engines/bastion/app/assets/javascripts/bastion/components/notification.service.js +1 -1
  162. data/engines/bastion/app/assets/javascripts/bastion/components/nutupane.factory.js +8 -13
  163. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-system-purpose-modal.controller.js +112 -0
  164. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-system-purpose-modal.html +78 -0
  165. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js +11 -0
  166. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.controller.js +5 -0
  167. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-debs-installed.controller.js +2 -42
  168. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +4 -0
  169. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.controller.js +6 -2
  170. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion-activation-keys.controller.js +8 -3
  171. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion-content-hosts.controller.js +9 -3
  172. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-details.controller.js +12 -0
  173. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-details.html +7 -7
  174. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-info.html +7 -1
  175. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-publish.html +4 -0
  176. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js +17 -3
  177. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/views/content-view-new.html +16 -2
  178. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/views/content-views.html +5 -0
  179. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/host-collection-details.controller.js +4 -0
  180. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-info.html +6 -0
  181. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-bulk-action.factory.js +2 -1
  182. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +92 -19
  183. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/de.po +17 -20
  184. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/es.po +17 -24
  185. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/fr.po +1292 -1170
  186. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/it.po +17 -20
  187. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ja.po +858 -807
  188. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ko.po +18 -19
  189. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/pt_BR.po +17 -24
  190. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ru.po +17 -18
  191. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_CN.po +986 -971
  192. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_TW.po +19 -20
  193. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/translations.js +9 -9
  194. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/products-bulk-advanced-sync-modal.controller.js +6 -7
  195. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +168 -155
  196. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +17 -2
  197. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +125 -113
  198. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +15 -3
  199. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/os-versions.service.js +46 -0
  200. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/repository-types.service.js +8 -1
  201. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +1 -1
  202. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/details/views/sync-plan-details.html +1 -1
  203. data/lib/katello/engine.rb +2 -0
  204. data/lib/katello/permission_creator.rb +98 -69
  205. data/lib/katello/permissions/host_permissions.rb +1 -0
  206. data/lib/katello/plugin.rb +10 -2
  207. data/lib/katello/repository_types/deb.rb +9 -1
  208. data/lib/katello/tasks/pulp3_migration.rake +17 -3
  209. data/lib/katello/tasks/pulp3_migration_abort.rake +22 -0
  210. data/lib/katello/tasks/pulp3_migration_stats.rake +41 -0
  211. data/lib/katello/tasks/receptor/extract_orgs.rake +1 -1
  212. data/lib/katello/tasks/reset.rake +2 -1
  213. data/lib/katello/tasks/upgrades/3.18/add_cvv_export_history_metadata.rb +18 -0
  214. data/lib/katello/version.rb +1 -1
  215. data/locale/action_names.rb +51 -44
  216. data/locale/bn/katello.po +279 -55
  217. data/locale/cs/katello.po +278 -51
  218. data/locale/de/katello.po +279 -52
  219. data/locale/en/katello.po +278 -49
  220. data/locale/es/katello.po +279 -51
  221. data/locale/fr/katello.po +279 -51
  222. data/locale/gu/katello.po +279 -55
  223. data/locale/hi/katello.po +279 -55
  224. data/locale/it/katello.po +279 -51
  225. data/locale/ja/katello.po +279 -52
  226. data/locale/katello.pot +1379 -971
  227. data/locale/kn/katello.po +279 -55
  228. data/locale/ko/katello.po +279 -51
  229. data/locale/mr/katello.po +279 -55
  230. data/locale/or/katello.po +279 -55
  231. data/locale/pa/katello.po +279 -55
  232. data/locale/pt/katello.po +278 -52
  233. data/locale/pt_BR/katello.po +279 -51
  234. data/locale/ru/katello.po +279 -51
  235. data/locale/ta/katello.po +279 -55
  236. data/locale/te/katello.po +279 -55
  237. data/locale/zh_CN/katello.po +279 -51
  238. data/locale/zh_TW/katello.po +279 -52
  239. data/webpack/components/ActionableDetail.js +2 -1
  240. data/webpack/components/Search/Search.js +1 -1
  241. data/webpack/components/Table/MainTable.js +6 -2
  242. data/webpack/components/Table/TableWrapper.js +46 -9
  243. data/webpack/scenes/ContentViews/ContentViewSelectors.js +7 -3
  244. data/webpack/scenes/ContentViews/ContentViewsConstants.js +8 -0
  245. data/webpack/scenes/ContentViews/ContentViewsPage.js +2 -9
  246. data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +25 -3
  247. data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +14 -4
  248. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +2 -1
  249. data/webpack/scenes/ContentViews/Details/Repositories/ContentCounts.js +56 -0
  250. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +169 -0
  251. data/webpack/scenes/ContentViews/Details/Repositories/LastSync.js +47 -0
  252. data/webpack/scenes/ContentViews/Details/Repositories/RepoAddedStatus.js +17 -0
  253. data/webpack/scenes/ContentViews/Details/Repositories/RepoIcon.js +23 -0
  254. data/webpack/scenes/ContentViews/Details/Repositories/SelectableDropdown.js +49 -0
  255. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.fixtures.json +154 -0
  256. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.test.js +131 -0
  257. data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetail.test.js +3 -0
  258. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +4 -1
  259. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +2 -2
  260. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +29 -19
  261. data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +17 -0
  262. data/webpack/scenes/Subscriptions/Manifest/ManifestConstants.js +4 -0
  263. data/webpack/scenes/Subscriptions/Manifest/SimpleContentAccess.js +19 -2
  264. data/webpack/scenes/Subscriptions/Manifest/__tests__/SimpleContentAccess.test.js +9 -1
  265. data/webpack/scenes/Subscriptions/Manifest/index.js +2 -1
  266. data/webpack/scenes/Subscriptions/SubscriptionConstants.js +1 -1
  267. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +3 -0
  268. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +8 -2
  269. data/webpack/scenes/Subscriptions/SubscriptionsSelectors.js +3 -0
  270. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +3 -0
  271. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsSelectors.test.js +6 -0
  272. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsSelectors.test.js.snap +6 -0
  273. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +1 -13
  274. data/webpack/test-utils/react-testing-lib-wrapper.js +3 -0
  275. metadata +74 -13
  276. data/webpack/__mocks__/foremanReact/components/common/Fill/GlobalFill.js +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4911d03477352b7d0d1f70c1fe0aabf89a4203f925d11b06b09fb753cca4119
4
- data.tar.gz: 0442bdaf70ac3842ccae4d639111cdbefabb4d3c6601292c789fd7184e4273d0
3
+ metadata.gz: 78239ba1e921e408588db439d4b929151e1a9c10408e23c63f0ec5c76a23c66b
4
+ data.tar.gz: f945779353ab8cedce6a30e33f5ac4a264f6790e486a00126f15d3862babdfce
5
5
  SHA512:
6
- metadata.gz: 93f259c486b6f6d766389c062a894ca2a77e46cebe0fa9d4b6cb00d3722cefbeffefc46d0836c4bfcb08979206517d1e586e10ae5de0b22049798f060626b32f
7
- data.tar.gz: 61b4ea0699d961668d15ff3235d67e4bb8bb30e987166a8a8cf6a00444a827b19d63665842fccf3f65539e28ddf46c277b4b0c070321b6cfe4254921b483e629
6
+ metadata.gz: f5526ccfbae423e0315e89349253756acf60bb920c9e3f1e2b7f581f677312e19d0141a185f58adeea0b08dc4d1a2d323bd051404c6c0d54faedd06ed5667427
7
+ data.tar.gz: 5f7d476d2061439219dc468b5ead1291835fe68bfacf1396b54db46f3e9afe3ca13c3383e5d5ce92f1d07c76ab5a0f59cffa78cda0c9500345dc5813c6ea24dc
@@ -166,25 +166,27 @@ module Katello
166
166
  headers[header[0].split('_')[1..-1].join('-')] = header[1]
167
167
  end
168
168
 
169
- r = Resources::Registry::Proxy.get(@_request.fullpath, headers)
170
- logger.debug filter_sensitive_data(r)
171
- results = JSON.parse(r)
172
-
173
- response.header['Docker-Content-Digest'] = "sha256:#{Digest::SHA256.hexdigest(r)}"
174
- # https://docs.docker.com/registry/spec/manifest-v2-2/
175
- # If its v2 schema 2 only the mediaType attribute will be present in the manifest
176
- media_type = results['mediaType']
177
- if media_type.blank?
178
- # so mediaType is not schema2 v2 only set the mediaType based on
179
- # https://docs.docker.com/registry/spec/manifest-v2-1/
180
- media_type = if results["signatures"].blank?
181
- 'application/vnd.docker.distribution.manifest.v1+json'
182
- else
183
- 'application/vnd.docker.distribution.manifest.v1+prettyjws'
184
- end
185
- end
169
+ if (manifest_response = redirect_client { Resources::Registry::Proxy.get(@_request.fullpath, headers) })
170
+ #when pulp 2 is removed, this should no longer be needed, and all clients should be redirected
171
+ logger.debug filter_sensitive_data(manifest_response)
172
+ results = JSON.parse(manifest_response)
173
+
174
+ response.header['Docker-Content-Digest'] = "sha256:#{Digest::SHA256.hexdigest(manifest_response)}"
175
+ # https://docs.docker.com/registry/spec/manifest-v2-2/
176
+ # If its v2 schema 2 only the mediaType attribute will be present in the manifest
177
+ media_type = results['mediaType']
178
+ if media_type.blank?
179
+ # so mediaType is not schema2 v2 only set the mediaType based on
180
+ # https://docs.docker.com/registry/spec/manifest-v2-1/
181
+ media_type = if results["signatures"].blank?
182
+ 'application/vnd.docker.distribution.manifest.v1+json'
183
+ else
184
+ 'application/vnd.docker.distribution.manifest.v1+prettyjws'
185
+ end
186
+ end
186
187
 
187
- render json: r, content_type: media_type
188
+ render json: manifest_response, content_type: media_type
189
+ end
188
190
  end
189
191
 
190
192
  def check_blob
@@ -199,11 +201,24 @@ module Katello
199
201
  render json: {}
200
202
  end
201
203
 
204
+ def redirect_client
205
+ return yield
206
+ rescue RestClient::Exception => exception
207
+ if [301, 302, 307].include?(exception.response.code)
208
+ redirect_to exception.response.headers[:location]
209
+ nil
210
+ else
211
+ raise exception
212
+ end
213
+ end
214
+
202
215
  def pull_blob
203
216
  headers = {}
204
217
  headers['Accept'] = request.headers['Accept'] if request.headers['Accept']
205
- r = Resources::Registry::Proxy.get(@_request.fullpath, headers)
206
- render json: r
218
+ if (blob_response = redirect_client { Resources::Registry::Proxy.get(@_request.fullpath, headers, max_redirects: 0) })
219
+ #when pulp 2 is removed, this should no longer be needed, and all clients should be redirected
220
+ render json: blob_response
221
+ end
207
222
  end
208
223
 
209
224
  def push_manifest
@@ -478,7 +493,9 @@ module Katello
478
493
  end
479
494
 
480
495
  def confirm_settings
481
- return true if SETTINGS.dig(:katello, :container_image_registry)
496
+ if SETTINGS.dig(:katello, :container_image_registry) || SmartProxy.pulp_primary&.pulp3_repository_type_support?(::Katello::Repository::DOCKER_TYPE)
497
+ return true
498
+ end
482
499
  render_error('custom_error', :status => :not_found,
483
500
  :locals => { :message => "Registry not configured" })
484
501
  end
@@ -119,7 +119,9 @@ module Katello
119
119
  # Note that this request comes in as content-type 'text/plain' so that
120
120
  # tomcat won't parse the json. Here we just pass the plain body through to candlepin
121
121
  def async_hypervisors_update
122
- task = Katello::Resources::Candlepin::Consumer.async_hypervisors(params[:owner], request.raw_post)
122
+ task = Katello::Resources::Candlepin::Consumer.async_hypervisors(owner: params[:owner],
123
+ reporter_id: params[:reporter_id],
124
+ raw_json: request.raw_post)
123
125
  async_task(::Actions::Katello::Host::Hypervisors, nil, :task_id => task['id'])
124
126
 
125
127
  render :json => task
@@ -1,5 +1,4 @@
1
1
  module Katello
2
- # rubocop:disable Metrics/ClassLength
3
2
  class Api::V2::ActivationKeysController < Api::V2::ApiController
4
3
  include Katello::Concerns::FilteredAutoCompleteSearch
5
4
  include Katello::Concerns::Api::V2::ContentOverridesController
@@ -7,11 +6,10 @@ module Katello
7
6
  before_action :find_environment, :only => [:index, :create, :update]
8
7
  before_action :find_optional_organization, :only => [:index, :create, :show]
9
8
  before_action :find_content_view, :only => [:index]
10
- before_action :find_activation_key, :only => [:show, :update, :destroy, :available_releases, :copy, :product_content,
11
- :available_host_collections, :add_host_collections, :remove_host_collections,
12
- :content_override, :add_subscriptions, :remove_subscriptions,
13
- :subscriptions]
14
- before_action :authorize
9
+ before_action :find_authorized_katello_resource, :only => [:show, :update, :destroy, :available_releases, :product_content,
10
+ :available_host_collections, :add_host_collections, :remove_host_collections,
11
+ :content_override, :add_subscriptions, :remove_subscriptions,
12
+ :subscriptions]
15
13
  before_action :verify_simple_content_access_disabled, :only => [:add_subscriptions]
16
14
 
17
15
  wrap_parameters :include => (ActivationKey.attribute_names + %w(host_collection_ids service_level auto_attach purpose_role purpose_usage purpose_addons content_view_environment))
@@ -97,6 +95,9 @@ module Katello
97
95
  param :id, :number, :desc => N_("ID of the activation key"), :required => true
98
96
  param :organization_id, :number, :desc => N_("organization identifier"), :required => false
99
97
  def copy
98
+ @activation_key = Katello::ActivationKey.readable.find_by(:id => params[:id])
99
+ throw_resource_not_found(name: 'activation_key', id: params[:id]) if @activation_key.nil?
100
+
100
101
  fail HttpErrors::BadRequest, _("New name cannot be blank") unless params[:new_name]
101
102
  @new_activation_key = @activation_key.copy(params[:new_name])
102
103
  @new_activation_key.user = current_user
@@ -256,12 +257,6 @@ module Katello
256
257
  activation_keys
257
258
  end
258
259
 
259
- def find_activation_key
260
- @activation_key = ActivationKey.find(params[:id])
261
- fail HttpErrors::NotFound, _("Couldn't find activation key '%s'") % params[:id] if @activation_key.nil?
262
- @activation_key
263
- end
264
-
265
260
  private
266
261
 
267
262
  def subscription_index
@@ -281,7 +276,7 @@ module Katello
281
276
  environment_id = params[:environment][:id] if !environment_id && params[:environment]
282
277
  return unless environment_id
283
278
 
284
- @environment = KTEnvironment.find(environment_id)
279
+ @environment = KTEnvironment.readable.find_by(id: environment_id)
285
280
  fail HttpErrors::NotFound, _("Couldn't find environment '%s'") % params[:environment_id] if @environment.nil?
286
281
  @organization = @environment.organization
287
282
  @environment
@@ -292,7 +287,7 @@ module Katello
292
287
  @host_collections = []
293
288
 
294
289
  ids&.each do |host_collection_id|
295
- host_collection = HostCollection.find(host_collection_id)
290
+ host_collection = HostCollection.readable.find(host_collection_id)
296
291
  fail HttpErrors::NotFound, _("Couldn't find host collection '%s'") % host_collection_id if host_collection.nil?
297
292
  @host_collections << host_collection
298
293
  end
@@ -306,7 +301,7 @@ module Katello
306
301
  def find_content_view
307
302
  if params.include?(:content_view_id)
308
303
  cv_id = params[:content_view_id]
309
- @content_view = ContentView.find_by(:id => cv_id)
304
+ @content_view = ContentView.readable.find_by(:id => cv_id)
310
305
  fail HttpErrors::NotFound, _("Couldn't find content view '%s'") % cv_id if @content_view.nil?
311
306
  end
312
307
  end
@@ -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
@@ -1,9 +1,8 @@
1
1
  module Katello
2
2
  class Api::V2::ContentCredentialsController < Api::V2::ApiController
3
3
  include Katello::Concerns::FilteredAutoCompleteSearch
4
- before_action :authorize
5
4
  before_action :find_organization, :only => [:create, :index, :auto_complete_search]
6
- before_action :find_content_credential, :only => [:show, :update, :destroy, :content, :set_content]
5
+ before_action :find_authorized_katello_resource, :only => [:show, :update, :destroy, :content, :set_content]
7
6
  skip_before_action :check_media_type, :only => [:create, :content, :set_content]
8
7
 
9
8
  def resource_class
@@ -103,12 +102,6 @@ module Katello
103
102
 
104
103
  protected
105
104
 
106
- def find_content_credential
107
- @content_credential = GpgKey.find(params[:id])
108
- rescue ActiveRecord::RecordNotFound
109
- raise HttpErrors::NotFound, _("Couldn't find Content Credential '%s'") % params[:id]
110
- end
111
-
112
105
  def content_credential_params
113
106
  params.permit(:name, :content_type, :content)
114
107
  end
@@ -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 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,84 @@
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_group :search, Api::V2::ApiController
14
+ add_scoped_search_description_for(ContentViewVersionExportHistory)
15
+ def index
16
+ history = ContentViewVersionExportHistory.readable
17
+ history = history.where(:id => params[:id]) unless params[:id].blank?
18
+ history = history.where(:content_view_version_id => params[:content_view_version_id]) unless params[:content_view_version_id].blank?
19
+ history = history.where(:destination_server => params[:destination_server]) unless params[:destination_server].blank?
20
+ history = history.with_organization_id(params[:organization_id]) unless params[:organization_id].blank?
21
+ history = history.with_content_view_id(params[:content_view_id]) unless params[:content_view_id].blank?
22
+ respond_with_template_collection("index", 'content_view_version_export_histories',
23
+ :collection => scoped_search(history, 'id', 'asc', resource_class: ContentViewVersionExportHistory))
24
+ end
25
+
26
+ 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.")
27
+ def api_status
28
+ ::Foreman::Deprecation.api_deprecation_warning("/content_exports/api_status is being deprecated and will be removed in a future version of Katello.")
29
+ render json: { api_usable: SmartProxy.pulp_primary.pulp3_repository_type_support?(Katello::Repository::YUM_TYPE) }, status: :ok
30
+ end
31
+
32
+ api :POST, "/content_exports/version", N_("Performs a full-export of a content view version.")
33
+ param :id, :number, :desc => N_("Content view version identifier"), :required => true
34
+ param :destination_server, String, :desc => N_("Destination Server name"), :required => false
35
+ param :chunk_size_mb, :number, :desc => N_("Split the exported content into archives "\
36
+ "no greater than the specified size in megabytes."), :required => false
37
+ param :fail_on_missing_content, :bool, :desc => N_("Fails if any of the repositories belonging to this version"\
38
+ " are unexportable. False by default."), :required => false
39
+ def version
40
+ tasks = async_task(::Actions::Pulp3::Orchestration::ContentViewVersion::Export,
41
+ content_view_version: @version,
42
+ destination_server: params[:destination_server],
43
+ chunk_size: params[:chunk_size_mb],
44
+ fail_on_missing_content: ::Foreman::Cast.to_bool(params[:fail_on_missing_content]))
45
+ respond_for_async :resource => tasks
46
+ end
47
+
48
+ api :POST, "/content_exports/library", N_("Performs a full-export of the repositories in library.")
49
+ param :organization_id, :number, :desc => N_("Organization identifier"), :required => true
50
+ param :destination_server, String, :desc => N_("Destination Server name"), :required => false
51
+ param :chunk_size_mb, :number, :desc => N_("Split the exported content into archives "\
52
+ "no greater than the specified size in megabytes."), :required => false
53
+ param :fail_on_missing_content, :bool, :desc => N_("Fails if any of the repositories belonging to this organization"\
54
+ " are unexportable. False by default."), :required => false
55
+ def library
56
+ tasks = async_task(::Actions::Pulp3::Orchestration::ContentViewVersion::ExportLibrary,
57
+ @organization,
58
+ destination_server: params[:destination_server],
59
+ chunk_size: params[:chunk_size_mb],
60
+ fail_on_missing_content: ::Foreman::Cast.to_bool(params[:fail_on_missing_content]))
61
+ respond_for_async :resource => tasks
62
+ end
63
+
64
+ private
65
+
66
+ def find_exportable_content_view_version
67
+ @version = ContentViewVersion.exportable.find_by_id(params[:id])
68
+ throw_resource_not_found(name: 'content view version', id: params[:id]) if @version.blank?
69
+ end
70
+
71
+ def find_exportable_organization
72
+ find_organization
73
+ unless @organization.can_export_library_content?
74
+ throw_resource_not_found(name: 'organization', id: params[:organization_id])
75
+ end
76
+ end
77
+
78
+ def fail_if_not_pulp3
79
+ unless SmartProxy.pulp_primary.pulp3_repository_type_support?(Katello::Repository::YUM_TYPE)
80
+ fail HttpErrors::BadRequest, _("Invalid usage for Pulp 2 repositories. Use export for Yum repositories")
81
+ end
82
+ end
83
+ end
84
+ 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