katello 3.17.0 → 3.18.0

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 (272) 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 +35 -6
  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/applicability/hosts/bulk_generate.rb +6 -2
  40. data/app/lib/actions/katello/capsule_content/sync.rb +1 -1
  41. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +16 -7
  42. data/app/lib/actions/katello/content_view/promote_to_environment.rb +1 -1
  43. data/app/lib/actions/katello/content_view/publish.rb +9 -9
  44. data/app/lib/actions/katello/content_view_version/import.rb +8 -13
  45. data/app/lib/actions/katello/content_view_version/import_library.rb +17 -0
  46. data/app/lib/actions/katello/content_view_version/incremental_update.rb +18 -3
  47. data/app/lib/actions/katello/host/hypervisors_update.rb +18 -0
  48. data/app/lib/actions/katello/host/update_system_purpose.rb +31 -0
  49. data/app/lib/actions/katello/host/upload_package_profile.rb +3 -1
  50. data/app/lib/actions/katello/host/upload_profiles.rb +8 -6
  51. data/app/lib/actions/katello/organization/manifest_delete.rb +0 -1
  52. data/app/lib/actions/katello/organization/manifest_import.rb +0 -1
  53. data/app/lib/actions/katello/organization/manifest_refresh.rb +0 -1
  54. data/app/lib/actions/katello/product/content_create.rb +7 -6
  55. data/app/lib/actions/katello/repository/filtered_index_content.rb +10 -1
  56. data/app/lib/actions/katello/repository/import_upload.rb +4 -1
  57. data/app/lib/actions/katello/repository/remove_content.rb +1 -1
  58. data/app/lib/actions/katello/repository/sync.rb +3 -1
  59. data/app/lib/actions/katello/repository/update.rb +5 -1
  60. data/app/lib/actions/katello/repository/upload_files.rb +1 -0
  61. data/app/lib/actions/middleware/record_smart_proxy_sync_history.rb +15 -0
  62. data/app/lib/actions/pulp/consumer/sync_capsule.rb +4 -2
  63. data/app/lib/actions/pulp/repository/distributor_publish.rb +1 -1
  64. data/app/lib/actions/pulp3/capsule_content/sync.rb +1 -0
  65. data/app/lib/actions/pulp3/content_migration.rb +10 -0
  66. data/app/lib/actions/pulp3/content_migration_presenter.rb +59 -0
  67. data/app/lib/actions/pulp3/content_view/delete_repository_references.rb +1 -1
  68. data/app/lib/actions/pulp3/content_view_version/create_importer.rb +7 -3
  69. data/app/lib/actions/pulp3/content_view_version/export.rb +7 -1
  70. data/app/lib/actions/pulp3/content_view_version/import.rb +7 -3
  71. data/app/lib/actions/pulp3/import_migration.rb +6 -1
  72. data/app/lib/actions/pulp3/orchestration/content_view_version/copy_version_units_to_library.rb +2 -1
  73. data/app/lib/actions/pulp3/orchestration/content_view_version/export.rb +38 -14
  74. data/app/lib/actions/pulp3/orchestration/content_view_version/export_library.rb +60 -0
  75. data/app/lib/actions/pulp3/orchestration/content_view_version/import.rb +16 -10
  76. data/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb +4 -1
  77. data/app/lib/actions/pulp3/orchestration/repository/import_upload.rb +16 -3
  78. data/app/lib/actions/pulp3/repository/commit_upload.rb +2 -1
  79. data/app/lib/actions/pulp3/repository/copy_content.rb +1 -1
  80. data/app/lib/actions/pulp3/repository/delete.rb +1 -1
  81. data/app/lib/actions/pulp3/repository/save_artifact.rb +1 -1
  82. data/app/lib/actions/pulp3/repository/save_version.rb +1 -1
  83. data/app/lib/actions/pulp3/repository/upload_tag.rb +18 -0
  84. data/app/lib/katello/resources/candlepin/consumer.rb +2 -2
  85. data/app/lib/katello/resources/candlepin/owner.rb +5 -0
  86. data/app/lib/katello/resources/candlepin/upstream_consumer.rb +6 -0
  87. data/app/lib/katello/resources/registry.rb +3 -3
  88. data/app/models/katello/authorization/activation_key.rb +4 -0
  89. data/app/models/katello/authorization/content_view.rb +13 -0
  90. data/app/models/katello/authorization/content_view_component.rb +15 -0
  91. data/app/models/katello/authorization/content_view_filter.rb +15 -0
  92. data/app/models/katello/authorization/content_view_version.rb +25 -2
  93. data/app/models/katello/authorization/content_view_version_export_history.rb +1 -1
  94. data/app/models/katello/authorization/gpg_key.rb +12 -4
  95. data/app/models/katello/authorization/lifecycle_environment.rb +8 -0
  96. data/app/models/katello/authorization/organization.rb +8 -0
  97. data/app/models/katello/authorization/sync_plan.rb +16 -0
  98. data/app/models/katello/concerns/operatingsystem_extensions.rb +2 -0
  99. data/app/models/katello/concerns/organization_extensions.rb +4 -5
  100. data/app/models/katello/concerns/smart_proxy_extensions.rb +6 -4
  101. data/app/models/katello/content_migration_progress.rb +4 -0
  102. data/app/models/katello/content_view.rb +30 -4
  103. data/app/models/katello/content_view_component.rb +2 -0
  104. data/app/models/katello/content_view_filter.rb +5 -0
  105. data/app/models/katello/content_view_history.rb +2 -1
  106. data/app/models/katello/content_view_package_filter.rb +1 -1
  107. data/app/models/katello/content_view_puppet_module.rb +8 -0
  108. data/app/models/katello/content_view_repository.rb +13 -1
  109. data/app/models/katello/content_view_version_export_history.rb +8 -1
  110. data/app/models/katello/glue/candlepin/pool.rb +9 -14
  111. data/app/models/katello/glue/pulp/repo.rb +8 -0
  112. data/app/models/katello/gpg_key.rb +1 -1
  113. data/app/models/katello/ping.rb +8 -3
  114. data/app/models/katello/repository.rb +33 -0
  115. data/app/models/katello/root_repository.rb +26 -1
  116. data/app/models/katello/smart_proxy_sync_history.rb +8 -0
  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 +114 -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 +10 -4
  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 -9
  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/repositories/base.json.rabl +1 -1
  148. data/app/views/katello/layouts/react.html.erb +3 -2
  149. data/app/views/overrides/activation_keys/_host_tab_pane.html.erb +1 -5
  150. data/app/views/overrides/organizations/_index_row_override.html.erb +1 -1
  151. data/config/routes/api/v2.rb +24 -2
  152. data/config/routes/overrides.rb +1 -0
  153. data/db/migrate/20200929200357_create_katello_smart_proxy_sync_history.rb +13 -0
  154. data/db/migrate/20201008204114_add_os_versions_to_katello_root_repositories.rb +5 -0
  155. data/db/migrate/20201012172713_remove_gpg_key_perms.rb +23 -0
  156. data/db/migrate/20201012192035_add_metadata_to_katello_content_view_version_export_history.rb +5 -0
  157. data/db/migrate/20201021150008_add_import_only_to_katello_content_view.rb +5 -0
  158. data/db/migrate/20201119211133_pulp3_migration_progress.rb +9 -0
  159. data/db/seeds.d/111-upgrade_tasks.rb +2 -1
  160. data/engines/bastion/app/assets/javascripts/bastion/components/notification.service.js +1 -1
  161. data/engines/bastion/app/assets/javascripts/bastion/components/nutupane.factory.js +8 -13
  162. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-system-purpose-modal.controller.js +112 -0
  163. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-system-purpose-modal.html +78 -0
  164. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js +11 -0
  165. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.controller.js +5 -0
  166. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-debs-installed.controller.js +2 -42
  167. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +4 -0
  168. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.controller.js +6 -2
  169. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-details.controller.js +12 -0
  170. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-details.html +7 -7
  171. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-info.html +7 -1
  172. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js +17 -3
  173. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/views/content-view-new.html +16 -2
  174. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/views/content-views.html +5 -0
  175. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/host-collection-details.controller.js +4 -0
  176. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-info.html +6 -0
  177. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-bulk-action.factory.js +2 -1
  178. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +92 -19
  179. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/de.po +17 -20
  180. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/es.po +17 -24
  181. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/fr.po +1292 -1170
  182. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/it.po +17 -20
  183. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ja.po +858 -807
  184. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ko.po +18 -19
  185. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/pt_BR.po +17 -24
  186. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ru.po +17 -18
  187. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_CN.po +986 -971
  188. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_TW.po +19 -20
  189. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/translations.js +9 -9
  190. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/products-bulk-advanced-sync-modal.controller.js +6 -7
  191. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +168 -155
  192. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +17 -2
  193. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +125 -113
  194. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +15 -3
  195. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/os-versions.service.js +46 -0
  196. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/repository-types.service.js +8 -1
  197. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +1 -1
  198. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/details/views/sync-plan-details.html +1 -1
  199. data/lib/katello/engine.rb +2 -0
  200. data/lib/katello/permission_creator.rb +98 -69
  201. data/lib/katello/permissions/host_permissions.rb +1 -0
  202. data/lib/katello/plugin.rb +10 -2
  203. data/lib/katello/repository_types/deb.rb +9 -1
  204. data/lib/katello/tasks/pulp3_migration.rake +17 -3
  205. data/lib/katello/tasks/pulp3_migration_abort.rake +22 -0
  206. data/lib/katello/tasks/pulp3_migration_stats.rake +41 -0
  207. data/lib/katello/tasks/receptor/extract_orgs.rake +1 -1
  208. data/lib/katello/tasks/reset.rake +2 -1
  209. data/lib/katello/tasks/upgrades/3.18/add_cvv_export_history_metadata.rb +18 -0
  210. data/lib/katello/version.rb +1 -1
  211. data/locale/action_names.rb +51 -44
  212. data/locale/bn/katello.po +279 -55
  213. data/locale/cs/katello.po +278 -51
  214. data/locale/de/katello.po +279 -52
  215. data/locale/en/katello.po +278 -49
  216. data/locale/es/katello.po +279 -51
  217. data/locale/fr/katello.po +279 -51
  218. data/locale/gu/katello.po +279 -55
  219. data/locale/hi/katello.po +279 -55
  220. data/locale/it/katello.po +279 -51
  221. data/locale/ja/katello.po +279 -52
  222. data/locale/katello.pot +1379 -971
  223. data/locale/kn/katello.po +279 -55
  224. data/locale/ko/katello.po +279 -51
  225. data/locale/mr/katello.po +279 -55
  226. data/locale/or/katello.po +279 -55
  227. data/locale/pa/katello.po +279 -55
  228. data/locale/pt/katello.po +278 -52
  229. data/locale/pt_BR/katello.po +279 -51
  230. data/locale/ru/katello.po +279 -51
  231. data/locale/ta/katello.po +279 -55
  232. data/locale/te/katello.po +279 -55
  233. data/locale/zh_CN/katello.po +279 -51
  234. data/locale/zh_TW/katello.po +279 -52
  235. data/webpack/components/ActionableDetail.js +2 -1
  236. data/webpack/components/Search/Search.js +1 -1
  237. data/webpack/components/Table/MainTable.js +6 -2
  238. data/webpack/components/Table/TableWrapper.js +46 -9
  239. data/webpack/scenes/ContentViews/ContentViewSelectors.js +7 -3
  240. data/webpack/scenes/ContentViews/ContentViewsConstants.js +8 -0
  241. data/webpack/scenes/ContentViews/ContentViewsPage.js +2 -9
  242. data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +25 -3
  243. data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +14 -4
  244. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +2 -1
  245. data/webpack/scenes/ContentViews/Details/Repositories/ContentCounts.js +56 -0
  246. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +169 -0
  247. data/webpack/scenes/ContentViews/Details/Repositories/LastSync.js +47 -0
  248. data/webpack/scenes/ContentViews/Details/Repositories/RepoAddedStatus.js +17 -0
  249. data/webpack/scenes/ContentViews/Details/Repositories/RepoIcon.js +23 -0
  250. data/webpack/scenes/ContentViews/Details/Repositories/SelectableDropdown.js +49 -0
  251. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.fixtures.json +154 -0
  252. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.test.js +131 -0
  253. data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetail.test.js +3 -0
  254. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +4 -1
  255. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +2 -2
  256. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +29 -19
  257. data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +17 -0
  258. data/webpack/scenes/Subscriptions/Manifest/ManifestConstants.js +4 -0
  259. data/webpack/scenes/Subscriptions/Manifest/SimpleContentAccess.js +19 -2
  260. data/webpack/scenes/Subscriptions/Manifest/__tests__/SimpleContentAccess.test.js +9 -1
  261. data/webpack/scenes/Subscriptions/Manifest/index.js +2 -1
  262. data/webpack/scenes/Subscriptions/SubscriptionConstants.js +1 -1
  263. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +3 -0
  264. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +8 -2
  265. data/webpack/scenes/Subscriptions/SubscriptionsSelectors.js +3 -0
  266. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +3 -0
  267. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsSelectors.test.js +6 -0
  268. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsSelectors.test.js.snap +6 -0
  269. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +1 -13
  270. data/webpack/test-utils/react-testing-lib-wrapper.js +3 -0
  271. metadata +74 -13
  272. data/webpack/__mocks__/foremanReact/components/common/Fill/GlobalFill.js +0 -3
@@ -0,0 +1,38 @@
1
+ module Katello
2
+ module Pulp3
3
+ class Deb < PulpContentUnit
4
+ include LazyAccessor
5
+ CONTENT_TYPE = "deb".freeze
6
+
7
+ def self.content_api
8
+ PulpDebClient::ContentPackagesApi.new(Katello::Pulp3::Api::Apt.new(SmartProxy.pulp_primary!).api_client)
9
+ end
10
+
11
+ def self.content_api_create(opts = {})
12
+ self.content_api.create(opts)
13
+ end
14
+
15
+ def self.create_content(options)
16
+ fail _("Artifact Id and relative path are needed to create content") unless options.dig(:file_name) && options.dig(:artifact)
17
+ PulpDebClient::DebContent.new(relative_path: options[:file_name], artifact: options[:artifact])
18
+ end
19
+
20
+ def self.ids_for_repository(repo_id)
21
+ repo = Katello::Pulp3::Repository::Apt.new(Katello::Repository.find(repo_id), SmartProxy.pulp_primary)
22
+ repo_content_list = repo.content_list
23
+ repo_content_list.map { |content| content.try(:pulp_href) }
24
+ end
25
+
26
+ def update_model(model)
27
+ custom_json = {}
28
+ custom_json['checksum'] = backend_data['sha256']
29
+ custom_json['filename'] = backend_data['relative_path']
30
+ custom_json['name'] = backend_data['package']
31
+ custom_json['version'] = backend_data['version']
32
+ custom_json['description'] = backend_data['description']
33
+ custom_json['architecture'] = backend_data['architecture']
34
+ model.update!(custom_json)
35
+ end
36
+ end
37
+ end
38
+ end
@@ -2,6 +2,7 @@ module Katello
2
2
  module Pulp3
3
3
  class DockerManifest < PulpContentUnit
4
4
  include LazyAccessor
5
+ CONTENT_TYPE = "docker_manifest".freeze
5
6
 
6
7
  def self.content_api
7
8
  PulpContainerClient::ContentManifestsApi.new(Katello::Pulp3::Api::Docker.new(SmartProxy.pulp_primary!).api_client)
@@ -2,6 +2,7 @@ module Katello
2
2
  module Pulp3
3
3
  class DockerTag < PulpContentUnit
4
4
  include LazyAccessor
5
+ CONTENT_TYPE = "docker_tag".freeze
5
6
 
6
7
  def self.content_api
7
8
  PulpContainerClient::ContentTagsApi.new(Katello::Pulp3::Api::Docker.new(SmartProxy.pulp_primary!).api_client)
@@ -3,7 +3,7 @@ require 'pulp_2to3_migration_client'
3
3
  module Katello
4
4
  module Pulp3
5
5
  class Migration
6
- attr_accessor :smart_proxy, :reimport_all
6
+ attr_accessor :smart_proxy, :reimport_all, :task_id
7
7
  GET_QUERY_ID_LENGTH = 90
8
8
 
9
9
  MUTABLE_CONTENT_TYPES = [
@@ -21,8 +21,10 @@ module Katello
21
21
  overridden.select { |type| SmartProxy.pulp_primary.pulp3_repository_type_support?(type.to_s, false) }.map { |t| t.to_s }
22
22
  end
23
23
 
24
- def initialize(smart_proxy, repository_types = Migration.repository_types_for_migration, options = {})
25
- self.reimport_all = options.fetch(:reimport, false)
24
+ def initialize(smart_proxy, options = {})
25
+ self.task_id = options.fetch(:task_id, nil)
26
+ self.reimport_all = options.fetch(:reimport_all, false)
27
+ repository_types = options.fetch(:repository_types, Migration.repository_types_for_migration)
26
28
 
27
29
  if (repository_types - smart_proxy.supported_pulp_types[:pulp3][:overriden_to_pulp2]).any?
28
30
  fail ::Katello::Errors::Pulp3MigrationError, _("Pulp 3 migration cannot run. Types %s have already been migrated.") %
@@ -62,6 +64,15 @@ module Katello
62
64
  [YumMetadataFile]
63
65
  end
64
66
 
67
+ def last_successful_migration_time
68
+ task = ForemanTasks::Task.where(:label => Actions::Pulp3::ContentMigration.to_s, :result => 'success').order("started_at desc").first
69
+ if reimport_all || task.nil?
70
+ 0
71
+ else
72
+ task.started_at.to_i
73
+ end
74
+ end
75
+
65
76
  def content_types_for_migration
66
77
  content_types = @repository_types.collect do |repository_type_label|
67
78
  Katello::RepositoryTypeManager.repository_types[repository_type_label].content_types_to_index
@@ -70,7 +81,20 @@ module Katello
70
81
  content_types.flatten - Migration.ignorable_content_types
71
82
  end
72
83
 
84
+ def update_import_status(message, index = nil)
85
+ #reduce output updating, only update every 20 items
86
+ if (index.nil? || index % 20 == 0) && self.task_id
87
+ progress = Katello::ContentMigrationProgress.find_or_create_by(:task_id => self.task_id)
88
+ progress.update(:progress_message => message)
89
+ progress.save!
90
+
91
+ fail Katello::Errors::Pulp3MigrationError, "Cancelled by user." if progress.canceled?
92
+ end
93
+ end
94
+
73
95
  def import_pulp3_content
96
+ update_import_status("Starting katello import phase.")
97
+
74
98
  Katello::Logging.time("CONTENT_MIGRATION - Total Import Process") do
75
99
  @repository_types.each do |repository_type_label|
76
100
  Katello::Logging.time("CONTENT_MIGRATION - Importing Repository", data: {type: repository_type_label}) do
@@ -78,7 +102,7 @@ module Katello
78
102
  end
79
103
 
80
104
  Katello::RepositoryTypeManager.repository_types[repository_type_label].content_types_to_index.each do |content_type|
81
- Katello::Logging.time("CONTENT_MIGRATION - Importing Content", data: {type: content_type}) do
105
+ Katello::Logging.time("CONTENT_MIGRATION - Importing Content", data: {type: content_type.label}) do
82
106
  import_content_type(content_type)
83
107
  end
84
108
  end
@@ -114,7 +138,9 @@ module Katello
114
138
  if repository_type_label == 'yum'
115
139
  import_yum_repos(imported, katello_repos)
116
140
  else
117
- katello_repos.each do |repo|
141
+ repo_count = katello_repos.count
142
+ katello_repos.each_with_index do |repo, index|
143
+ update_import_status("Importing migrated content units #{repository_type_label}: #{index + 1}/#{repo_count}", index)
118
144
  found = imported.find { |migrated_repo| migrated_repo.pulp2_repo_id == repo.pulp_id }
119
145
  import_repo(repo, found) if found
120
146
  end
@@ -122,7 +148,9 @@ module Katello
122
148
  end
123
149
 
124
150
  def import_yum_repos(migrated_repo_items, repos)
125
- repos.each do |yum_repo|
151
+ repo_count = repos.count
152
+ repos.each_with_index do |yum_repo, index|
153
+ update_import_status("Importing migrated yum repositories: #{index + 1}/#{repo_count}", index)
126
154
  to_find = nil
127
155
  if yum_repo.content_view.composite?
128
156
  if yum_repo.link?
@@ -165,10 +193,16 @@ module Katello
165
193
  process_distributions(pulp3_api, migrated_repo.pulp3_distribution_hrefs)
166
194
  end
167
195
 
196
+ def distribution_path_from_cache(href, pulp3_api)
197
+ @distribution_cache ||= {}
198
+ @distribution_cache[href] ||= pulp3_api.distributions_api.read(href).base_path
199
+ @distribution_cache[href]
200
+ end
201
+
168
202
  def process_distributions(pulp3_api, dist_hrefs_list)
169
203
  #distribution_path_hash(pulp3_api, dist_hrefs_list).each do |relative_path, href|
170
204
  dist_hrefs_list.each do |href|
171
- relative_path = pulp3_api.distributions_api.read(href).base_path
205
+ relative_path = distribution_path_from_cache(href, pulp3_api)
172
206
 
173
207
  dist_ref = Katello::Pulp3::DistributionReference.find_or_initialize_by(:path => relative_path)
174
208
  if (distribution_repo = Katello::Repository.find_by(:relative_path => relative_path) || Katello::Repository.find_by(:container_repository_name => relative_path))
@@ -189,14 +223,16 @@ module Katello
189
223
  end
190
224
 
191
225
  def operate_on_errata
226
+ last_migration_time = last_successful_migration_time
192
227
  offset = 0
193
- limit = 300
194
- response = pulp2_content_api.list(pulp2_content_type_id: 'erratum', offset: offset, limit: limit)
228
+ limit = SETTINGS[:katello][:pulp][:bulk_load_size]
229
+ response = pulp2_content_api.list(pulp2_content_type_id: 'erratum', offset: offset, limit: limit, pulp2_last_updated__gt: last_migration_time)
195
230
  total_count = response.count
196
231
  yield(response.results)
197
232
  until (offset + limit > total_count)
198
233
  offset += limit
199
- response = pulp2_content_api.list(pulp2_content_type_id: 'erratum', offset: offset, limit: limit)
234
+ response = pulp2_content_api.list(pulp2_content_type_id: 'erratum', offset: offset, limit: limit, pulp2_last_updated__gt: last_migration_time)
235
+ update_import_status("Importing migrated content type erratum: #{offset + limit}/#{total_count}")
200
236
  yield(response.results)
201
237
  end
202
238
  end
@@ -236,7 +272,12 @@ module Katello
236
272
  unmigrated_units = unmigrated_units.where(:migrated_pulp3_href => nil)
237
273
  end
238
274
 
275
+ total_count = unmigrated_units.count
276
+ current_count = 0
277
+
239
278
  unmigrated_units.select(:id, :pulp_id).find_in_batches(batch_size: GET_QUERY_ID_LENGTH) do |needing_hrefs|
279
+ current_count += needing_hrefs.count
280
+ update_import_status("Importing migrated content type #{content_type.label}: #{current_count}/#{total_count}")
240
281
  migrated_units = pulp2_content_api.list(pulp2_id__in: needing_hrefs.map { |unit| unit.pulp_id }.join(','))
241
282
  migrated_units.results.each do |migrated_unit|
242
283
  matching_record = needing_hrefs.find { |db_unit| db_unit.pulp_id == migrated_unit.pulp2_id }
@@ -11,6 +11,11 @@ module Katello
11
11
  fail NotImplementedError
12
12
  end
13
13
 
14
+ def self.content_api_create(opts = {})
15
+ relative_path = opts.delete(:relative_path)
16
+ self.content_api.create(relative_path, opts)
17
+ end
18
+
14
19
  def self.create_content
15
20
  fail NotImplementedError
16
21
  end
@@ -1,5 +1,4 @@
1
1
  require "pulpcore_client"
2
-
3
2
  module Katello
4
3
  module Pulp3
5
4
  class Repository
@@ -188,8 +187,9 @@ module Katello
188
187
  api.repositories_api.read(repository_reference.try(:repository_href))
189
188
  end
190
189
 
191
- def delete(href = repository_reference.try(:repository_href))
192
- repository_reference.try(:destroy)
190
+ def delete_repository(repo_reference = repository_reference)
191
+ href = repo_reference.try(:repository_href)
192
+ repo_reference.try(:destroy)
193
193
  ignore_404_exception { api.repositories_api.delete(href) } if href
194
194
  end
195
195
 
@@ -205,10 +205,16 @@ module Katello
205
205
  end
206
206
 
207
207
  def create_publication
208
- publication_data = api.class.publication_class.new(repository_version: repo.version_href)
208
+ publication_data = api.class.publication_class.new(publication_options(repo.version_href))
209
209
  api.publications_api.create(publication_data)
210
210
  end
211
211
 
212
+ def publication_options(repository_version)
213
+ {
214
+ repository_version: repository_version
215
+ }
216
+ end
217
+
212
218
  def relative_path
213
219
  repo.relative_path.sub(/^\//, '')
214
220
  end
@@ -19,6 +19,15 @@ module Katello
19
19
  name: "#{generate_backend_object_name}"
20
20
  }
21
21
  end
22
+
23
+ def partial_repo_path
24
+ "/pulp_ansible/galaxy/#{repo.relative_path}/api/v2/collections"
25
+ end
26
+
27
+ def mirror_remote_options
28
+ {
29
+ }
30
+ end
22
31
  end
23
32
  end
24
33
  end
@@ -0,0 +1,63 @@
1
+ require 'pulp_deb_client'
2
+
3
+ module Katello
4
+ module Pulp3
5
+ class Repository
6
+ class Apt < ::Katello::Pulp3::Repository
7
+ SIGNING_SERVICE_NAME = 'katello_deb_sign'.freeze
8
+
9
+ def remote_options
10
+ deb_remote_options = {
11
+ distributions: root.deb_releases
12
+ }
13
+ deb_remote_options[:components] = root.deb_components.present? ? root.deb_components : nil
14
+ deb_remote_options[:architectures] = root.deb_architectures.present? ? root.deb_architectures : nil
15
+
16
+ if root.url.blank?
17
+ deb_remote_options[:url] = nil
18
+ end
19
+
20
+ deb_remote_options[:gpgkey] = root.gpg_key.present? ? root.gpg_key.content : nil
21
+
22
+ common_remote_options.merge(deb_remote_options)
23
+ end
24
+
25
+ def publication_options(repository_version)
26
+ ss = api.signing_services_api.list(name: SIGNING_SERVICE_NAME).results
27
+ popts = super(repository_version)
28
+ popts.merge!(
29
+ {
30
+ # structured is not necessary for subscription-manager
31
+ #structured: true, # publish real suites (e.g. 'stable')
32
+ simple: true # publish all into 'default'-suite
33
+ }
34
+ )
35
+ popts[:signing_service] = ss[0].pulp_href if ss && ss.length == 1
36
+ popts
37
+ end
38
+
39
+ def distribution_options(path)
40
+ {
41
+ base_path: path,
42
+ publication: repo.publication_href,
43
+ name: "#{generate_backend_object_name}"
44
+ }
45
+ end
46
+
47
+ def partial_repo_path
48
+ "/pulp/deb/#{repo.relative_path}/".sub('//', '/')
49
+ end
50
+
51
+ def copy_content_for_source
52
+ # TODO
53
+ fail NotImplementedError
54
+ end
55
+
56
+ def regenerate_applicability
57
+ # TODO
58
+ fail NotImplementedError
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -8,6 +8,10 @@ module Katello
8
8
  repo.container_repository_name
9
9
  end
10
10
 
11
+ def partial_repo_path
12
+ ''
13
+ end
14
+
11
15
  def remote_options
12
16
  options = {url: root.url, upstream_name: root.docker_upstream_name}
13
17
  if root.docker_tags_whitelist&.any?
@@ -48,6 +52,11 @@ module Katello
48
52
  api.class.recursive_manage_class.new(content_units: options[:remove_content_units]))
49
53
  end
50
54
 
55
+ def tag_manifest(name, digest)
56
+ api.repositories_api.tag(repository_reference.repository_href,
57
+ api.class.tag_image_class.new(tag: name, digest: digest))
58
+ end
59
+
51
60
  def add_content(content_unit_href)
52
61
  content_unit_href = [content_unit_href] unless content_unit_href.is_a?(Array)
53
62
  api.repositories_api.add(repository_reference.repository_href, content_units: content_unit_href)
@@ -159,8 +159,7 @@ module Katello
159
159
 
160
160
  data_dup.config[i][:content] = leftover_units.pop(copy_amount)
161
161
  unit_copy_counter += copy_amount
162
- # Do copy call if limit is reached or if we're under the limit but on the last repo config.
163
- if unit_copy_counter >= UNIT_LIMIT || (i == data_dup.config.size - 1 && leftover_units.empty?)
162
+ if unit_copy_counter != 0
164
163
  tasks << api.copy_api.copy_content(data_dup)
165
164
  unit_copy_counter = 0
166
165
  end
@@ -208,14 +207,20 @@ module Katello
208
207
  tasks
209
208
  end
210
209
 
211
- def copy_all(source_repository)
212
- data = PulpRpmClient::Copy.new
213
- data.config = [{
214
- source_repo_version: source_repository.version_href,
215
- dest_repo: repository_reference.repository_href
216
- }]
210
+ def copy_all(source_repository, mirror: false)
211
+ if mirror
212
+ data = PulpRpmClient::RepositoryAddRemoveContent.new(
213
+ base_version: source_repository.version_href)
217
214
 
218
- [api.copy_api.copy_content(data)]
215
+ [api.repositories_api.modify(repository_reference.repository_href, data)]
216
+ else
217
+ data = PulpRpmClient::Copy.new
218
+ data.config = [{
219
+ source_repo_version: source_repository.version_href,
220
+ dest_repo: repository_reference.repository_href
221
+ }]
222
+ [api.copy_api.copy_content(data)]
223
+ end
219
224
  end
220
225
 
221
226
  def remove_all_content_from_repo(repo_href)
@@ -91,10 +91,11 @@ module Katello
91
91
 
92
92
  def remote_options
93
93
  base_options = common_remote_options
94
- base_options.merge(url: remote_feed_url)
94
+ base_options.merge!(url: remote_feed_url)
95
95
  if (type_specific_options = repo_service.try(:mirror_remote_options))
96
- base_options.merge(type_specific_options)
96
+ base_options.merge!(type_specific_options)
97
97
  end
98
+ base_options
98
99
  end
99
100
 
100
101
  def create_remote
@@ -110,8 +111,11 @@ module Katello
110
111
  api.remotes_list(name: backend_object_name).first
111
112
  end
112
113
 
113
- def sync
114
- repository_sync_url_data = api.class.repository_sync_url_class.new(remote: remote_href, mirror: true)
114
+ def sync(options = {})
115
+ sync_params = repo_service.sync_url_params(options)
116
+ sync_params[:remote] = remote_href
117
+ sync_params[:mirror] = true
118
+ repository_sync_url_data = api.class.repository_sync_url_class.new(sync_params)
115
119
  [api.repositories_api.sync(repository_href, repository_sync_url_data)]
116
120
  end
117
121
 
@@ -152,6 +156,7 @@ module Katello
152
156
  dist_params[:publication] = options[:publication] if options[:publication]
153
157
  dist_params[:repository_version] = version_href if options[:use_repository_version]
154
158
  dist_options = distribution_options(path, dist_params)
159
+ dist_options.delete(:content_guard) if repo_service.repo.content_type == "docker"
155
160
  if (distro = repo_service.lookup_distributions(base_path: path).first) ||
156
161
  (distro = repo_service.lookup_distributions(name: "#{backend_object_name}").first)
157
162
  # update dist
@@ -68,6 +68,10 @@ module Katello
68
68
  task_data[:finish_time] || FINISHED_STATES.include?(task_data[:state])
69
69
  end
70
70
 
71
+ def progress_reports
72
+ task_data['progress_reports']
73
+ end
74
+
71
75
  def poll
72
76
  task_data(true)
73
77
  self
@@ -53,6 +53,10 @@ module Katello
53
53
  task_group_data['all_tasks_dispatched'] == true && IN_PROGRESS_STATES.all? { |state| task_group_data[state] == 0 }
54
54
  end
55
55
 
56
+ def group_progress_reports
57
+ task_group_data['group_progress_reports']
58
+ end
59
+
56
60
  def poll
57
61
  clear_task_group_data
58
62
  task_group_data
@@ -70,7 +70,8 @@ module Katello
70
70
  {
71
71
  :name => self.id.to_s,
72
72
  :id => self.id,
73
- :creatable => @allow_creation_by_user
73
+ :creatable => @allow_creation_by_user,
74
+ :pulp3_support => SmartProxy.pulp_primary.pulp3_repository_type_support?(self)
74
75
  }
75
76
  end
76
77