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
@@ -1,7 +1,7 @@
1
1
  module Actions
2
2
  module Pulp
3
3
  module Repository
4
- class Refresh < Pulp::AbstractAsyncTask
4
+ class Refresh < Pulp::Abstract
5
5
  input_format do
6
6
  param :capsule_id
7
7
  param :pulp_id
@@ -12,13 +12,9 @@ module Actions
12
12
  plan_self(:capsule_id => options[:capsule_id], :pulp_id => repository.pulp_id)
13
13
  end
14
14
 
15
- def invoke_external_task
15
+ def run
16
16
  repo = ::Katello::Repository.find_by(:pulp_id => input[:pulp_id])
17
- if repo.nil?
18
- repo = ::Katello::ContentViewPuppetEnvironment.find_by(:pulp_id => input[:pulp_id])
19
- repo = repo.nonpersisted_repository
20
- end
21
- repo.backend_service(smart_proxy(input[:capsule_id])).refresh
17
+ output[:results] = repo.backend_service(smart_proxy(input[:capsule_id])).refresh
22
18
  end
23
19
  end
24
20
  end
@@ -5,12 +5,15 @@ module Actions
5
5
  middleware.use Actions::Middleware::ExecuteIfContentsChanged
6
6
 
7
7
  input_format do
8
- param :pulp_id
8
+ param :repository_id
9
+ param :capsule_id
9
10
  param :contents_changed
10
11
  end
11
12
 
12
13
  def invoke_external_task
13
- pulp_extensions.repository.regenerate_applicability_by_ids([input[:pulp_id]], true)
14
+ capsule_id = input[:capsule_id] || SmartProxy.default_capsule!.id
15
+ repo = ::Katello::Repository.find(input[:repository_id])
16
+ repo.backend_service(smart_proxy(capsule_id)).regenerate_applicability
14
17
  end
15
18
  end
16
19
  end
@@ -7,7 +7,7 @@ module Katello
7
7
  def kickstart_attributes
8
8
  super
9
9
 
10
- medium_provider = Katello::ManagedContentMediumProvider.new(host)
10
+ medium_provider = Katello::ManagedContentMediumProvider.new(host.content_facet)
11
11
  content_view = host.try(:content_facet).try(:content_view) || host.try(:content_view)
12
12
 
13
13
  if content_view && host.operatingsystem.is_a?(Redhat) &&
@@ -39,7 +39,7 @@ module Katello
39
39
 
40
40
  def process_response(resp)
41
41
  logger.debug "Processing response: #{resp.code}"
42
- logger.debug resp.body
42
+ logger.debug filter_sensitive_data(resp.body)
43
43
  return resp unless resp.code.to_i >= 400
44
44
  parsed = {}
45
45
  message = "Rest exception while processing the call"
@@ -61,6 +61,10 @@ module Katello
61
61
  fail RestClientException, {:message => message, :service_code => service_code, :code => status_code}, caller
62
62
  end
63
63
 
64
+ def filter_sensitive_data(payload)
65
+ payload.gsub(/-----BEGIN RSA PRIVATE KEY-----.*-----END RSA PRIVATE KEY-----/, '[filtered]')
66
+ end
67
+
64
68
  def print_debug_info(_a_path, headers = {}, payload = {})
65
69
  logger.debug "Headers: #{headers.to_json}"
66
70
  # calling to_json on file has side-effects breaking manifest import.
@@ -35,6 +35,15 @@ module Katello
35
35
  consumers
36
36
  end
37
37
 
38
+ # workaround for https://bugzilla.redhat.com/1647724
39
+ def get_all_with_facts(uuids)
40
+ consumers = []
41
+ uuids.each do |uuid|
42
+ consumers << get(uuid)
43
+ end
44
+ consumers
45
+ end
46
+
38
47
  def create(env_id, parameters, activation_key_cp_ids)
39
48
  parameters['installedProducts'] ||= [] #if installed products is nil, candlepin won't attach custom products
40
49
  url = "/candlepin/environments/#{url_encode(env_id)}/consumers/"
@@ -12,9 +12,8 @@ module Katello
12
12
  JSON.parse(content_json).with_indifferent_access
13
13
  end
14
14
 
15
- def all(owner_label, include_only: nil)
16
- includes = include_only ? "?#{included_list(include_only)}" : ""
17
- content_json = Candlepin::CandlepinResource.get(path(owner_label) + includes, self.default_headers).body
15
+ def all(owner_label)
16
+ content_json = Candlepin::CandlepinResource.get(path(owner_label), self.default_headers).body
18
17
  JSON.parse(content_json)
19
18
  end
20
19
 
@@ -60,8 +60,7 @@ module Katello
60
60
  return resolved if to_resolve.empty?
61
61
 
62
62
  futures = to_resolve.map do |path_with_substitution|
63
- future_namespace = defined?(Concurrent::Promises) ? Concurrent::Promises : Concurrent
64
- future_namespace.future do
63
+ Concurrent::Promises.future do
65
64
  path_with_substitution.resolve_substitutions(@resource)
66
65
  end
67
66
  end
@@ -1,6 +1,8 @@
1
1
  module Katello
2
2
  module Util
3
3
  class PathWithSubstitutions
4
+ ARCHITECTURES = ["x86_64", "s390x", "ppc64le", "aarch64", "multiarch", "ppc64"].freeze
5
+
4
6
  include Comparable
5
7
 
6
8
  attr_accessor :substitutions
@@ -12,12 +14,27 @@ module Katello
12
14
  @substitutions = substitutions
13
15
  @path = path
14
16
  @resolved = []
17
+ check_for_subs_in_path if no_base_arch_passed?
18
+ end
19
+
20
+ def no_base_arch_passed?
21
+ @substitutions.keys.exclude?("basearch") && substitutions_needed.exclude?("basearch")
22
+ end
23
+
24
+ def split_path
25
+ @split ||= @path.split('/').map(&:downcase).reject(&:blank?)
26
+ end
27
+
28
+ def check_for_subs_in_path
29
+ arches = split_path & ARCHITECTURES
30
+ arch = arches.first
31
+ @substitutions["basearch"] = arch if arch
15
32
  end
16
33
 
17
34
  def substitutions_needed
18
35
  # e.g. if content_url = "/content/dist/rhel/server/7/$releasever/$basearch/kickstart"
19
36
  # return ['releasever', 'basearch']
20
- path.split('/').map { |word| word.start_with?('$') ? word[1..-1] : nil }.compact
37
+ split_path.map { |word| word.start_with?('$') ? word[1..-1] : nil }.compact
21
38
  end
22
39
 
23
40
  def substitutable?
@@ -9,14 +9,14 @@ module Katello
9
9
  !PuppetModule.exists?(name: record.name, author: record.author)
10
10
  record.errors[:base] << _("Puppet Module with name='%{name}' and author='%{author}' does\
11
11
  not exist") % { name: record.name, author: record.author }
12
- elsif record.uuid && !PuppetModule.exists?(uuid: record.uuid)
12
+ elsif record.uuid && !PuppetModule.exists?(pulp_id: record.uuid)
13
13
  record.errors[:base] << _("Puppet Module with uuid='%{uuid}' does not\
14
14
  exist") % { uuid: record.uuid }
15
15
  else
16
16
  puppet_modules = if record.uuid.blank?
17
17
  PuppetModule.where(name: record.name, author: record.author)
18
18
  else
19
- PuppetModule.where(uuid: record.uuid)
19
+ PuppetModule.where(pulp_id: record.uuid)
20
20
  end
21
21
  repositories = puppet_modules.flat_map(&:repositories)
22
22
 
@@ -20,19 +20,21 @@ module Katello
20
20
 
21
21
  def self.validate_repositories(registry_name_pattern, repositories)
22
22
  error_messages = []
23
- names = []
23
+ name_to_repos = {}
24
24
  repositories.each do |repository|
25
25
  name = Katello::Repository.safe_render_container_name(repository, registry_name_pattern)
26
-
27
26
  unless ContainerImageNameValidator.validate_name(name)
28
27
  error_messages << N_("Registry name pattern results in invalid container image name of member repository '%{name}'") % {name: repository.name}
29
28
  return error_messages
30
29
  end
31
- names << name
30
+ name_to_repos[name] ||= []
31
+ name_to_repos[name] << repository
32
32
  end
33
33
 
34
- if names.length != names.uniq.length
35
- error_messages << N_("Registry name pattern results in duplicate container image names")
34
+ duplicate_repos = name_to_repos.select { |_name, repos| repos.count > 1 }.values.flatten
35
+ if duplicate_repos.any?
36
+ repo_names = duplicate_repos.map(&:name).sort.join(', ')
37
+ error_messages << N_("Registry name pattern results in duplicate container image names for these repositories: %s.") % repo_names
36
38
  return error_messages
37
39
  end
38
40
 
@@ -88,19 +88,14 @@ module Katello
88
88
  end
89
89
 
90
90
  def equivalent_kickstart_repository
91
- return unless operatingsystem &&
92
- kickstart_repository &&
93
- operatingsystem.respond_to?(:kickstart_repos)
91
+ return unless operatingsystem && kickstart_repository
94
92
  ks_repos = operatingsystem.kickstart_repos(self)
95
93
  ks_repos.find { |repo| repo[:name] == kickstart_repository.label }
96
94
  end
97
95
 
98
96
  def matching_kickstart_repository?
99
97
  return true unless operatingsystem
100
-
101
- if operatingsystem.respond_to? :kickstart_repos
102
- return operatingsystem.kickstart_repos(self).any? { |repo| repo[:id] == kickstart_repository_id }
103
- end
98
+ operatingsystem.kickstart_repos(self).any? { |repo| repo[:id] == kickstart_repository_id }
104
99
  end
105
100
 
106
101
  private
@@ -68,7 +68,7 @@ module Katello
68
68
  end
69
69
 
70
70
  def active_pools_count
71
- self.pools.count { |p| p[:activeSubscription] == true }
71
+ self.pools.where.not(:unmapped_guest => true).count
72
72
  end
73
73
 
74
74
  def anonymous_provider
@@ -203,6 +203,16 @@ module Katello
203
203
  users.pluck(:id)
204
204
  end
205
205
 
206
+ def audit_manifest_action(message)
207
+ self.manifest_refreshed_at = Time.now
208
+ self.audit_comment = message
209
+ # we skip validating here because the complex taxonomy relationships can cause a lot of unexpected issues.
210
+ # This should be a simple transaction that happens on an important action in the user's workflow.
211
+ # It would be hard to create any new invalid relationships at this step, so the validation
212
+ # doesn't provide much benefit for the frustration it creates.
213
+ self.save(validate: false)
214
+ end
215
+
206
216
  class Jail < ::Safemode::Jail
207
217
  allow :name, :label
208
218
  end
@@ -9,7 +9,7 @@ module Katello
9
9
  # Class#update_from_json
10
10
 
11
11
  def backend_data
12
- self.class.pulp_data(uuid) || {}
12
+ self.class.pulp_data(pulp_id) || {}
13
13
  end
14
14
 
15
15
  module ClassMethods
@@ -33,26 +33,30 @@ module Katello
33
33
  ids = [ids] unless ids.is_a?(Array)
34
34
  ids.map!(&:to_s)
35
35
  id_integers = ids.map { |string| Integer(string) rescue -1 }
36
- where("#{self.table_name}.id in (?) or #{self.table_name}.uuid in (?)", id_integers, ids)
36
+ where("#{self.table_name}.id in (?) or #{self.table_name}.pulp_id in (?)", id_integers, ids)
37
37
  end
38
38
 
39
39
  def in_repositories(repos)
40
- where(:id => repository_association_class.where(:repository_id => repos).select(unit_id_field))
40
+ if manage_repository_association
41
+ where(:id => repository_association_class.where(:repository_id => repos).select(unit_id_field))
42
+ else
43
+ where(:repository_id => repos)
44
+ end
41
45
  end
42
46
 
43
- def pulp_data(uuid)
44
- content_unit_class.new(uuid)
47
+ def pulp_data(pulp_id)
48
+ content_unit_class.new(pulp_id)
45
49
  end
46
50
 
47
51
  # Import all units of a single type and refresh their repository associations
48
- def import_all(uuids = nil, options = {})
52
+ def import_all(pulp_ids = nil, options = {})
49
53
  index_repository_association = options.fetch(:index_repository_association, true) && self.manage_repository_association
50
54
 
51
55
  process_block = lambda do |units|
52
56
  units.each do |unit|
53
57
  unit = unit.with_indifferent_access
54
58
  item = Katello::Util::Support.active_record_retry do
55
- self.where(:uuid => unit['_id']).first_or_create
59
+ self.where(:pulp_id => unit['_id']).first_or_create
56
60
  end
57
61
  item.update_from_json(unit)
58
62
  end
@@ -63,8 +67,8 @@ module Katello
63
67
  end
64
68
  end
65
69
 
66
- if uuids
67
- results = content_unit_class.fetch_by_uuids(uuids, &process_block).flatten
70
+ if pulp_ids
71
+ results = content_unit_class.fetch_by_uuids(pulp_ids, &process_block).flatten
68
72
  update_repository_associations(results, true) if index_repository_association
69
73
  else
70
74
  results = content_unit_class.fetch_all(&process_block).flatten
@@ -78,12 +82,12 @@ module Katello
78
82
  # in our database. Errata and Package Groups can change in Pulp, so we index
79
83
  # all of them in the repository on each sync.
80
84
  if immutable_unit_types.include?(self) && !force
81
- ids_to_import = ids - repository.rpms.map(&:uuid)
85
+ ids_to_import = ids - repository.rpms.map(&:pulp_id)
82
86
  else
83
87
  ids_to_import = ids
84
88
  end
85
89
  self.import_all(ids_to_import, :index_repository_association => false) if repository.content_view.default? || force
86
- self.sync_repository_associations(repository, :uuids => ids) if self.manage_repository_association
90
+ self.sync_repository_associations(repository, :pulp_ids => ids) if self.manage_repository_association
87
91
  end
88
92
 
89
93
  def unit_id_field
@@ -91,23 +95,35 @@ module Katello
91
95
  end
92
96
 
93
97
  def copy_repository_associations(source_repo, dest_repo)
94
- delete_query = "delete from #{repository_association_class.table_name} where repository_id = #{dest_repo.id} and
95
- #{unit_id_field} not in (select #{unit_id_field} from #{repository_association_class.table_name} where repository_id = #{source_repo.id})"
96
- ActiveRecord::Base.connection.execute(delete_query)
98
+ if manage_repository_association
99
+ delete_query = "delete from #{repository_association_class.table_name} where repository_id = #{dest_repo.id} and
100
+ #{unit_id_field} not in (select #{unit_id_field} from #{repository_association_class.table_name} where repository_id = #{source_repo.id})"
101
+
102
+ insert_query = "insert into #{repository_association_class.table_name} (repository_id, #{unit_id_field})
103
+ select #{dest_repo.id} as repository_id, #{unit_id_field} from #{repository_association_class.table_name}
104
+ where repository_id = #{source_repo.id} and #{unit_id_field} not in (select #{unit_id_field}
105
+ from #{repository_association_class.table_name} where repository_id = #{dest_repo.id})"
106
+ else
107
+ columns = column_names - ["id", "pulp_id", "created_at", "updated_at", "repository_id"]
97
108
 
98
- insert_query = "insert into #{repository_association_class.table_name} (repository_id, #{unit_id_field})
99
- select #{dest_repo.id} as repository_id, #{unit_id_field} from #{repository_association_class.table_name}
100
- where repository_id = #{source_repo.id} and #{unit_id_field} not in (select #{unit_id_field}
101
- from #{repository_association_class.table_name} where repository_id = #{dest_repo.id})"
109
+ delete_query = "delete from #{self.table_name} where repository_id = #{dest_repo.id} and
110
+ pulp_id not in (select pulp_id from #{self.table_name} where repository_id = #{source_repo.id})"
111
+ insert_query = "insert into #{self.table_name} (repository_id, pulp_id, #{columns.join(',')})
112
+ select #{dest_repo.id} as repository_id, pulp_id, #{columns.join(',')} from #{self.table_name}
113
+ where repository_id = #{source_repo.id} and pulp_id not in (select pulp_id
114
+ from #{self.table_name} where repository_id = #{dest_repo.id})"
115
+
116
+ end
117
+ ActiveRecord::Base.connection.execute(delete_query)
102
118
  ActiveRecord::Base.connection.execute(insert_query)
103
119
  end
104
120
 
105
121
  def sync_repository_associations(repository, options = {})
106
122
  additive = options.fetch(:additive, false)
107
123
  associated_ids = options.fetch(:ids, nil)
108
- uuids = options.fetch(:uuids) if associated_ids.nil?
124
+ pulp_ids = options.fetch(:pulp_ids) if associated_ids.nil?
109
125
 
110
- associated_ids = with_uuid(uuids).pluck(:id) if uuids
126
+ associated_ids = with_pulp_id(pulp_ids).pluck(:id) if pulp_ids
111
127
 
112
128
  table_name = self.repository_association_class.table_name
113
129
  attribute_name = unit_id_field
@@ -136,8 +152,8 @@ module Katello
136
152
  end
137
153
  end
138
154
 
139
- def with_uuid(unit_uuids)
140
- where(:uuid => unit_uuids)
155
+ def with_pulp_id(unit_pulp_ids)
156
+ where(:pulp_id => unit_pulp_ids)
141
157
  end
142
158
 
143
159
  def update_repository_associations(units_json, additive = false)
@@ -153,8 +169,8 @@ module Katello
153
169
  end
154
170
  end
155
171
 
156
- repo_unit_id.each do |repo_pulp_id, unit_uuids|
157
- sync_repository_associations(Repository.find_by(:pulp_id => repo_pulp_id), :uuids => unit_uuids, :additive => additive)
172
+ repo_unit_id.each do |repo_pulp_id, unit_pulp_ids|
173
+ sync_repository_associations(Repository.find_by(:pulp_id => repo_pulp_id), :pulp_ids => unit_pulp_ids, :additive => additive)
158
174
  end
159
175
  end
160
176
  end
@@ -41,7 +41,11 @@ module Katello
41
41
  end
42
42
 
43
43
  def kickstart_repos(host)
44
- distros = distribution_repositories(host).where(distribution_bootable: true)
44
+ distribution_repos = distribution_repositories(host)
45
+
46
+ return [] if distribution_repos.empty?
47
+
48
+ distros = distribution_repos.where(distribution_bootable: true)
45
49
  if distros && host.content_source
46
50
  distros.map { |distro| distro.to_hash(host.content_source) }
47
51
  else
@@ -51,7 +55,7 @@ module Katello
51
55
 
52
56
  def variant_repo(host, variant)
53
57
  if variant && host.content_source
54
- product_id = host.try(:content_facet).try(:kickstart_repository).try(:product_id) || host.try(:kickstart_repository).try(:product_id)
58
+ product_id = host&.content_facet&.kickstart_repository&.product_id
55
59
  distro = distribution_repositories(host)
56
60
  .joins(:product)
57
61
  .where(
@@ -71,7 +75,7 @@ module Katello
71
75
  where(:distribution_version => host.os.release,
72
76
  :distribution_arch => host.architecture.name)
73
77
  else
74
- Katello::Repository.none
78
+ []
75
79
  end
76
80
  end
77
81
  end
@@ -519,25 +519,22 @@ module Katello
519
519
  build_puppet_env(options).save!
520
520
  end
521
521
 
522
- def computed_module_ids_by_repoid
523
- uuids = []
522
+ def computed_modules_by_repoid
524
523
  names_and_authors = []
525
524
  puppet_modules = []
526
525
 
527
526
  if composite?
528
- uuids = component_modules_to_publish.collect { |puppet_module| puppet_module.uuid }
527
+ puppet_modules = component_modules_to_publish
529
528
  else
530
529
  puppet_modules_to_publish.each do |cvpm|
531
530
  if cvpm.uuid
532
- uuids << cvpm.uuid
531
+ puppet_modules << cvpm.puppet_module
533
532
  else
534
533
  names_and_authors << { :name => cvpm.name, :author => cvpm.author }
535
534
  end
536
535
  end
537
536
  end
538
537
 
539
- puppet_modules = PuppetModule.where(:uuid => uuids).to_a if uuids.present?
540
-
541
538
  if names_and_authors.present?
542
539
  names_and_authors.each do |name_and_author|
543
540
  puppet_module = ::Katello::PuppetModule.latest_module(
@@ -571,7 +568,8 @@ module Katello
571
568
 
572
569
  error_messages = ::Katello::Validators::EnvironmentDockerRepositoriesValidator.validate_repositories(environment.registry_name_pattern, repositories)
573
570
  unless error_messages.empty?
574
- fail _("Content View publish to environment %{name} will result in invalid container image name of member repositories") % {name: environment.name}
571
+ error_messages << _("Consider changing the Lifecycle Environment's Registry Name Pattern to something more specific.")
572
+ fail error_messages.join(" ")
575
573
  end
576
574
  end
577
575
  true