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
@@ -10,17 +10,22 @@ module Actions
10
10
 
11
11
  def run
12
12
  output[:results] = input[:results]
13
- end
14
-
15
- def finalize
16
13
  @hypervisors = input[:hypervisors]
17
14
  return unless @hypervisors
18
15
 
19
16
  User.as_anonymous_admin do
20
- load_resources
17
+ ActiveRecord::Base.transaction do
18
+ load_resources
19
+ end
20
+
21
+ ActiveRecord::Base.transaction do
22
+ @hosts.each do |uuid, host|
23
+ update_subscription_facet(uuid, host)
24
+ end
25
+ end
21
26
 
22
27
  @hosts.each do |uuid, host|
23
- update_subscription_facet(uuid, host)
28
+ update_facts(uuid, host)
24
29
  end
25
30
  end
26
31
  end
@@ -34,7 +39,7 @@ module Actions
34
39
  @hosts.merge!(load_hosts_by_duplicate_name)
35
40
  @hosts.merge!(create_missing_hosts)
36
41
 
37
- candlepin_data = ::Katello::Resources::Candlepin::Consumer.get_all(@hosts.keys)
42
+ candlepin_data = ::Katello::Resources::Candlepin::Consumer.get_all_with_facts(@hosts.keys)
38
43
  @candlepin_attributes = candlepin_data.map { |consumer| [consumer[:uuid], consumer] }.to_h
39
44
  end
40
45
 
@@ -119,6 +124,12 @@ module Actions
119
124
  host.save!
120
125
  end
121
126
 
127
+ def update_facts(uuid, host)
128
+ if @candlepin_attributes.key?(uuid)
129
+ ::Katello::Host::SubscriptionFacet.update_facts(host, @candlepin_attributes[uuid][:facts]) unless @candlepin_attributes[uuid][:facts].blank?
130
+ end
131
+ end
132
+
122
133
  def rescue_strategy
123
134
  Dynflow::Action::Rescue::Skip
124
135
  end
@@ -39,9 +39,7 @@ module Actions
39
39
  end
40
40
 
41
41
  def finalize
42
- subject_organization.update_attributes!(
43
- :manifest_refreshed_at => Time.now,
44
- :audit_comment => _('Manifest deleted'))
42
+ subject_organization.audit_manifest_action(_('Manifest deleted'))
45
43
  end
46
44
  end
47
45
  end
@@ -44,9 +44,7 @@ module Actions
44
44
  end
45
45
 
46
46
  def finalize
47
- subject_organization.update_attributes!(
48
- :manifest_refreshed_at => Time.now,
49
- :audit_comment => _('Manifest imported'))
47
+ subject_organization.audit_manifest_action(_('Manifest imported'))
50
48
  end
51
49
  end
52
50
  end
@@ -60,9 +60,7 @@ module Actions
60
60
  end
61
61
 
62
62
  def finalize
63
- subject_organization.manifest_refreshed_at = Time.now
64
- subject_organization.audit_comment = _('Manifest refreshed')
65
- subject_organization.save(validate: false)
63
+ subject_organization.audit_manifest_action(_('Manifest refreshed'))
66
64
  end
67
65
  end
68
66
  end
@@ -30,7 +30,7 @@ module Actions
30
30
  next unless repository.url
31
31
  path = repository.url.split(current_base_url)[1]
32
32
  url = "#{new_base_url}#{path}"
33
- plan_action(::Actions::Katello::Repository::Update, repository, :url => url)
33
+ plan_action(::Actions::Katello::Repository::Update, repository.root, :url => url)
34
34
  end
35
35
  end
36
36
  end
@@ -20,9 +20,9 @@ module Actions
20
20
  errata = errata_match?(source_repo, target_repo)
21
21
  package_groups = package_groups_match?(source_repo, target_repo)
22
22
  distributions = distributions_match?(source_repo, target_repo)
23
- checksum_match = (target_repo.saved_checksum_type == source_repo.saved_checksum_type)
23
+ yum_metadata_files = yum_metadata_files_match?(source_repo, target_repo)
24
24
 
25
- output[:matching_content] = srpms_match && rpms && errata && package_groups && distributions && target_repo.published? && checksum_match
25
+ output[:matching_content] = yum_metadata_files && srpms_match && rpms && errata && package_groups && distributions && target_repo.published?
26
26
  end
27
27
 
28
28
  if source_repo.content_type == ::Katello::Repository::DEB_TYPE
@@ -63,6 +63,12 @@ module Actions
63
63
  def distributions_match?(source_repo, target_repo)
64
64
  source_repo.distribution_information == target_repo.distribution_information
65
65
  end
66
+
67
+ def yum_metadata_files_match?(source_repo, target_repo)
68
+ source_repo_items = source_repo.yum_metadata_files.pluck(:name, :checksum).sort
69
+ target_repo_items = target_repo.yum_metadata_files.pluck(:name, :checksum).sort
70
+ source_repo_items == target_repo_items
71
+ end
66
72
  end
67
73
  end
68
74
  end
@@ -0,0 +1,52 @@
1
+ module Actions
2
+ module Katello
3
+ module Repository
4
+ class CloneContents < Actions::Base
5
+ def plan(source_repositories, new_repository, options)
6
+ filters = options.fetch(:filters, nil)
7
+ rpm_filenames = options.fetch(:rpm_filenames, nil)
8
+ generate_metadata = options.fetch(:generate_metadata, true)
9
+ index_content = options.fetch(:index_content, true)
10
+ purge_empty_contents = options.fetch(:purge_empty_contents, false)
11
+ copy_contents = options.fetch(:copy_contents, true)
12
+
13
+ sequence do
14
+ if copy_contents
15
+ source_repositories.each do |repository|
16
+ plan_action(Pulp::Repository::CopyAllUnits, repository, new_repository,
17
+ filters: filters, rpm_filenames: rpm_filenames)
18
+ end
19
+ end
20
+
21
+ metadata_generate(source_repositories, new_repository, filters, rpm_filenames) if generate_metadata
22
+
23
+ plan_action(Katello::Repository::IndexContent, id: new_repository.id) if index_content
24
+
25
+ if purge_empty_contents && new_repository.backend_service(SmartProxy.pulp_master).should_purge_empty_contents?
26
+ plan_action(Katello::Repository::PurgeEmptyContent, id: new_repository.id)
27
+ end
28
+ end
29
+ end
30
+
31
+ def metadata_generate(source_repositories, new_repository, filters, rpm_filenames)
32
+ metadata_options = {}
33
+
34
+ if source_repositories.count == 1 && filters.empty? && rpm_filenames.empty?
35
+ metadata_options[:source_repository] = source_repositories.first
36
+ end
37
+
38
+ check_matching_content = ::Katello::RepositoryTypeManager.find(new_repository.content_type).metadata_publish_matching_check
39
+ if new_repository.environment && source_repositories.count == 1 && check_matching_content
40
+ match_check_output = plan_action(Katello::Repository::CheckMatchingContent,
41
+ :source_repo_id => source_repositories.first.id,
42
+ :target_repo_id => new_repository.id).output
43
+
44
+ metadata_options[:matching_content] = match_check_output[:matching_content]
45
+ end
46
+
47
+ plan_action(Katello::Repository::MetadataGenerate, new_repository, metadata_options)
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -19,17 +19,7 @@ module Actions
19
19
  end
20
20
  end
21
21
 
22
- if repository.yum?
23
- plan_action(Repository::CloneYumMetadata, repository, clone)
24
- elsif repository.deb?
25
- plan_action(Repository::CloneDebContent, repository, clone, [], false)
26
- elsif repository.docker?
27
- plan_action(Repository::CloneDockerContent, repository, clone, [])
28
- elsif repository.ostree?
29
- plan_action(Repository::CloneOstreeContent, repository, clone)
30
- elsif repository.file?
31
- plan_action(Repository::CloneFileContent, repository, clone)
32
- end
22
+ plan_action(::Actions::Katello::Repository::CloneContents, [repository], clone, :copy_contents => !clone.yum?)
33
23
  end
34
24
  end
35
25
 
@@ -2,7 +2,7 @@ module Actions
2
2
  module Katello
3
3
  module Repository
4
4
  class CloneToVersion < Actions::Base
5
- # allows accessing the built object from the superior action
5
+ # allows accessing the build object from the superior action
6
6
  attr_accessor :new_repository
7
7
 
8
8
  def plan(repositories, content_view_version, options = {})
@@ -14,40 +14,30 @@ module Actions
14
14
  version: content_view_version)
15
15
 
16
16
  rpm_filenames = extract_rpm_filenames(options.fetch(:repos_units, nil), repositories.first.label)
17
+ fail _('Cannot publish a composite with rpm filenames') if content_view.composite? && rpm_filenames&.any?
18
+ if rpm_filenames&.any?
19
+ verify_rpm_filenames(repositories.first, rpm_filenames)
20
+ Rails.logger.warn("Filters on content view have been overridden by passed-in filename list during publish") if filters.any?
21
+ end
22
+
23
+ copy_contents = new_repository.master?
24
+ fail _('Cannot publish a link repository if multiple component clones are specified') if !copy_contents && repositories.count > 1
17
25
 
18
26
  sequence do
19
27
  plan_action(Repository::Create, new_repository, true, false)
20
-
21
- if new_repository.link?
22
- fail "Cannot clone metadata if more than one repository" if repositories.count > 1
23
- plan_action(Repository::CloneYumMetadata, repositories[0], new_repository)
24
- else
25
- clone_repository_content(repositories, new_repository, filters, incremental, rpm_filenames)
26
- end
27
-
28
- plan_action(Katello::Repository::MetadataGenerate, new_repository) if repositories.length > 1
28
+ plan_action(::Actions::Katello::Repository::CloneContents, repositories, new_repository,
29
+ purge_empty_contents: true,
30
+ filters: filters,
31
+ rpm_filenames: rpm_filenames,
32
+ copy_contents: copy_contents,
33
+ metadata_generate: !incremental)
29
34
  end
30
35
  end
31
36
 
32
- def clone_repository_content(repositories, new_repository, filters, incremental, rpm_filenames)
33
- repositories.each do |repository|
34
- if new_repository.yum?
35
- # If there is more than one repository passed here, that means that there are duplicate repos in a composite content view.
36
- # We skip generating metadata in this case and generate it later to prevent conflicting data, such as filters.
37
- skip_metadata = incremental || repositories.length > 1
38
- plan_action(Repository::CloneYumContent, repository, new_repository, filters, :purge_empty_units => !incremental,
39
- :generate_metadata => !skip_metadata, :index_content => !incremental,
40
- :simple_clone => incremental, :rpm_filenames => rpm_filenames)
41
- elsif new_repository.deb?
42
- plan_action(Repository::CloneDebContent, repository, new_repository, filters, !incremental,
43
- :generate_metadata => !incremental, :index_content => !incremental, :simple_clone => incremental)
44
- elsif new_repository.docker?
45
- plan_action(Repository::CloneDockerContent, repository, new_repository, filters)
46
- elsif new_repository.ostree?
47
- plan_action(Repository::CloneOstreeContent, repository, new_repository)
48
- elsif new_repository.file?
49
- plan_action(Repository::CloneFileContent, repository, new_repository)
50
- end
37
+ def verify_rpm_filenames(repo, filenames)
38
+ rpms_available = repo.rpms.pluck(:filename)
39
+ filenames.each do |filename|
40
+ fail "%s not available in repository %s" % [filename, repo.label] unless rpms_available.include? filename
51
41
  end
52
42
  end
53
43
 
@@ -18,13 +18,12 @@ module Actions
18
18
  # when creating a clone, the following actions are handled by the
19
19
  # publish/promote process
20
20
  unless clone
21
+ view_env = org.default_content_view.content_view_environment(org.library)
21
22
  if repository.product.redhat?
22
- plan_action(ContentView::UpdateEnvironment, org.default_content_view,
23
- org.library, repository.content_id)
23
+ plan_action(Actions::Candlepin::Environment::AddContentToEnvironment, :view_env_cp_id => view_env.cp_id, :content_id => repository.content_id)
24
24
  else
25
25
  content_create = plan_action(Katello::Product::ContentCreate, root)
26
- plan_action(ContentView::UpdateEnvironment, org.default_content_view,
27
- org.library, content_create.input[:content_id])
26
+ plan_action(Actions::Candlepin::Environment::AddContentToEnvironment, :view_env_cp_id => view_env.cp_id, :content_id => content_create.input[:content_id])
28
27
  end
29
28
  end
30
29
 
@@ -69,8 +69,7 @@ module Actions
69
69
  sequence do
70
70
  if repo.link?
71
71
  plan_action(Katello::Repository::Clear, repo)
72
- plan_action(Katello::Repository::CloneYumContent, repo.target_repository, repo, [], :purge_empty_units => false,
73
- :generate_metadata => false, :index_content => false)
72
+ plan_action(Pulp::Repository::CopyAllUnits, repo.target_repository, repo)
74
73
  end
75
74
  end
76
75
  end
@@ -3,13 +3,15 @@ module Actions
3
3
  module Katello
4
4
  module Repository
5
5
  class ImportUpload < Actions::EntryAction
6
- def plan(repository, upload_ids, options = {})
6
+ def plan(repository, uploads, options = {})
7
7
  action_subject(repository)
8
+ repo_service = repository.backend_service(::SmartProxy.pulp_master)
8
9
 
9
- unit_keys = options.fetch(:unit_keys, {})
10
+ upload_ids = uploads.pluck('id')
11
+ unit_keys = repo_service.unit_keys(uploads)
10
12
  generate_metadata = options.fetch(:generate_metadata, true)
11
13
  sync_capsule = options.fetch(:sync_capsule, true)
12
- unit_type_id = options.fetch(:unit_type_id, repository.unit_type_id)
14
+ unit_type_id = repo_service.unit_type_id(uploads)
13
15
 
14
16
  sequence do
15
17
  upload_results = concurrence do
@@ -57,12 +59,12 @@ module Actions
57
59
  result[:pulp_tasks].each do |task|
58
60
  details = task ? task.dig(:result, :details, :unit) : nil
59
61
  if details && details.dig('type_id') == 'docker_manifest'
60
- manifest = ::Katello::DockerManifest.find_by_uuid(details.dig(:metadata, :id))
62
+ manifest = ::Katello::DockerManifest.find_by(:pulp_id => details.dig(:metadata, :id))
61
63
  json_result = JSON.parse(::Rabl.render(manifest, '/katello/api/v2/docker_manifests/show'))
62
64
  json_result[:type] = 'docker_manifest'
63
65
  json_results << json_result
64
66
  elsif details && details.dig('type_id') == 'docker_tag'
65
- manifest = ::Katello::DockerTag.find_by_uuid(details.dig(:metadata, :id))
67
+ manifest = ::Katello::DockerTag.find_by(:pulp_id => details.dig(:metadata, :id))
66
68
  json_result = JSON.parse(::Rabl.render(manifest, '/katello/api/v2/docker_tags/show'))
67
69
  json_result[:type] = 'docker_tag'
68
70
  json_results << json_result
@@ -0,0 +1,16 @@
1
+ module Actions
2
+ module Katello
3
+ module Repository
4
+ class PurgeEmptyContent < Pulp::AbstractAsyncTask
5
+ input_format do
6
+ param :id, Integer
7
+ end
8
+
9
+ def invoke_external_task
10
+ repo = ::Katello::Repository.find(input[:id])
11
+ repo.backend_service(SmartProxy.pulp_master).purge_empty_contents
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -28,12 +28,12 @@ module Actions
28
28
  Pulp::Repository::RemoveDeb
29
29
  end
30
30
 
31
- uuids = content_units.map(&:uuid)
31
+ pulp_ids = content_units.map(&:pulp_id)
32
32
  repository.remove_content(content_units)
33
33
 
34
34
  sequence do
35
35
  plan_action(pulp_action, :pulp_id => repository.pulp_id,
36
- :clauses => {:association => {'unit_id' => {'$in' => uuids}}
36
+ :clauses => {:association => {'unit_id' => {'$in' => pulp_ids}}
37
37
  })
38
38
  plan_self
39
39
  plan_action(CapsuleSync, repository) if sync_capsule
@@ -50,7 +50,7 @@ module Actions
50
50
  plan_action(Pulp::Repository::Download, :pulp_id => repo.pulp_id, :options => {:verify_all_units => true}) if validate_contents
51
51
  plan_action(Katello::Repository::MetadataGenerate, repo, :force => true) if skip_metadata_check
52
52
  plan_action(Katello::Repository::ErrataMail, repo, nil, contents_changed)
53
- plan_action(Pulp::Repository::RegenerateApplicability, :pulp_id => repo.pulp_id, :contents_changed => contents_changed) if generate_applicability
53
+ plan_action(Pulp::Repository::RegenerateApplicability, :repository_id => repo.id, :contents_changed => contents_changed) if generate_applicability
54
54
  end
55
55
  plan_self(:id => repo.id, :sync_result => output, :skip_metadata_check => skip_metadata_check, :validate_contents => validate_contents,
56
56
  :contents_changed => contents_changed)
@@ -0,0 +1,36 @@
1
+ module Actions
2
+ module Pulp
3
+ module ContentViewPuppetEnvironment
4
+ class CopyContents < Pulp::AbstractAsyncTask
5
+ def plan(target_env, options = {})
6
+ unless options[:source_repository_id] || options[:source_content_view_puppet_environment_id]
7
+ fail 'Must provide source_repository_id or source_content_view_puppet_environment_id'
8
+ end
9
+
10
+ to_plan = {
11
+ target_content_view_puppet_environment_id: target_env.id,
12
+ source_content_view_puppet_environment_id: options[:source_content_view_puppet_environment_id],
13
+ source_repository_id: options[:source_repository_id]
14
+ }
15
+
16
+ to_plan[:puppet_module_ids] = options[:puppet_modules].pluck(:id) if options[:puppet_modules]
17
+ plan_self(to_plan)
18
+ end
19
+
20
+ def invoke_external_task
21
+ if input[:source_repository_id]
22
+ source_repository = ::Katello::Repository.find(input[:source_repository_id])
23
+ else
24
+ env = ::Katello::ContentViewPuppetEnvironment.find(input[:source_content_view_puppet_environment_id])
25
+ source_repository = env.nonpersisted_repository
26
+ end
27
+
28
+ target_env = ::Katello::ContentViewPuppetEnvironment.find(input[:target_content_view_puppet_environment_id])
29
+
30
+ puppet_modules = input[:puppet_module_ids] ? ::Katello::PuppetModule.where(:id => input[:puppet_module_ids]) : nil
31
+ source_repository.backend_service(SmartProxy.pulp_master).copy_contents(target_env.nonpersisted_repository, puppet_modules: puppet_modules)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,27 @@
1
+ module Actions
2
+ module Pulp
3
+ module Repository
4
+ class CopyAllUnits < Pulp::AbstractAsyncTask
5
+ def plan(source_repo, target_repo, options = {})
6
+ filter_ids = options.fetch(:filters, nil)&.map(&:id)
7
+ rpm_filenames = options.fetch(:rpm_filenames, nil)
8
+
9
+ plan_self(source_repo_id: source_repo.id,
10
+ target_repo_id: target_repo.id,
11
+ filter_ids: filter_ids,
12
+ rpm_filenames: rpm_filenames)
13
+ end
14
+
15
+ def invoke_external_task
16
+ source_repo = ::Katello::Repository.find(input[:source_repo_id])
17
+ target_repo = ::Katello::Repository.find(input[:target_repo_id])
18
+ filters = ::Katello::ContentViewFilter.where(:id => input[:filter_ids])
19
+
20
+ source_repo.backend_service(SmartProxy.pulp_master).copy_contents(target_repo,
21
+ filters: filters,
22
+ rpm_filenames: input[:rpm_filenames])
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,29 @@
1
+ module Actions
2
+ module Pulp
3
+ module Repository
4
+ class CopyUnits < Pulp::AbstractAsyncTask
5
+ def plan(source_repo, target_repo, units, options = {})
6
+ if units.any?
7
+ plan_self(source_repo_id: source_repo.id,
8
+ target_repo_id: target_repo.id,
9
+ class_name: units.first.class.name,
10
+ unit_ids: units.pluck(:id),
11
+ recursive: options[:recursive],
12
+ resolve_dependencies: options[:resolve_dependencies])
13
+ end
14
+ end
15
+
16
+ def invoke_external_task
17
+ source_repo = ::Katello::Repository.find(input[:source_repo_id])
18
+ target_repo = ::Katello::Repository.find(input[:target_repo_id])
19
+
20
+ units = input[:class_name].constantize.where(:id => input[:unit_ids])
21
+
22
+ source_repo.backend_service(SmartProxy.pulp_master).copy_units(target_repo, units,
23
+ recursive: input[:recursive],
24
+ resolve_dependencies: input[:resolve_dependencies])
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end