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
@@ -23,7 +23,7 @@ module Katello
23
23
 
24
24
  protected
25
25
 
26
- def fetch_tag_uuids(repo, rule, manifest_klass = DockerManifest)
26
+ def fetch_tag_pulp_ids(repo, rule, manifest_klass = DockerManifest)
27
27
  query_name = rule.name.tr("*", "%")
28
28
  tags_query = ::Katello::DockerTag.where(:repository => repo).
29
29
  where(:docker_taggable_type => manifest_klass.name).
@@ -33,14 +33,14 @@ module Katello
33
33
  query = manifest_klass.in_repositories(repo).where("id in (#{tags_query.to_sql})")
34
34
  names = query.all.collect do |manifest|
35
35
  manifest.docker_tags.where(:repository => repo).where("name ilike ?", query_name).all.collect do |tag|
36
- tag.uuid
36
+ tag.pulp_id
37
37
  end
38
38
  end
39
39
  names.flatten.uniq
40
40
  end
41
41
 
42
42
  def query_manifests(repo, rule)
43
- (fetch_tag_uuids(repo, rule, DockerManifest) + fetch_tag_uuids(repo, rule, DockerManifestList)).flatten.uniq
43
+ (fetch_tag_pulp_ids(repo, rule, DockerManifest) + fetch_tag_pulp_ids(repo, rule, DockerManifestList)).flatten.uniq
44
44
  end
45
45
  end
46
46
  end
@@ -102,7 +102,7 @@ module Katello
102
102
  end
103
103
 
104
104
  def index_content(puppet_module_uuids)
105
- associated_ids = PuppetModule.with_uuid(puppet_module_uuids).pluck(:id)
105
+ associated_ids = PuppetModule.with_pulp_id(puppet_module_uuids).pluck(:id)
106
106
  self.puppet_modules = PuppetModule.where(:id => associated_ids)
107
107
  self.save!
108
108
  end
@@ -18,12 +18,12 @@ module Katello
18
18
  before_validation :set_attributes
19
19
 
20
20
  def puppet_module
21
- PuppetModule.find_by_uuid(self.uuid)
21
+ PuppetModule.find_by(:pulp_id => self.uuid)
22
22
  end
23
23
 
24
24
  def computed_version
25
25
  if self.uuid
26
- puppet_module = PuppetModule.where(:uuid => self.uuid).first
26
+ puppet_module = PuppetModule.where(:pulp_id => self.uuid).first
27
27
  else
28
28
  puppet_module = PuppetModule.latest_module(
29
29
  self.name,
@@ -43,7 +43,6 @@ module Katello
43
43
  private
44
44
 
45
45
  def set_attributes
46
- return unless SETTINGS[:katello][:use_pulp]
47
46
  if self.uuid.present?
48
47
  puppet_module = PuppetModule.with_identifiers(self.uuid).first
49
48
  fail Errors::NotFound, _("Couldn't find Puppet Module with id '%s'") % self.uuid unless puppet_module
@@ -108,7 +108,7 @@ module Katello
108
108
  schema2.try(:docker_taggable)
109
109
  end
110
110
 
111
- def self.with_uuid(ids)
111
+ def self.with_pulp_id(ids)
112
112
  self.with_identifiers(ids)
113
113
  end
114
114
 
@@ -13,8 +13,6 @@ module Katello
13
13
 
14
14
  before_destroy :cleanup_meta_tags
15
15
 
16
- scope :in_repositories, ->(repos) { where(:repository_id => repos) }
17
-
18
16
  delegate :relative_path, :environment, :content_view_version, :product, :to => :repository
19
17
 
20
18
  def associated_meta_tag
@@ -55,12 +53,12 @@ module Katello
55
53
  self.save!
56
54
  end
57
55
 
58
- def self.import_all(uuids = nil, options = {})
59
- ::Katello::DockerTag.destroy_all if uuids.blank?
56
+ def self.import_all(pulp_ids = nil, options = {})
57
+ ::Katello::DockerTag.destroy_all if pulp_ids.blank?
60
58
  super
61
59
  ::Katello::DockerTag.where(:repository_id => nil).destroy_all
62
- if uuids
63
- repos = ::Katello::Repository.joins(:docker_tags).where("katello_docker_tags.uuid" => uuids).distinct
60
+ if pulp_ids
61
+ repos = ::Katello::Repository.joins(:docker_tags).where("katello_docker_tags.pulp_id" => pulp_ids).distinct
64
62
  ::Katello::DockerMetaTag.import_meta_tags(repos)
65
63
  else
66
64
  ::Katello::DockerMetaTag.import_meta_tags(::Katello::Repository.docker_type)
@@ -74,7 +74,7 @@ module Katello
74
74
  ids = [ids] unless ids.is_a?(Array)
75
75
  ids.map!(&:to_s)
76
76
  id_integers = ids.map { |string| Integer(string) rescue -1 }
77
- where("#{self.table_name}.id in (?) or #{self.table_name}.uuid in (?) or #{self.table_name}.errata_id in (?)", id_integers, ids, ids)
77
+ where("#{self.table_name}.id in (?) or #{self.table_name}.pulp_id in (?) or #{self.table_name}.errata_id in (?)", id_integers, ids, ids)
78
78
  end
79
79
 
80
80
  def hosts_applicable(org_id = nil)
@@ -415,6 +415,7 @@ module Katello
415
415
  Katello::ModuleStream.import_for_repository(self)
416
416
  Katello::Erratum.import_for_repository(self)
417
417
  Katello::PackageGroup.import_for_repository(self)
418
+ Katello::YumMetadataFile.import_for_repository(self)
418
419
  self.import_distribution_data
419
420
  else
420
421
  index_linked_repo
@@ -427,6 +428,8 @@ module Katello
427
428
  Erratum.copy_repository_associations(base_repo, self)
428
429
  PackageGroup.copy_repository_associations(base_repo, self)
429
430
  ModuleStream.copy_repository_associations(base_repo, self)
431
+ YumMetadataFile.copy_repository_associations(base_repo, self)
432
+
430
433
  self.update_attributes!(
431
434
  :distribution_version => base_repo.distribution_version,
432
435
  :distribution_arch => base_repo.distribution_arch,
@@ -34,6 +34,10 @@ module Katello
34
34
  end
35
35
 
36
36
  module InstanceMethods
37
+ def empty?
38
+ return self.repos(library).empty?
39
+ end
40
+
37
41
  def distributions(env)
38
42
  to_ret = []
39
43
  self.repos(env).each do |repo|
@@ -28,7 +28,7 @@ module Katello
28
28
  'label' => host.content_view.try(:label),
29
29
  'latest-version' => host.content_view.try(:latest_version),
30
30
  'version' => content_version.try(:version),
31
- 'published' => content_version.try(:created_at).try(:time).to_s,
31
+ 'published' => content_version.try(:created_at).try(:time),
32
32
  'components' => content_view_components
33
33
  }
34
34
 
@@ -43,7 +43,7 @@ module Katello
43
43
  cv_label = cv.component_version.content_view.label
44
44
  components[cv_label] = {}
45
45
  components[cv_label]['version'] = cv.component_version.try(:version)
46
- components[cv_label]['published'] = cv.component_version.try(:created_at).try(:time).to_s
46
+ components[cv_label]['published'] = cv.component_version.try(:created_at).try(:time)
47
47
  end
48
48
  components
49
49
  end
@@ -31,7 +31,6 @@ module Katello
31
31
 
32
32
  def update_from_consumer_attributes(consumer_params)
33
33
  import_database_attributes(consumer_params)
34
- self.hypervisor_guest_uuids = consumer_params['guestIds'] unless consumer_params['hypervisor_guest_uuids'].blank?
35
34
  self.facts = consumer_params['facts'] unless consumer_params['facts'].blank?
36
35
  end
37
36
 
@@ -15,7 +15,7 @@ module Katello
15
15
  has_many :content_facets, :through => :content_facet_applicable_module_streams, :class_name => "Katello::Host::ContentFacet"
16
16
 
17
17
  scoped_search on: :name, complete_value: true
18
- scoped_search on: :uuid, complete_value: true
18
+ scoped_search on: :pulp_id, complete_value: true, rename: :uuid
19
19
  scoped_search on: :stream, complete_value: true
20
20
  scoped_search on: :version, complete_value: true
21
21
  scoped_search on: :context, complete_value: true
@@ -61,15 +61,21 @@ module Katello
61
61
 
62
62
  def create_stream_artifacts(artifacts)
63
63
  artifacts.each do |name|
64
- self.artifacts.where(name: name).first_or_create!
64
+ Katello::Util::Support.active_record_retry do
65
+ self.artifacts.where(name: name).first_or_create!
66
+ end
65
67
  end
66
68
  end
67
69
 
68
70
  def create_profiles(profiles)
69
71
  profiles.select do |profile, rpms|
70
- profile = self.profiles.where(name: profile).first_or_create!
72
+ Katello::Util::Support.active_record_retry do
73
+ profile = self.profiles.where(name: profile).first_or_create!
74
+ end
71
75
  rpms.each do |rpm|
72
- profile.rpms.where(name: rpm).first_or_create!
76
+ Katello::Util::Support.active_record_retry do
77
+ profile.rpms.where(name: rpm).first_or_create!
78
+ end
73
79
  end
74
80
  end
75
81
  end
@@ -8,7 +8,8 @@ module Katello
8
8
  scoped_search :on => :name, :complete_value => true
9
9
  scoped_search :on => :version, :complete_value => true
10
10
  scoped_search :on => :commit, :complete_value => true
11
- scoped_search :on => :uuid, :complete_value => true
11
+ scoped_search :on => :pulp_id, :complete_value => true, :rename => :uuid
12
+ scoped_search :on => :version_date, :complete_value => true, :rename => :created
12
13
 
13
14
  CONTENT_TYPE = Pulp::OstreeBranch::CONTENT_TYPE
14
15
 
@@ -19,7 +20,8 @@ module Katello
19
20
  def update_from_json(json)
20
21
  update_attributes(:name => json[:branch],
21
22
  :version => json[:metadata][:version],
22
- :commit => json[:commit]
23
+ :commit => json[:commit],
24
+ :version_date => json[:_created].to_datetime
23
25
  )
24
26
  end
25
27
  end
@@ -9,7 +9,7 @@ module Katello
9
9
  has_many :roots, :through => :repositories, :class_name => "Katello::RootRepository"
10
10
 
11
11
  scoped_search :on => :name, :complete_value => true
12
- scoped_search :on => :uuid, :rename => :id, :complete_value => true
12
+ scoped_search :on => :pulp_id, :rename => :id, :complete_value => true
13
13
 
14
14
  def self.repository_association_class
15
15
  RepositoryPackageGroup
@@ -36,7 +36,7 @@ module Katello
36
36
  end
37
37
 
38
38
  def package_names
39
- group = Pulp::PackageGroup.new(self.uuid)
39
+ group = Pulp::PackageGroup.new(self.pulp_id)
40
40
  group.default_package_names + group.conditional_package_names + group.optional_package_names + group.mandatory_package_names
41
41
  end
42
42
  end
@@ -71,7 +71,7 @@ module Katello
71
71
 
72
72
  checks = executors.map { |executor| world.ping(executor.id, timeout) }
73
73
  checks.each(&:wait)
74
- if checks.any?(&:failed?)
74
+ if checks.any?(&:rejected?)
75
75
  fail _("some executors are not responding, check %{status_url}") % { :status_url => '/foreman_tasks/dynflow/status' }
76
76
  end
77
77
  end
@@ -24,7 +24,7 @@ module Katello
24
24
  scoped_search :on => :version, :complete_value => true
25
25
  scoped_search :on => :summary
26
26
 
27
- validates :uuid, :presence => true
27
+ validates :pulp_id, :presence => true
28
28
  validates :name, :presence => true
29
29
  validates :author, :presence => true
30
30
 
@@ -65,8 +65,8 @@ module Katello
65
65
  repo = puppet_module.repositories.first
66
66
 
67
67
  if repo
68
- result[repo.pulp_id] ||= []
69
- result[repo.pulp_id] << puppet_module.uuid
68
+ result[repo.id] ||= []
69
+ result[repo.id] << puppet_module
70
70
  else
71
71
  fail _("Could not find Repository for module %s.") % puppet_module.name
72
72
  end
@@ -62,6 +62,8 @@ module Katello
62
62
  has_many :repository_docker_manifest_lists, :class_name => "Katello::RepositoryDockerManifestList", :dependent => :delete_all
63
63
  has_many :docker_manifest_lists, :through => :repository_docker_manifest_lists
64
64
 
65
+ has_many :yum_metadata_files, :dependent => :destroy, :class_name => "Katello::YumMetadataFile"
66
+
65
67
  has_many :docker_tags, :dependent => :destroy, :class_name => "Katello::DockerTag"
66
68
 
67
69
  has_many :docker_meta_tags, :dependent => :destroy, :class_name => "Katello::DockerMetaTag"
@@ -159,6 +161,10 @@ module Katello
159
161
  @service ||= Katello::Pulp::Repository.instance_for_type(self, smart_proxy)
160
162
  end
161
163
 
164
+ def backend_content_service(smart_proxy)
165
+ backend_service(smart_proxy).content_service
166
+ end
167
+
162
168
  def organization
163
169
  if self.environment
164
170
  self.environment.organization
@@ -275,6 +281,13 @@ module Katello
275
281
  end
276
282
  end
277
283
 
284
+ def empty_errata!
285
+ found = empty_errata.to_a
286
+ yield(found) if block_given?
287
+ self.repository_errata.where(:erratum_id => found.map(&:id)).delete_all
288
+ found
289
+ end
290
+
278
291
  def clones
279
292
  self.root.repositories.where.not(:id => library_instance_id || id)
280
293
  end
@@ -501,7 +514,7 @@ module Katello
501
514
  if is_integer
502
515
  self.removable_unit_association.where("#{table_name}.id in (?)", ids)
503
516
  else
504
- self.removable_unit_association.where("#{table_name}.uuid in (?)", ids)
517
+ self.removable_unit_association.where("#{table_name}.pulp_id in (?)", ids)
505
518
  end
506
519
  end
507
520
 
@@ -752,7 +765,7 @@ module Katello
752
765
  end
753
766
 
754
767
  class Jail < ::Safemode::Jail
755
- allow :name, :label, :docker_upstream_name, :url
768
+ allow :name, :label, :docker_upstream_name
756
769
  end
757
770
  end
758
771
  end
@@ -47,6 +47,7 @@ module Katello
47
47
  validate :ensure_ostree_repo_protected, :if => :ostree?
48
48
  validate :ensure_compatible_download_policy, :if => :yum?
49
49
  validate :ensure_valid_ignorable_content
50
+ validate :ensure_valid_docker_tags_whitelist
50
51
  validate :ensure_content_attribute_restrictions
51
52
  validate :ensure_valid_upstream_authorization
52
53
  validates :url, presence: true, if: :ostree?
@@ -173,6 +174,15 @@ module Katello
173
174
  end
174
175
  end
175
176
 
177
+ def ensure_valid_docker_tags_whitelist
178
+ return if docker_tags_whitelist.blank?
179
+ if !docker?
180
+ errors.add(:docker_tags_whitelist, N_("White list can be only set for Container Image repositories."))
181
+ elsif !docker_tags_whitelist.is_a?(Array)
182
+ errors.add(:docker_tags_whitelist, N_("Invalid value specified for Container Image repositories."))
183
+ end
184
+ end
185
+
176
186
  def ensure_valid_upstream_authorization
177
187
  return if (self.upstream_username.blank? && self.upstream_password.blank?)
178
188
  if redhat?
@@ -0,0 +1,46 @@
1
+ module Katello
2
+ class YumMetadataFile < Katello::Model
3
+ include Concerns::PulpDatabaseUnit
4
+ include ScopedSearchExtensions
5
+ belongs_to :repository, :inverse_of => :yum_metadata_files, :class_name => "Katello::Repository"
6
+ CONTENT_TYPE = Pulp::YumMetadataFile::CONTENT_TYPE
7
+
8
+ def update_from_json(json)
9
+ shared_attributes = json.keys & self.class.column_names
10
+ shared_json = json.select { |key, _v| shared_attributes.include?(key) }
11
+ repo = ::Katello::Repository.find_by(:pulp_id => json['repo_id']).try(:id)
12
+ self.update_attributes!(shared_json.merge(repository_id: repo,
13
+ name: find_name_from_json(json)))
14
+ end
15
+
16
+ def find_name_from_json(json)
17
+ # get the name of the metadata file.
18
+ # Notice that pulp does not have a way to get name of the metadata file
19
+ # so we infer it from the _storage_path
20
+ # for example from the following storage path
21
+ # "/var/lib/pulp/content/units/yum_repo_metadata_file/..../050-productid.gz"
22
+ # we find the right most '/' and return everything after that
23
+ # i.e -> "050-productid.gz"
24
+ path = json["_storage_path"]
25
+ path[path.rindex('/') + 1..-1]
26
+ end
27
+
28
+ def self.import_for_repository(repository)
29
+ ::Katello::YumMetadataFile.where(:repository_id => repository).destroy_all
30
+ super(repository, true)
31
+ end
32
+
33
+ def self.manage_repository_association
34
+ false
35
+ end
36
+
37
+ # yum metadata file only has one repo
38
+ def repositories
39
+ [repository]
40
+ end
41
+
42
+ def self.completer_scope_options
43
+ {"#{Katello::Repository.table_name}" => lambda { |repo_class| repo_class.yum_type } }
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,19 @@
1
+ module Katello
2
+ module Abstract
3
+ module Pulp
4
+ module Content
5
+ def create_upload
6
+ fail NotImplementedError
7
+ end
8
+
9
+ def upload_chunk
10
+ fail NotImplementedError
11
+ end
12
+
13
+ def delete_upload
14
+ fail NotImplementedError
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -84,7 +84,7 @@ module Katello
84
84
  def applicable_differences(partial)
85
85
  content_uuids = ::Katello::Pulp::Consumer.new(content_facet.uuid).applicable_ids(content_type)
86
86
  if partial
87
- consumer_uuids = content_facet.send(applicable_units).pluck("#{content_unit_class.table_name}.uuid")
87
+ consumer_uuids = content_facet.send(applicable_units).pluck("#{content_unit_class.table_name}.pulp_id")
88
88
  to_remove = consumer_uuids - content_uuids
89
89
  to_add = content_uuids - consumer_uuids
90
90
  else
@@ -94,8 +94,8 @@ module Katello
94
94
  [to_add, to_remove]
95
95
  end
96
96
 
97
- def insert(uuids)
98
- applicable_ids = content_unit_class.where(:uuid => uuids).pluck(:id)
97
+ def insert(pulp_ids)
98
+ applicable_ids = content_unit_class.where(:pulp_id => pulp_ids).pluck(:id)
99
99
  unless applicable_ids.empty?
100
100
  inserts = applicable_ids.map { |applicable_id| "(#{applicable_id.to_i}, #{content_facet.id.to_i})" }
101
101
  sql = "INSERT INTO #{content_facet_association_class.table_name} (#{content_unit_association_id}, content_facet_id) VALUES #{inserts.join(', ')}"
@@ -103,8 +103,8 @@ module Katello
103
103
  end
104
104
  end
105
105
 
106
- def remove(uuids)
107
- applicable_ids = content_unit_class.where(:uuid => uuids).pluck(:id)
106
+ def remove(pulp_ids)
107
+ applicable_ids = content_unit_class.where(:pulp_id => pulp_ids).pluck(:id)
108
108
  content_facet_association_class.where(:content_facet_id => content_facet.id, content_unit_association_id => applicable_ids).delete_all
109
109
  end
110
110
  end
@@ -0,0 +1,17 @@
1
+ module Katello
2
+ module Pulp
3
+ class Content
4
+ extend Katello::Abstract::Pulp::Content
5
+ class << self
6
+ extend Forwardable
7
+ def_delegator :pulp_content, :create_upload_request, :create_upload
8
+ def_delegator :pulp_content, :delete_upload_request, :delete_upload
9
+ def_delegator :pulp_content, :upload_bits, :upload_chunk
10
+
11
+ private def pulp_content
12
+ SmartProxy.pulp_master.pulp_api.resources.content
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end