katello 3.10.2 → 3.11.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 (242) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/registry/registry_proxies_controller.rb +16 -22
  3. data/app/controllers/katello/api/v2/content_uploads_controller.rb +4 -7
  4. data/app/controllers/katello/api/v2/content_view_puppet_modules_controller.rb +4 -5
  5. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +4 -4
  6. data/app/controllers/katello/api/v2/content_views_controller.rb +3 -3
  7. data/app/controllers/katello/api/v2/docker_manifests_controller.rb +1 -1
  8. data/app/controllers/katello/api/v2/errata_controller.rb +2 -2
  9. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +1 -3
  10. data/app/controllers/katello/api/v2/package_groups_controller.rb +3 -3
  11. data/app/controllers/katello/api/v2/repositories_controller.rb +5 -24
  12. data/app/controllers/katello/api/v2/repository_sets_controller.rb +1 -1
  13. data/app/controllers/katello/application_controller.rb +4 -4
  14. data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +1 -1
  15. data/app/controllers/katello/sync_management_controller.rb +1 -1
  16. data/app/helpers/katello/errata_mailer_helper.rb +1 -1
  17. data/app/helpers/katello/sync_management_helper.rb +1 -1
  18. data/app/lib/actions/candlepin/environment/add_content_to_environment.rb +18 -0
  19. data/app/lib/actions/katello/content_view_puppet_environment/clone.rb +1 -4
  20. data/app/lib/actions/katello/content_view_puppet_environment/clone_content_for_version.rb +20 -0
  21. data/app/lib/actions/katello/content_view_puppet_environment/create_for_version.rb +3 -2
  22. data/app/lib/actions/katello/content_view_version/incremental_update.rb +15 -16
  23. data/app/lib/actions/katello/host/hypervisors_update.rb +17 -6
  24. data/app/lib/actions/katello/organization/manifest_delete.rb +1 -3
  25. data/app/lib/actions/katello/organization/manifest_import.rb +1 -3
  26. data/app/lib/actions/katello/organization/manifest_refresh.rb +1 -3
  27. data/app/lib/actions/katello/provider/update.rb +1 -1
  28. data/app/lib/actions/katello/repository/check_matching_content.rb +8 -2
  29. data/app/lib/actions/katello/repository/clone_contents.rb +52 -0
  30. data/app/lib/actions/katello/repository/clone_to_environment.rb +1 -11
  31. data/app/lib/actions/katello/repository/clone_to_version.rb +19 -29
  32. data/app/lib/actions/katello/repository/create.rb +3 -4
  33. data/app/lib/actions/katello/repository/export.rb +1 -2
  34. data/app/lib/actions/katello/repository/import_upload.rb +7 -5
  35. data/app/lib/actions/katello/repository/purge_empty_content.rb +16 -0
  36. data/app/lib/actions/katello/repository/remove_content.rb +2 -2
  37. data/app/lib/actions/katello/repository/sync.rb +1 -1
  38. data/app/lib/actions/pulp/content_view_puppet_environment/copy_contents.rb +36 -0
  39. data/app/lib/actions/pulp/repository/copy_all_units.rb +27 -0
  40. data/app/lib/actions/pulp/repository/copy_units.rb +29 -0
  41. data/app/lib/actions/pulp/repository/refresh.rb +3 -7
  42. data/app/lib/actions/pulp/repository/regenerate_applicability.rb +5 -2
  43. data/app/lib/katello/concerns/renderer_extensions.rb +1 -1
  44. data/app/lib/katello/http_resource.rb +5 -1
  45. data/app/lib/katello/resources/candlepin/consumer.rb +9 -0
  46. data/app/lib/katello/resources/candlepin/content.rb +2 -3
  47. data/app/lib/katello/util/cdn_var_substitutor.rb +1 -2
  48. data/app/lib/katello/util/path_with_substitutions.rb +18 -1
  49. data/app/lib/katello/validators/content_view_puppet_module_validator.rb +2 -2
  50. data/app/lib/katello/validators/environment_docker_repositories_validator.rb +7 -5
  51. data/app/models/katello/concerns/hostgroup_extensions.rb +2 -7
  52. data/app/models/katello/concerns/organization_extensions.rb +11 -1
  53. data/app/models/katello/concerns/pulp_database_unit.rb +40 -24
  54. data/app/models/katello/concerns/redhat_extensions.rb +7 -3
  55. data/app/models/katello/content_view.rb +5 -7
  56. data/app/models/katello/content_view_docker_filter.rb +3 -3
  57. data/app/models/katello/content_view_puppet_environment.rb +1 -1
  58. data/app/models/katello/content_view_puppet_module.rb +2 -3
  59. data/app/models/katello/docker_meta_tag.rb +1 -1
  60. data/app/models/katello/docker_tag.rb +4 -6
  61. data/app/models/katello/erratum.rb +1 -1
  62. data/app/models/katello/glue/pulp/repo.rb +3 -0
  63. data/app/models/katello/glue/pulp/repos.rb +4 -0
  64. data/app/models/katello/host/info_provider.rb +2 -2
  65. data/app/models/katello/host/subscription_facet.rb +0 -1
  66. data/app/models/katello/module_stream.rb +10 -4
  67. data/app/models/katello/ostree_branch.rb +4 -2
  68. data/app/models/katello/package_group.rb +2 -2
  69. data/app/models/katello/ping.rb +1 -1
  70. data/app/models/katello/puppet_module.rb +3 -3
  71. data/app/models/katello/repository.rb +15 -2
  72. data/app/models/katello/root_repository.rb +10 -0
  73. data/app/models/katello/yum_metadata_file.rb +46 -0
  74. data/app/services/katello/abstract/pulp/content.rb +19 -0
  75. data/app/services/katello/applicable_content_helper.rb +5 -5
  76. data/app/services/katello/pulp/content.rb +17 -0
  77. data/app/services/katello/pulp/repository.rb +45 -15
  78. data/app/services/katello/pulp/repository/deb.rb +8 -0
  79. data/app/services/katello/pulp/repository/docker.rb +19 -0
  80. data/app/services/katello/pulp/repository/file.rb +10 -0
  81. data/app/services/katello/pulp/repository/ostree.rb +4 -0
  82. data/app/services/katello/pulp/repository/puppet.rb +10 -0
  83. data/app/services/katello/pulp/repository/yum.rb +73 -0
  84. data/app/services/katello/pulp/yum_metadata_file.rb +7 -0
  85. data/app/services/katello/repository_type.rb +5 -0
  86. data/app/views/dashboard/_errata_widget.html.erb +1 -1
  87. data/app/views/katello/api/v2/debs/base.json.rabl +2 -1
  88. data/app/views/katello/api/v2/docker_tags/_base.json.rabl +3 -3
  89. data/app/views/katello/api/v2/errata/show.json.rabl +2 -1
  90. data/app/views/katello/api/v2/file_units/base.json.rabl +2 -1
  91. data/app/views/katello/api/v2/module_streams/base.json.rabl +2 -1
  92. data/app/views/katello/api/v2/ostree_branches/show.json.rabl +3 -2
  93. data/app/views/katello/api/v2/package_groups/base.json.rabl +2 -1
  94. data/app/views/katello/api/v2/package_groups/show.json.rabl +1 -1
  95. data/app/views/katello/api/v2/packages/base.json.rabl +2 -1
  96. data/app/views/katello/api/v2/packages/show.json.rabl +1 -1
  97. data/app/views/katello/api/v2/puppet_modules/base.json.rabl +2 -1
  98. data/app/views/katello/api/v2/puppet_modules/show.json.rabl +1 -1
  99. data/app/views/katello/api/v2/repositories/base.json.rabl +1 -0
  100. data/app/views/katello/layouts/react.html.erb +3 -3
  101. data/db/migrate/20181219205642_create_yum_metadata_file.rb +20 -0
  102. data/db/migrate/20190107160723_units_uuid_to_backend_ident.rb +8 -0
  103. data/db/seeds.d/101-locations.rb +11 -13
  104. data/db/seeds.d/102-organizations.rb +5 -3
  105. data/db/seeds.d/111-upgrade_tasks.rb +1 -1
  106. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion_katello.js +2 -0
  107. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/common/views/subscription-add-or-remove.html +1 -1
  108. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-subscriptions-modal.html +2 -2
  109. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.module.js +2 -1
  110. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-errata.html +2 -2
  111. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-events.html +1 -1
  112. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +2 -2
  113. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-provisioning-info.html +1 -1
  114. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +2 -2
  115. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.module.js +2 -1
  116. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/errata-filter-details.html +2 -2
  117. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/filter-repositories.html +2 -2
  118. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/filters.html +1 -1
  119. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/histories/views/content-view-history.html +20 -20
  120. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-deb-repositories.html +1 -1
  121. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-docker-repositories.html +1 -1
  122. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-file-repositories.html +1 -1
  123. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-ostree-repositories.html +1 -1
  124. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-repositories.html +1 -1
  125. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-versions.html +1 -1
  126. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-version-content.controller.js +1 -1
  127. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-errata.html +1 -1
  128. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-ostree-branches.html +2 -0
  129. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/views/content-views.html +1 -1
  130. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/dates/dates.module.js +50 -0
  131. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-content-views.html +1 -1
  132. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-details.html +0 -1
  133. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-errata.html +2 -1
  134. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-ostree.html +2 -0
  135. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/environments.module.js +2 -1
  136. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/views/erratum-info.html +2 -2
  137. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/errata.module.js +2 -1
  138. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/views/errata.html +1 -1
  139. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/views/ostree-branch-info.html +3 -0
  140. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/views/products-bulk-sync-plan-modal.html +3 -3
  141. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +6 -5
  142. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-manage-ostree-branches.html +4 -0
  143. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/views/product-info.html +5 -4
  144. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.controller.js +7 -8
  145. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/views/partials/product-table-sync-status.html +5 -4
  146. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/views/subscription-info.html +3 -3
  147. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/manifest/views/manifest-details.html +2 -2
  148. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/manifest/views/manifest-import-history.html +1 -1
  149. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/subscription-start-date.html +1 -1
  150. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/subscriptions.html +1 -1
  151. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/details/views/sync-plan-info.html +1 -1
  152. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/views/sync-plans.html +2 -2
  153. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/views/task-details.html +2 -2
  154. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/views/tasks-table.html +1 -1
  155. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/views/user-tasks-table.html +1 -1
  156. data/engines/bastion_katello/lib/bastion_katello/engine.rb +6 -1
  157. data/lib/katello/engine.rb +3 -3
  158. data/lib/katello/plugin.rb +3 -3
  159. data/lib/katello/repository_types/deb.rb +1 -0
  160. data/lib/katello/repository_types/yum.rb +1 -0
  161. data/lib/katello/tasks/reimport.rake +1 -0
  162. data/lib/katello/tasks/repository.rake +1 -1
  163. data/lib/katello/tasks/upgrades/3.11/import_yum_metadata_file.rake +12 -0
  164. data/lib/katello/version.rb +1 -1
  165. data/package.json +3 -1
  166. data/webpack/__mocks__/foremanReact/components/Pagination/PaginationWrapper.js +2 -0
  167. data/webpack/__mocks__/foremanReact/components/common/EmptyState.js +8 -0
  168. data/webpack/common_index.js +6 -0
  169. data/webpack/containers/Application/config.js +3 -3
  170. data/webpack/move_to_foreman/components/common/table/components/Table.js +3 -3
  171. data/webpack/move_to_foreman/components/common/table/components/Table.test.js +2 -0
  172. data/webpack/move_to_foreman/components/common/table/components/__snapshots__/Table.test.js.snap +1 -17
  173. data/webpack/redux/actions/RedHatRepositories/helpers.js +19 -10
  174. data/webpack/scenes/ModuleStreams/Details/Profiles/__tests__/ModuleStreamDetailProfiles.test.js +2 -0
  175. data/webpack/scenes/ModuleStreams/Details/Repositories/__tests__/ModuleStreamDetailRepositories.test.js +2 -0
  176. data/webpack/scenes/ModuleStreams/Details/__tests__/ModuleStreamDetails.test.js +2 -0
  177. data/webpack/scenes/ModuleStreams/__tests__/ModuleStreamPage.test.js +1 -0
  178. data/webpack/scenes/ModuleStreams/__tests__/ModuleStreamsTable.test.js +1 -0
  179. data/webpack/scenes/RedHatRepositories/helpers.js +3 -3
  180. data/webpack/scenes/Subscriptions/Details/__tests__/__snapshots__/SubscriptionDetailProductContent.test.js.snap +1 -0
  181. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +1 -1
  182. data/webpack/scenes/Subscriptions/Manifest/__tests__/ManageManifestModal.test.js +1 -0
  183. data/webpack/scenes/Subscriptions/Manifest/__tests__/__snapshots__/ManageManifestModal.test.js.snap +1 -1
  184. data/webpack/scenes/Subscriptions/SubscriptionActions.js +10 -0
  185. data/webpack/scenes/Subscriptions/SubscriptionConstants.js +6 -0
  186. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +16 -0
  187. data/webpack/scenes/Subscriptions/SubscriptionValidations.js +3 -3
  188. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +28 -25
  189. data/webpack/scenes/Subscriptions/SubscriptionsSelectors.js +6 -0
  190. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +0 -1
  191. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsPage.test.js +1 -0
  192. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/__snapshots__/UpstreamSubscriptionsPage.test.js.snap +0 -1
  193. data/webpack/scenes/Subscriptions/__tests__/SubscriptionValidations.test.js +9 -4
  194. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsActions.test.js +14 -0
  195. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +2 -0
  196. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsReducer.test.js +24 -0
  197. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsSelectors.test.js +6 -0
  198. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsActions.test.js.snap +24 -0
  199. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +1 -1
  200. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsReducer.test.js.snap +138 -0
  201. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsSelectors.test.js.snap +6 -0
  202. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/EntitlementsInlineEditFormatter.js +8 -6
  203. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableHelpers.js +23 -11
  204. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/EntitlementsInlineEditFormatter.test.js +14 -10
  205. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.fixtures.js +105 -0
  206. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.test.js +2 -0
  207. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTableHelpers.test.js +44 -0
  208. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/EntitlementsInlineEditFormatter.test.js.snap +3 -3
  209. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionsTable.test.js.snap +2 -222
  210. data/webpack/scenes/Subscriptions/index.js +4 -0
  211. metadata +41 -44
  212. data/app/lib/actions/katello/content_view_puppet_environment/clone_content.rb +0 -32
  213. data/app/lib/actions/katello/repository/clone_deb_content.rb +0 -70
  214. data/app/lib/actions/katello/repository/clone_docker_content.rb +0 -26
  215. data/app/lib/actions/katello/repository/clone_file_content.rb +0 -17
  216. data/app/lib/actions/katello/repository/clone_ostree_content.rb +0 -17
  217. data/app/lib/actions/katello/repository/clone_yum_content.rb +0 -105
  218. data/app/lib/actions/katello/repository/clone_yum_metadata.rb +0 -36
  219. data/app/lib/actions/pulp/repository/copy_deb.rb +0 -15
  220. data/app/lib/actions/pulp/repository/copy_deb_component.rb +0 -11
  221. data/app/lib/actions/pulp/repository/copy_deb_release.rb +0 -11
  222. data/app/lib/actions/pulp/repository/copy_distribution.rb +0 -11
  223. data/app/lib/actions/pulp/repository/copy_docker_manifest.rb +0 -11
  224. data/app/lib/actions/pulp/repository/copy_docker_tag.rb +0 -11
  225. data/app/lib/actions/pulp/repository/copy_errata.rb +0 -15
  226. data/app/lib/actions/pulp/repository/copy_files.rb +0 -11
  227. data/app/lib/actions/pulp/repository/copy_module_default.rb +0 -11
  228. data/app/lib/actions/pulp/repository/copy_module_stream.rb +0 -11
  229. data/app/lib/actions/pulp/repository/copy_ostree_branch.rb +0 -11
  230. data/app/lib/actions/pulp/repository/copy_package_group.rb +0 -11
  231. data/app/lib/actions/pulp/repository/copy_puppet_module.rb +0 -15
  232. data/app/lib/actions/pulp/repository/copy_rpm.rb +0 -15
  233. data/app/lib/actions/pulp/repository/copy_srpm.rb +0 -16
  234. data/app/lib/actions/pulp/repository/copy_yum_metadata_file.rb +0 -11
  235. data/app/lib/actions/pulp/repository/purge_empty_errata.rb +0 -19
  236. data/app/lib/actions/pulp/repository/purge_empty_package_groups.rb +0 -24
  237. data/db/migrate/20190326145039_remove_version_date_from_ostree_branch.rb +0 -5
  238. data/lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake +0 -32
  239. data/webpack/components/PaginationRow/PaginationRow.test.js +0 -25
  240. data/webpack/components/PaginationRow/__snapshots__/PaginationRow.test.js.snap +0 -35
  241. data/webpack/components/PaginationRow/index.js +0 -94
  242. data/webpack/move_to_foreman/components/common/EmptyState/index.js +0 -68
@@ -21,6 +21,16 @@ module Katello
21
21
  Katello::RepositoryTypeManager.repository_types[repo.root.content_type].service_class.new(repo, smart_proxy)
22
22
  end
23
23
 
24
+ def unit_type_id(_uploads = [])
25
+ @repo.unit_type_id
26
+ end
27
+
28
+ def unit_keys(uploads)
29
+ uploads.map do |upload|
30
+ upload.except('id', 'name')
31
+ end
32
+ end
33
+
24
34
  def partial_repo_path
25
35
  fail NotImplementedError
26
36
  end
@@ -49,6 +59,22 @@ module Katello
49
59
  fail NotImplementedError
50
60
  end
51
61
 
62
+ def regenerate_applicability
63
+ fail NotImplementedError
64
+ end
65
+
66
+ def copy_contents(_destination_repo, _filters)
67
+ fail NotImplementedError
68
+ end
69
+
70
+ def content_service
71
+ Katello::Pulp::Content
72
+ end
73
+
74
+ def should_purge_empty_contents?
75
+ false
76
+ end
77
+
52
78
  def sync(overrides = {})
53
79
  sync_options = {}
54
80
  sync_options[:max_speed] = SETTINGS.dig(:katello, :pulp, :sync_KBlimit)
@@ -123,10 +149,9 @@ module Katello
123
149
  end
124
150
 
125
151
  def refresh
126
- tasks = update_or_associate_importer
127
- tasks += update_or_associate_distributors
128
- tasks += remove_unnecessary_distributors
129
- tasks
152
+ update_or_associate_importer
153
+ update_or_associate_distributors
154
+ remove_unnecessary_distributors
130
155
  end
131
156
 
132
157
  def update_or_associate_importer
@@ -134,7 +159,6 @@ module Katello
134
159
  importer = generate_importer
135
160
  found = existing_importers.find { |i| i['importer_type_id'] == importer.id }
136
161
 
137
- tasks = []
138
162
  if found
139
163
  ssl_ca_cert = importer.config.delete('ssl_ca_cert')
140
164
  ssl_client_cert = importer.config.delete('ssl_client_cert')
@@ -142,40 +166,46 @@ module Katello
142
166
  importer.config['basic_auth_username'] = nil if importer.config['basic_auth_username'].blank?
143
167
  importer.config['basic_auth_password'] = nil if importer.config['basic_auth_password'].blank?
144
168
  # Update ssl options by themselves workaround for https://pulp.plan.io/issues/2727
145
- tasks << smart_proxy.pulp_api.resources.repository.update_importer(repo.pulp_id, found['id'], :ssl_client_cert => ssl_client_cert,
169
+ smart_proxy.pulp_api.resources.repository.update_importer(repo.pulp_id, found['id'], :ssl_client_cert => ssl_client_cert,
146
170
  :ssl_client_key => ssl_client_key, :ssl_ca_cert => ssl_ca_cert)
147
- tasks << smart_proxy.pulp_api.resources.repository.update_importer(repo.pulp_id, found['id'], importer.config)
171
+ smart_proxy.pulp_api.resources.repository.update_importer(repo.pulp_id, found['id'], importer.config)
148
172
  else
149
- tasks << smart_proxy.pulp_api.resources.repository.associate_importer(repo.pulp_id, repo.importers.first['importer_type_id'], importer.config)
173
+ smart_proxy.pulp_api.resources.repository.associate_importer(repo.pulp_id, repo.importers.first['importer_type_id'], importer.config)
150
174
  end
151
- tasks
152
175
  end
153
176
 
154
177
  def update_or_associate_distributors
155
- tasks = []
156
178
  existing_distributors = backend_data["distributors"]
157
179
  generate_distributors.each do |distributor|
158
180
  found = existing_distributors.find { |i| i['distributor_type_id'] == distributor.type_id }
159
181
  if found
160
- tasks << smart_proxy.pulp_api.resources.repository.update_distributor(repo.pulp_id, found['id'], distributor.config)
182
+ smart_proxy.pulp_api.resources.repository.
183
+ update_distributor(repo.pulp_id, found['id'], distributor.config)
161
184
  else
162
185
  smart_proxy.pulp_api.resources.repository.
163
186
  associate_distributor(repo.pulp_id, distributor.type_id, distributor.config, :distributor_id => distributor.id,
164
187
  :auto_publish => distributor.auto_publish)
165
188
  end
166
189
  end
167
- tasks
168
190
  end
169
191
 
170
192
  def remove_unnecessary_distributors
171
- tasks = []
172
193
  existing_distributors = backend_data["distributors"]
173
194
  generated_distributors = generate_distributors
174
195
  existing_distributors.each do |distributor|
175
196
  found = generated_distributors.find { |dist| dist.type_id == distributor['distributor_type_id'] }
176
- tasks << smart_proxy.pulp_api.resources.repository.delete_distributor(repo.pulp_id, distributor['id']) unless found
197
+ smart_proxy.pulp_api.resources.repository.delete_distributor(repo.pulp_id, distributor['id']) unless found
177
198
  end
178
- tasks
199
+ end
200
+
201
+ def copy_units(destination_repo, units, options = {})
202
+ content_type = units.first.class::CONTENT_TYPE
203
+ unit_ids = units.pluck(:pulp_id)
204
+ override_config = {}
205
+ override_config[:recursive] = true if options[:recursive]
206
+ override_config[:resolve_dependencies] = true if options[:resolve_dependencies]
207
+
208
+ smart_proxy.pulp_api.extensions.send(content_type).copy(repo.pulp_id, destination_repo.pulp_id, ids: unit_ids, override_config: override_config)
179
209
  end
180
210
  end
181
211
  end
@@ -41,6 +41,14 @@ module Katello
41
41
  def importer_class
42
42
  Runcible::Models::DebImporter
43
43
  end
44
+
45
+ def copy_contents(destination_repo, _options = {})
46
+ [
47
+ @smart_proxy.pulp_api.extensions.deb.copy(@repo.pulp_id, destination_repo.pulp_id, fields: ::Katello::Pulp::Deb::PULP_SELECT_FIELDS),
48
+ @smart_proxy.pulp_api.extensions.deb_release.copy(@repo.pulp_id, destination_repo.pulp_id, {}),
49
+ @smart_proxy.pulp_api.extensions.deb_component.copy(@repo.pulp_id, destination_repo.pulp_id, {})
50
+ ]
51
+ end
44
52
  end
45
53
  end
46
54
  end
@@ -2,6 +2,16 @@ module Katello
2
2
  module Pulp
3
3
  class Repository
4
4
  class Docker < ::Katello::Pulp::Repository
5
+ def unit_type_id(uploads = [])
6
+ uploads.pluck('digest').any? ? 'docker_tag' : super
7
+ end
8
+
9
+ def unit_keys(uploads)
10
+ uploads.map do |upload|
11
+ upload.except('id')
12
+ end
13
+ end
14
+
5
15
  def generate_master_importer
6
16
  config = {
7
17
  feed: root.url,
@@ -37,6 +47,15 @@ module Katello
37
47
  def importer_class
38
48
  Runcible::Models::DockerImporter
39
49
  end
50
+
51
+ def copy_contents(destination_repo, options = {})
52
+ if options[:filters]
53
+ clause_gen = ::Katello::Util::DockerManifestClauseGenerator.new(@repo, options[:filters])
54
+ criteria = {filters: {:unit => clause_gen.copy_clause } }
55
+ end
56
+
57
+ @smart_proxy.pulp_api.extensions.docker_tag.copy(@repo.pulp_id, destination_repo.pulp_id, criteria || {})
58
+ end
40
59
  end
41
60
  end
42
61
  end
@@ -2,6 +2,12 @@ module Katello
2
2
  module Pulp
3
3
  class Repository
4
4
  class File < ::Katello::Pulp::Repository
5
+ def unit_keys(uploads)
6
+ uploads.map do |upload|
7
+ upload.except('id')
8
+ end
9
+ end
10
+
5
11
  def generate_master_importer
6
12
  config = { feed: root.url }
7
13
  importer_class.new(config.merge(master_importer_connection_options))
@@ -25,6 +31,10 @@ module Katello
25
31
  def importer_class
26
32
  Runcible::Models::IsoImporter
27
33
  end
34
+
35
+ def copy_contents(destination_repo, _options = {})
36
+ @smart_proxy.pulp_api.extensions.file.copy(@repo.pulp_id, destination_repo.pulp_id, {})
37
+ end
28
38
  end
29
39
  end
30
40
  end
@@ -34,6 +34,10 @@ module Katello
34
34
  def importer_class
35
35
  Runcible::Models::OstreeImporter
36
36
  end
37
+
38
+ def copy_contents(destination_repo, _options = {})
39
+ @smart_proxy.pulp_api.extensions.ostree_branch.copy(@repo.pulp_id, destination_repo.pulp_id, {})
40
+ end
37
41
  end
38
42
  end
39
43
  end
@@ -37,6 +37,16 @@ module Katello
37
37
  def importer_class
38
38
  Runcible::Models::PuppetImporter
39
39
  end
40
+
41
+ def copy_contents(destination_repo, options = {})
42
+ if options[:puppet_modules]
43
+ module_uuids = options[:puppet_modules].pluck(:pulp_id)
44
+ clauses = {'filters': { 'association': { 'unit_id' => { "$in" => module_uuids } } } }
45
+ else
46
+ clauses = {}
47
+ end
48
+ @smart_proxy.pulp_api.extensions.puppet_module.copy(@repo.pulp_id, destination_repo.pulp_id, clauses)
49
+ end
40
50
  end
41
51
  end
42
52
  end
@@ -55,6 +55,79 @@ module Katello
55
55
  policy
56
56
  end
57
57
  end
58
+
59
+ def regenerate_applicability
60
+ smart_proxy.pulp_api.extensions.repository.regenerate_applicability_by_ids([repo.pulp_id], true)
61
+ end
62
+
63
+ def copy_contents(destination_repo, options = {})
64
+ rpm_copy_clauses, rpm_remove_clauses = generate_copy_clauses(options[:filters], options[:rpm_filenames])
65
+ tasks = [smart_proxy.pulp_api.extensions.rpm.copy(repo.pulp_id, destination_repo.pulp_id, rpm_copy_clauses)]
66
+ if rpm_remove_clauses
67
+ tasks << smart_proxy.pulp_api.extensions.repository.unassociate_units(destination_repo.pulp_id,
68
+ type_ids: [::Katello::Pulp::Rpm::CONTENT_TYPE],
69
+ filters: {unit: rpm_remove_clauses})
70
+ end
71
+
72
+ [:srpm, :errata, :package_group, :yum_repo_metadata_file, :distribution, :module, :module_default].each do |type|
73
+ tasks << smart_proxy.pulp_api.extensions.send(type).copy(repo.pulp_id, destination_repo.pulp_id)
74
+ end
75
+ tasks
76
+ end
77
+
78
+ def purge_empty_contents
79
+ [purge_empty_errata, purge_empty_package_groups]
80
+ end
81
+
82
+ def should_purge_empty_contents?
83
+ true
84
+ end
85
+
86
+ private
87
+
88
+ def purge_empty_errata
89
+ task = nil
90
+ repo.empty_errata! do |errata_to_delete|
91
+ task = repo.unassociate_by_filter(::Katello::ContentViewErratumFilter::CONTENT_TYPE,
92
+ "id" => { "$in" => errata_to_delete.map(&:errata_id) })
93
+ end
94
+ task
95
+ end
96
+
97
+ def purge_empty_package_groups
98
+ rpm_names = repo.rpms.pluck(:name).uniq
99
+
100
+ # Remove all package groups with no packages
101
+ package_groups_to_delete = repo.package_groups.select do |group|
102
+ (rpm_names & group.package_names).empty?
103
+ end
104
+
105
+ repo.repository_package_groups.where(:package_group_id => package_groups_to_delete.map(&:id)).delete_all
106
+
107
+ criteria = {:association => {"unit_id" => {"$in" => package_groups_to_delete.compact}}}
108
+ smart_proxy.pulp_api.extensions.repository.unassociate_units(repo.pulp_id, :filters => criteria)
109
+ end
110
+
111
+ def generate_copy_clauses(filters, rpm_filenames)
112
+ if rpm_filenames&.any?
113
+ copy_clauses = {filters: {unit: { 'filename' => { '$in' => rpm_filenames } }}}
114
+ remove_clauses = nil
115
+ elsif filters
116
+ clause_gen = ::Katello::Util::PackageClauseGenerator.new(repo, filters.yum)
117
+ clause_gen.generate
118
+
119
+ copy = clause_gen.copy_clause
120
+ copy_clauses = {filters: {unit: copy }} if copy
121
+
122
+ remove = clause_gen.remove_clause
123
+ remove_clauses = {filters: {unit: remove}} if remove
124
+ else
125
+ copy_clauses = {}
126
+ remove_clauses = nil
127
+ end
128
+ copy_clauses.merge!(fields: ::Katello::Pulp::Rpm::PULP_SELECT_FIELDS)
129
+ [copy_clauses, remove_clauses]
130
+ end
58
131
  end
59
132
  end
60
133
  end
@@ -0,0 +1,7 @@
1
+ module Katello
2
+ module Pulp
3
+ class YumMetadataFile < PulpContentUnit
4
+ CONTENT_TYPE = "yum_repo_metadata_file".freeze
5
+ end
6
+ end
7
+ end
@@ -13,6 +13,7 @@ module Katello
13
13
  end
14
14
 
15
15
  def_field :allow_creation_by_user, :service_class
16
+ attr_accessor :metadata_publish_matching_check
16
17
  attr_reader :id
17
18
 
18
19
  def initialize(id)
@@ -20,6 +21,10 @@ module Katello
20
21
  allow_creation_by_user(true)
21
22
  end
22
23
 
24
+ def prevent_unneeded_metadata_publish
25
+ self.metadata_publish_matching_check = true
26
+ end
27
+
23
28
  def <=>(other)
24
29
  self.id.to_s <=> other.id.to_s
25
30
  end
@@ -23,7 +23,7 @@
23
23
  <tr>
24
24
  <td class="ellipsis" title="<%= erratum.errata_type %>"><%= erratum.errata_type %></td>
25
25
  <td class="ellipsis">
26
- <a href="/errata/<%= erratum.uuid %>">
26
+ <a href="/errata/<%= erratum.pulp_id %>">
27
27
  <%= erratum.errata_id %> (<%= n_("%s Host", "%s Hosts", hosts.length) % hosts.length %>)
28
28
  </a>
29
29
  </td>
@@ -7,4 +7,5 @@ attributes :architecture
7
7
  attributes :filename
8
8
  attributes :checksum
9
9
  attributes :description
10
- attributes :uuid
10
+ attributes :pulp_id
11
+ attributes :pulp_id => :uuid
@@ -4,17 +4,17 @@ attributes :id, :name
4
4
  attributes :repository_id
5
5
 
6
6
  child :schema1_manifest => :manifest_schema1 do
7
- attributes :uuid => :id
7
+ attributes :pulp_id => :id
8
8
  attributes :schema_version, :digest, :manifest_type
9
9
  end
10
10
 
11
11
  child :schema2_manifest => :manifest_schema2 do
12
- attributes :uuid => :id
12
+ attributes :pulp_id => :id
13
13
  attributes :schema_version, :digest, :manifest_type
14
14
  end
15
15
 
16
16
  child :docker_manifest => :manifest do
17
- attributes :uuid => :id
17
+ attributes :pulp_id => :id
18
18
  attributes :schema_version, :digest, :manifest_type
19
19
  end
20
20
 
@@ -1,9 +1,10 @@
1
1
  object @resource
2
2
 
3
- attributes :id, :uuid, :title, :errata_id
3
+ attributes :id, :pulp_id, :title, :errata_id
4
4
  attributes :issued, :updated, :version, :status, :release
5
5
  attributes :severity, :description, :solution, :summary, :reboot_suggested
6
6
  attributes :_href
7
+ attributes :pulp_id => :uuid
7
8
 
8
9
  child :cves => :cves do
9
10
  attributes :cve_id, :href
@@ -3,5 +3,6 @@ object @resource
3
3
  attributes :id
4
4
  attributes :name
5
5
  attributes :path
6
- attributes :uuid
6
+ attributes :pulp_id => :uuid
7
+ attributes :pulp_id
7
8
  attributes :checksum
@@ -1,4 +1,5 @@
1
1
  object @resource
2
2
 
3
- attributes :id, :name, :uuid, :version, :context, :stream,
3
+ attributes :id, :name, :pulp_id, :version, :context, :stream,
4
4
  :arch, :description, :summary, :module_spec
5
+ attributes :pulp_id => :uuid
@@ -1,4 +1,5 @@
1
1
  object @resource
2
2
 
3
- attributes :uuid, :id
4
- attributes :name, :version, :commit
3
+ attributes :pulp_id, :id
4
+ attributes :name, :version, :commit, :version_date
5
+ attributes :pulp_id => :uuid
@@ -2,7 +2,8 @@ object @resource
2
2
 
3
3
  attributes :id
4
4
  attributes :name
5
- attributes :uuid
5
+ attributes :pulp_id
6
+ attributes :pulp_id => :uuid
6
7
  attributes :description
7
8
 
8
9
  node :repository do |package_group|
@@ -1,4 +1,4 @@
1
1
  object @resource
2
2
 
3
3
  extends "katello/api/v2/package_groups/base"
4
- extends "katello/api/v2/package_groups/backend", :object => Katello::Pulp::PackageGroup.new(@resource.uuid)
4
+ extends "katello/api/v2/package_groups/backend", :object => Katello::Pulp::PackageGroup.new(@resource.pulp_id)
@@ -1,8 +1,9 @@
1
1
  object @resource
2
2
 
3
- attributes :id, :uuid, :name, :version, :release, :arch, :epoch, :summary
3
+ attributes :id, :pulp_id, :name, :version, :release, :arch, :epoch, :summary
4
4
  attributes :filename, :sourcerpm, :checksum
5
5
  attributes :nvrea, :nvra
6
+ attributes :pulp_id => :uuid
6
7
 
7
8
  node(:hosts_available_count) { |m| m.hosts_available(params[:organization_id]).count }
8
9
  node(:hosts_applicable_count) { |m| m.hosts_applicable(params[:organization_id]).count }
@@ -1,4 +1,4 @@
1
1
  object @resource
2
2
 
3
3
  extends "katello/api/v2/packages/base"
4
- extends "katello/api/v2/packages/backend", :object => Katello::Pulp::Rpm.new(@resource.uuid)
4
+ extends "katello/api/v2/packages/backend", :object => Katello::Pulp::Rpm.new(@resource.pulp_id)