katello 4.3.0.rc3 → 4.3.1

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 (135) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +1 -1
  3. data/app/controllers/katello/api/v2/repositories_controller.rb +24 -8
  4. data/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +1 -9
  5. data/app/controllers/katello/remote_execution_controller.rb +5 -4
  6. data/app/graphql/types/host_collection.rb +18 -0
  7. data/app/lib/actions/katello/capsule_content/refresh_repos.rb +1 -1
  8. data/app/lib/actions/katello/content_view/publish.rb +5 -0
  9. data/app/lib/actions/katello/content_view_version/incremental_update.rb +17 -3
  10. data/app/lib/actions/pulp3/abstract_async_task.rb +1 -1
  11. data/app/lib/actions/pulp3/capsule_content/generate_metadata.rb +5 -4
  12. data/app/lib/actions/pulp3/content_view_version/import.rb +7 -0
  13. data/app/lib/actions/pulp3/orchestration/content_view_version/import.rb +7 -5
  14. data/app/lib/actions/pulp3/repository/copy_content.rb +1 -1
  15. data/app/lib/actions/pulp3/repository/save_artifact.rb +1 -0
  16. data/app/lib/katello/resources/cdn.rb +1 -1
  17. data/app/lib/katello/resources/registry.rb +1 -1
  18. data/app/models/katello/candlepin/repository_mapper.rb +1 -1
  19. data/app/models/katello/concerns/host_managed_extensions.rb +1 -1
  20. data/app/models/katello/concerns/pulp_database_unit.rb +1 -1
  21. data/app/models/katello/concerns/smart_proxy_extensions.rb +15 -7
  22. data/app/models/katello/docker_meta_tag.rb +1 -1
  23. data/app/models/katello/glue/provider.rb +1 -1
  24. data/app/models/katello/glue/pulp/repos.rb +2 -0
  25. data/app/models/katello/repository.rb +8 -3
  26. data/app/models/katello/root_repository.rb +27 -1
  27. data/app/services/cert/rhsm_client.rb +1 -5
  28. data/app/services/katello/component_view_presenter.rb +1 -1
  29. data/app/services/katello/organization_creator.rb +11 -4
  30. data/app/services/katello/pulp3/content_view_version/import.rb +11 -2
  31. data/app/services/katello/pulp3/content_view_version/metadata_generator.rb +1 -1
  32. data/app/services/katello/pulp3/erratum.rb +9 -1
  33. data/app/services/katello/pulp3/generic_content_unit.rb +2 -1
  34. data/app/services/katello/pulp3/pulp_content_unit.rb +5 -7
  35. data/app/services/katello/pulp3/repository/yum.rb +12 -2
  36. data/app/services/katello/pulp3/repository.rb +13 -10
  37. data/app/services/katello/pulp3/repository_mirror.rb +2 -1
  38. data/app/services/katello/registration_manager.rb +1 -1
  39. data/app/views/foreman/job_templates/change_content_source.erb +42 -0
  40. data/app/views/foreman/job_templates/install_errata.erb +6 -9
  41. data/app/views/foreman/job_templates/install_errata_by_search_query.erb +26 -0
  42. data/app/views/katello/api/v2/repositories/base.json.rabl +1 -0
  43. data/app/views/katello/api/v2/repositories/show.json.rabl +1 -1
  44. data/db/migrate/20210331180353_katello_pool_organization_id_not_nullable.rb +2 -0
  45. data/db/migrate/20211019192121_create_cdn_configuration.katello.rb +11 -2
  46. data/db/migrate/20211202172358_add_repository_mirroring_policy.rb +26 -0
  47. data/db/seeds.d/111-upgrade_tasks.rb +2 -1
  48. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/packages.controller.js +1 -0
  49. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +5 -2
  50. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-manage-content.controller.js +2 -3
  51. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +19 -9
  52. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/mirroring-policy.service.js +30 -0
  53. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +9 -5
  54. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +13 -8
  55. data/lib/katello/plugin.rb +4 -0
  56. data/lib/katello/repository_types/ostree.rb +2 -0
  57. data/lib/katello/tasks/content_view_import_only.rake +34 -0
  58. data/lib/katello/tasks/upgrades/4.4/publish_import_cvvs.rake +17 -0
  59. data/lib/katello/version.rb +1 -1
  60. data/webpack/components/Content/Details/ContentDetails.js +1 -1
  61. data/webpack/components/Content/Details/__tests__/__snapshots__/ContentDetails.test.js.snap +1 -1
  62. data/webpack/components/Errata/index.js +58 -0
  63. data/webpack/components/RoutedTabs/index.js +2 -1
  64. data/webpack/components/Table/TableWrapper.js +8 -4
  65. data/webpack/components/WithOrganization/withOrganization.js +1 -0
  66. data/webpack/components/extensions/HostDetails/Cards/ErrataOverviewCard.js +109 -0
  67. data/webpack/components/extensions/HostDetails/Cards/__tests__/errataOverviewCard.test.js +56 -0
  68. data/webpack/components/extensions/HostDetails/Tabs/ContentTab/index.js +1 -0
  69. data/webpack/components/extensions/HostDetails/Tabs/ErrataTab.js +57 -55
  70. data/webpack/components/extensions/HostDetails/Tabs/ErrataTab.scss +2 -7
  71. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab.js +38 -38
  72. data/webpack/components/extensions/HostDetails/Tabs/PackagesTab.scss +3 -7
  73. data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionActions.js +2 -2
  74. data/webpack/components/extensions/HostDetails/Tabs/RemoteExecutionConstants.js +1 -1
  75. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.js +39 -39
  76. data/webpack/components/extensions/HostDetails/Tabs/RepositorySetsTab/RepositorySetsTab.scss +3 -3
  77. data/webpack/components/extensions/HostDetails/Tabs/TracesTab.js +58 -56
  78. data/webpack/components/extensions/HostDetails/Tabs/TracesTab.scss +4 -5
  79. data/webpack/components/extensions/HostDetails/Tabs/__tests__/errataTab.test.js +5 -5
  80. data/webpack/components/extensions/HostDetails/Tabs/customizedRexUrlHelpers.js +1 -1
  81. data/webpack/containers/Application/config.js +1 -1
  82. data/webpack/containers/Application/overrides.scss +56 -7
  83. data/webpack/global_index.js +3 -0
  84. data/webpack/scenes/Content/ContentConfig.js +55 -5
  85. data/webpack/scenes/Content/ContentPage.js +5 -5
  86. data/webpack/scenes/Content/Details/ContentDetails.js +23 -21
  87. data/webpack/scenes/Content/Details/ContentInfo.js +2 -2
  88. data/webpack/scenes/Content/Details/ContentRepositories.js +1 -1
  89. data/webpack/scenes/Content/Table/ContentTable.js +1 -1
  90. data/webpack/scenes/ContentViews/ContentViewsConstants.js +5 -4
  91. data/webpack/scenes/ContentViews/ContentViewsPage.js +17 -13
  92. data/webpack/scenes/ContentViews/Copy/CopyContentViewForm.js +8 -12
  93. data/webpack/scenes/ContentViews/Copy/CopyContentViewModal.js +1 -1
  94. data/webpack/scenes/ContentViews/Copy/__tests__/copyContentView.test.js +1 -1
  95. data/webpack/scenes/ContentViews/Create/CreateContentViewForm.js +1 -1
  96. data/webpack/scenes/ContentViews/Delete/Steps/CVDeletionFinish.js +10 -4
  97. data/webpack/scenes/ContentViews/Delete/__tests__/contentViewDelete.test.js +5 -2
  98. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentContentViewAddModal.js +22 -11
  99. data/webpack/scenes/ContentViews/Details/ComponentContentViews/ComponentContentViewBulkAddModal.js +31 -18
  100. data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +11 -10
  101. data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +5 -5
  102. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +118 -51
  103. data/webpack/scenes/ContentViews/Details/ContentViewInfo.js +1 -1
  104. data/webpack/scenes/ContentViews/Details/DetailsContainer.js +5 -3
  105. data/webpack/scenes/ContentViews/Details/Filters/Add/CVFilterAddModal.js +3 -0
  106. data/webpack/scenes/ContentViews/Details/Filters/CVContainerImageFilterContent.js +3 -3
  107. data/webpack/scenes/ContentViews/Details/Filters/CVErrataDateFilterContent.js +5 -5
  108. data/webpack/scenes/ContentViews/Details/Filters/CVErrataIDFilterContent.js +15 -8
  109. data/webpack/scenes/ContentViews/Details/Filters/CVModuleStreamFilterContent.js +3 -3
  110. data/webpack/scenes/ContentViews/Details/Filters/CVPackageGroupFilterContent.js +3 -3
  111. data/webpack/scenes/ContentViews/Details/Filters/CVRpmFilterContent.js +3 -3
  112. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilterDetailsHeader.js +3 -3
  113. data/webpack/scenes/ContentViews/Details/Promote/ContentViewVersionPromote.js +17 -4
  114. data/webpack/scenes/ContentViews/Details/Repositories/ContentCounts.js +1 -1
  115. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersionContent.js +16 -17
  116. data/webpack/scenes/ContentViews/Details/Versions/ContentViewVersions.js +26 -4
  117. data/webpack/scenes/ContentViews/Details/Versions/Delete/RemoveCVVersionWizard.js +4 -1
  118. data/webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVVersionDeleteFinish.js +14 -3
  119. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailConfig.js +30 -34
  120. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetails.js +12 -10
  121. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetails.scss +5 -2
  122. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionDetailsHeader.js +134 -31
  123. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/ContentViewVersionRepositoryCell.js +1 -1
  124. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetails.test.js +21 -1
  125. data/webpack/scenes/ContentViews/Details/Versions/VersionDetails/__tests__/ContentViewVersionDetailsEmpty.test.js +22 -1
  126. data/webpack/scenes/ContentViews/Details/Versions/__tests__/contentViewVersions.test.js +1 -1
  127. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +1 -1
  128. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +1 -1
  129. data/webpack/scenes/ContentViews/components/CVBreadCrumb.js +1 -1
  130. data/webpack/scenes/ContentViews/components/ContentViewsCounter.js +1 -1
  131. data/webpack/scenes/ContentViews/expansions/RelatedContentViewComponentsModal.js +8 -8
  132. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsActions.test.js.snap +1 -0
  133. data/webpack/scenes/Tasks/TaskActions.js +4 -3
  134. data/webpack/scenes/Tasks/__tests__/__snapshots__/TaskActions.test.js.snap +1 -0
  135. metadata +19 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa69b2700d8537140c39e127e5e94f121aeead00124eeddd6c2e7fa94e9fed32
4
- data.tar.gz: 67ff63f7def7af9ed99bf7e73d14aa6e82cb41bd65ca73d4ec0fdd8867b2285d
3
+ metadata.gz: f1a33ac3431921424a7d17bcd6f90afbb0f0ed372e6c7873ea1b2afa35cde5d2
4
+ data.tar.gz: 864c45929eea0df21199da1bafc4598f504887578c8c7fa860e3d03729fcf0aa
5
5
  SHA512:
6
- metadata.gz: 7b8d403df79ab4e58b40d3bb675c9908f5bae448d03e410c0fb256eaa974a043c80f8bcc371ceb9e2827311cd138f8bf209f255c3a3c295f6294af6b0799b69f
7
- data.tar.gz: 469abe1ecd5ae6ce1117c9978fa3d9a1bf3dd2ad8e775de21bc6c61ba4d394e338ccec4b12e1d6226293189dfc2965f68c4377a6a5911130f1d723da14524516
6
+ metadata.gz: 938cb19362f4c5add3bd334c4889a95462a2c3f071a2d3764a43c59bfeac6bef1bb036f99b0d168dbf10953664e7fc5f8623f6b4a0a09021be7e9f1931b8be64
7
+ data.tar.gz: bb12015598a2ac15cfbd0aad5f9a18d7c86142c8157e73cf134a22b93470d0da64c977c59fb74fb2819ad5e2c15b8f77f0b1283d0b9a674205bd1e0f6ac9dc89
@@ -76,7 +76,7 @@ module Katello
76
76
 
77
77
  api :PUT, "/content_view_versions/:id/republish_repositories", N_("Forces a republish of the version's repositories' metadata")
78
78
  param :id, :number, :desc => N_("Content view version identifier"), :required => true
79
- param :force, :bool, :desc => N_("Force metadata regeneration to proceed. Dangerous when repositories use mirror on sync."), :required => true
79
+ param :force, :bool, :desc => N_("Force metadata regeneration to proceed. Dangerous when repositories use the 'Complete Mirroring' mirroring policy"), :required => true
80
80
  def republish_repositories
81
81
  unless ::Foreman::Cast.to_bool(params[:force])
82
82
  fail HttpErrors::BadRequest, _("Metadata republishing must be forced because it is a dangerous operation.")
@@ -7,7 +7,7 @@ module Katello
7
7
  generic_repo_wrap_params << option.name
8
8
  end
9
9
 
10
- repo_wrap_params = RootRepository.attribute_names.concat([:ignore_global_proxy]) + generic_repo_wrap_params
10
+ repo_wrap_params = RootRepository.attribute_names.concat([:ignore_global_proxy, :mirror_on_sync]) + generic_repo_wrap_params
11
11
 
12
12
  wrap_parameters :repository, :include => repo_wrap_params
13
13
 
@@ -53,7 +53,8 @@ module Katello
53
53
  param :docker_tags_whitelist, Array, :desc => N_("Comma-separated list of tags to sync for Container Image repository")
54
54
  param :download_policy, ["immediate", "on_demand"], :desc => N_("download policy for yum repos (either 'immediate' or 'on_demand')")
55
55
  param :download_concurrency, :number, :desc => N_("Used to determine download concurrency of the repository in pulp3. Use value less than 20. Defaults to 10")
56
- param :mirror_on_sync, :bool, :desc => N_("true if this repository when synced has to be mirrored from the source and stale rpms removed")
56
+ param :mirror_on_sync, :bool, :desc => N_("true if this repository when synced has to be mirrored from the source and stale rpms removed (Deprecated)")
57
+ param :mirroring_policy, Katello::RootRepository::MIRRORING_POLICIES, :desc => N_("Policy to set for mirroring content. Must be one of %s.") % RootRepository::MIRRORING_POLICIES
57
58
  param :verify_ssl_on_sync, :bool, :desc => N_("if true, Katello will verify the upstream url's SSL certifcates are signed by a trusted CA")
58
59
  param :upstream_username, String, :desc => N_("Username of the upstream repository user used for authentication")
59
60
  param :upstream_password, String, :desc => N_("Password of the upstream repository user used for authentication")
@@ -268,7 +269,7 @@ module Katello
268
269
 
269
270
  api :PUT, "/repositories/:id/republish", N_("Forces a republish of the specified repository, regenerating metadata and symlinks on the filesystem.")
270
271
  param :id, :number, :desc => N_("Repository identifier"), :required => true
271
- param :force, :bool, :desc => N_("Force metadata regeneration to proceed. Dangerous when repositories use mirror on sync."), :required => true
272
+ param :force, :bool, :desc => N_("Force metadata regeneration to proceed. Dangerous when repositories use the 'Complete Mirroring' mirroring policy."), :required => true
272
273
  def republish
273
274
  unless ::Foreman::Cast.to_bool(params[:force])
274
275
  fail HttpErrors::BadRequest, _('Metadata republishing must be forced because it is a dangerous operation.')
@@ -501,7 +502,7 @@ module Katello
501
502
 
502
503
  # rubocop:disable Metrics/CyclomaticComplexity
503
504
  def repository_params
504
- keys = [:download_policy, :mirror_on_sync, :arch, :verify_ssl_on_sync, :upstream_password,
505
+ keys = [:download_policy, :mirror_on_sync, :mirroring_policy, :sync_policy, :arch, :verify_ssl_on_sync, :upstream_password,
505
506
  :upstream_username, :download_concurrency, :upstream_authentication_token,
506
507
  {:os_versions => []}, :deb_releases, :deb_components, :deb_architectures, :description,
507
508
  :http_proxy_policy, :http_proxy_id, :retain_package_versions_count, {:ignorable_content => []}
@@ -525,7 +526,8 @@ module Katello
525
526
  keys += [:url, :gpg_key_id, :ssl_ca_cert_id, :ssl_client_cert_id, :ssl_client_key_id, :unprotected, :name,
526
527
  :checksum_type]
527
528
  end
528
- params.require(:repository).permit(*keys).to_h.with_indifferent_access
529
+ to_return = params.require(:repository).permit(*keys).to_h.with_indifferent_access
530
+ handle_mirror_on_sync(to_return)
529
531
  end
530
532
 
531
533
  def get_content_credential(repo_params, content_type)
@@ -545,8 +547,8 @@ module Katello
545
547
  :checksum_type, :download_policy, :http_proxy_policy).to_h.with_indifferent_access)
546
548
  root.docker_upstream_name = repo_params[:docker_upstream_name] if repo_params[:docker_upstream_name]
547
549
  root.docker_tags_whitelist = repo_params.fetch(:docker_tags_whitelist, []) if root.docker?
548
- root.mirror_on_sync = ::Foreman::Cast.to_bool(repo_params[:mirror_on_sync]) if repo_params.key?(:mirror_on_sync)
549
550
  root.verify_ssl_on_sync = ::Foreman::Cast.to_bool(repo_params[:verify_ssl_on_sync]) if repo_params.key?(:verify_ssl_on_sync)
551
+ root.mirroring_policy = repo_params[:mirroring_policy] || Katello::RootRepository::MIRRORING_POLICY_CONTENT
550
552
  root.upstream_username = repo_params[:upstream_username] if repo_params.key?(:upstream_username)
551
553
  root.upstream_password = repo_params[:upstream_password] if repo_params.key?(:upstream_password)
552
554
  root.upstream_authentication_token = repo_params[:upstream_authentication_token] if repo_params.key?(:upstream_authentication_token)
@@ -577,6 +579,19 @@ module Katello
577
579
  end
578
580
  # rubocop:enable Metrics/CyclomaticComplexity
579
581
 
582
+ def handle_mirror_on_sync(repo_params)
583
+ if !repo_params.key?(:mirroring_policy) && repo_params.key?(:mirror_on_sync)
584
+ ::Foreman::Deprecation.api_deprecation_warning("mirror_on_sync is deprecated in favor of mirroring_policy. It will be removed in Katello 4.6.")
585
+ if ::Foreman::Cast.to_bool(repo_params[:mirror_on_sync])
586
+ repo_params[:mirroring_policy] = Katello::RootRepository::MIRRORING_POLICY_CONTENT
587
+ else
588
+ repo_params[:mirroring_policy] = Katello::RootRepository::MIRRORING_POLICY_ADDITIVE
589
+ end
590
+ end
591
+ repo_params.delete(:mirror_on_sync)
592
+ repo_params
593
+ end
594
+
580
595
  def error_on_rh_product
581
596
  fail HttpErrors::BadRequest, _("Red Hat products cannot be manipulated.") if @product.redhat?
582
597
  end
@@ -633,7 +648,8 @@ module Katello
633
648
 
634
649
  def generic_remote_options_hash(repo_params)
635
650
  generic_remote_options = {}
636
- RepositoryTypeManager.generic_remote_options(content_type: repo_params[:content_type]).each do |option|
651
+ content_type = @repository&.content_type || repo_params[:content_type]
652
+ RepositoryTypeManager.generic_remote_options(content_type: content_type).each do |option|
637
653
  generic_remote_options[option.name] = repo_params[option.name]
638
654
  end
639
655
  generic_remote_options
@@ -652,7 +668,7 @@ module Katello
652
668
  def check_import_parameters
653
669
  @repository.repository_type&.import_attributes&.each do |import_attribute|
654
670
  if import_attribute.required && params[import_attribute.api_param].blank?
655
- fail HttpErrors::UnprocessableEntity, _("%s is required", import_attributes.api_param)
671
+ fail HttpErrors::UnprocessableEntity, _('%s is required') % import_attribute.api_param
656
672
  end
657
673
  end
658
674
  end
@@ -28,7 +28,7 @@ module Katello
28
28
  end
29
29
 
30
30
  def context_urls
31
- super.merge(rhsm_url: rhsm_url, pulp_content_url: pulp_content_url)
31
+ super.merge(rhsm_url: smart_proxy.rhsm_url, pulp_content_url: smart_proxy.pulp_content_url)
32
32
  end
33
33
 
34
34
  private
@@ -43,14 +43,6 @@ module Katello
43
43
  proxy
44
44
  end
45
45
  end
46
-
47
- def rhsm_url
48
- URI(smart_proxy.rhsm_url)
49
- end
50
-
51
- def pulp_content_url
52
- smart_proxy.setting(SmartProxy::PULP3_FEATURE, 'content_app_url')
53
- end
54
46
  end
55
47
  end
56
48
  end
@@ -47,11 +47,12 @@ module Katello
47
47
  end
48
48
 
49
49
  def inputs
50
- if feature_name == 'katello_errata_install'
51
- { "Errata Search Query" => "errata_id ^ (#{errata_inputs.join(',')})" }
52
- elsif feature_name == 'katello_service_restart'
50
+ case feature_name
51
+ when 'katello_errata_install'
52
+ { :errata => errata_inputs }
53
+ when 'katello_service_restart'
53
54
  { :helper => params[:name] }
54
- elsif feature_name == 'katello_module_stream_action'
55
+ when 'katello_module_stream_action'
55
56
  fail HttpErrors::NotFound, _('module streams not found') if params[:module_spec].blank?
56
57
  fail HttpErrors::NotFound, _('actions not found') if params[:module_stream_action].blank?
57
58
  inputs = { :module_spec => params[:module_spec], :action => params[:module_stream_action] }
@@ -0,0 +1,18 @@
1
+ module Types
2
+ class HostCollection < BaseObject
3
+ description "A collection of hosts"
4
+ model_class ::Katello::HostCollection
5
+
6
+ global_id_field :id
7
+ timestamps
8
+ field :name, String
9
+ field :description, String
10
+ field :max_hosts, Integer
11
+ field :unlimited_hosts, Boolean
12
+ has_many :hosts, Types::Host
13
+
14
+ def self.graphql_definition
15
+ super.tap { |type| type.instance_variable_set(:@name, 'Katello::HostCollection') }
16
+ end
17
+ end
18
+ end
@@ -40,7 +40,7 @@ module Actions
40
40
  pulp_repo = repo.backend_service(smart_proxy)
41
41
  if !current_repos_on_capsule_ids.include?(repo.id)
42
42
  pulp_repo.create_mirror_entities
43
- elsif pulp_repo.mirror_needs_updates?
43
+ else
44
44
  tasks += pulp_repo.refresh_mirror_entities
45
45
  end
46
46
  end
@@ -200,6 +200,11 @@ module Actions
200
200
  plan_action(Katello::Repository::IndexContent, id: id, full_index: true)
201
201
  end
202
202
  end
203
+ concurrence do
204
+ version.importable_repositories.each do |repo|
205
+ plan_action(::Actions::Katello::Repository::MetadataGenerate, repo)
206
+ end
207
+ end
203
208
  plan_action(::Actions::Pulp3::Orchestration::ContentViewVersion::CopyVersionUnitsToLibrary, version)
204
209
  end
205
210
  end
@@ -72,6 +72,18 @@ module Actions
72
72
 
73
73
  unless extended_repo_mapping.empty? || unit_map.values.flatten.empty?
74
74
  sequence do
75
+ # Pre-copy content if dest_repo is a soft copy of its library instance.
76
+ # Don't use extended_repo_mapping because the source repositories are library instances.
77
+ # We want the old CV snapshot repositories here so as to not pull in excess new content.
78
+ separated_repo_map[:pulp3_yum_multicopy].each do |source_repos, dest_repo|
79
+ if dest_repo.soft_copy_of_library?
80
+ source_repos.each do |source_repo|
81
+ # remove_all flag is set to cover the case of incrementally updating more than once with different content.
82
+ # Without it, content from the previous incremental update will be copied as well due to how Pulp repo versions work.
83
+ plan_action(Pulp3::Repository::CopyContent, source_repo, SmartProxy.pulp_primary, dest_repo, copy_all: true, remove_all: true)
84
+ end
85
+ end
86
+ end
75
87
  copy_action_outputs << plan_action(Pulp3::Repository::MultiCopyUnits, extended_repo_mapping, unit_map,
76
88
  dependency_solving: dep_solve).output
77
89
  repos_to_clone.each do |source_repos|
@@ -125,10 +137,12 @@ module Actions
125
137
  source_library_repo = source_repos.first.library_instance? ? source_repos.first : source_repos.first.library_instance
126
138
 
127
139
  source_repos = [source_library_repo]
128
- if old_version_repo.version_href
129
- base_version = old_version_repo.version_href.split("/")[-1].to_i
130
- else
140
+ if old_version_repo.version_href.nil?
131
141
  base_version = 0
142
+ elsif old_version_repo.soft_copy_of_library?
143
+ base_version = nil
144
+ else
145
+ base_version = old_version_repo.version_href.split("/")[-1].to_i
132
146
  end
133
147
 
134
148
  pulp3_repo_mapping[source_repos.map(&:id)] = { dest_repo: dest_repo.id, base_version: base_version }
@@ -113,7 +113,7 @@ module Actions
113
113
  def overwrite_pulp_error(message)
114
114
  case message
115
115
  when 'This repository uses features which are incompatible with \'mirror\' sync. Please sync without mirroring enabled.'
116
- 'Please disable \'mirror on sync\' because the upstream repository refers to external resources.'
116
+ 'The "Complete Mirroring" mirroring policy is not compatible with this repository. You may want to update it to use "Content Only"'
117
117
  else
118
118
  message
119
119
  end
@@ -17,13 +17,14 @@ module Actions
17
17
 
18
18
  def invoke_external_task
19
19
  repository = ::Katello::Repository.find(input[:repository_id])
20
+ backend = repository.backend_service(smart_proxy).with_mirror_adapter
20
21
  #yum repositories use metadata mirroring always, so we should never
21
- # regenerate metadata on proxies
22
- if repository.yum?
22
+ # regenerate metadata on proxies. but if there is no publication,
23
+ # it means the repo was likely empty and syncing didn't generate one
24
+ if repository.yum? && backend.publication_href.present?
23
25
  []
24
26
  else
25
- smart_proxy = ::SmartProxy.unscoped.find(input[:smart_proxy_id])
26
- repository.backend_service(smart_proxy).with_mirror_adapter.create_publication
27
+ backend.create_publication
27
28
  end
28
29
  end
29
30
  end
@@ -19,6 +19,13 @@ module Actions
19
19
  metadata: input[:metadata]
20
20
  ).create_import(input[:importer_data][:pulp_href])
21
21
  end
22
+
23
+ def rescue_strategy_for_self
24
+ # There are various reasons the importing fails, not all of them are
25
+ # fatal: when fail on import, we continue with the task ending up
26
+ # in the warning state, but not locking further imports
27
+ Dynflow::Action::Rescue::Skip
28
+ end
22
29
  end
23
30
  end
24
31
  end
@@ -15,17 +15,19 @@ module Actions
15
15
  metadata: metadata
16
16
  ).output
17
17
 
18
- import_output = plan_action(
18
+ plan_action(
19
19
  ::Actions::Pulp3::ContentViewVersion::Import,
20
20
  content_view_version_id: content_view_version.id,
21
21
  smart_proxy_id: smart_proxy.id,
22
22
  importer_data: importer_output[:importer_data],
23
23
  path: path,
24
24
  metadata: metadata
25
- ).output
26
-
27
- plan_action(Actions::Pulp3::Repository::SaveVersions, content_view_version.importable_repositories.pluck(:id),
28
- tasks: import_output[:pulp_tasks])
25
+ )
26
+ concurrence do
27
+ content_view_version.importable_repositories.each do |repo|
28
+ plan_action(Actions::Pulp3::Repository::SaveVersion, repo)
29
+ end
30
+ end
29
31
  plan_action(
30
32
  ::Actions::Pulp3::ContentViewVersion::CreateImportHistory,
31
33
  content_view_version_id: content_view_version.id,
@@ -13,7 +13,7 @@ module Actions
13
13
  target = ::Katello::Repository.find(input[:target_repository_id] || input[:target_repository])
14
14
  service = target.backend_service(smart_proxy)
15
15
  output[:pulp_tasks] = if input[:copy_all]
16
- service.copy_all(source, mirror: input[:mirror] || false)
16
+ service.copy_all(source, input)
17
17
  else
18
18
  service.copy_content_for_source(source, input)
19
19
  end
@@ -27,6 +27,7 @@ module Actions
27
27
  []
28
28
  else
29
29
  output[:pulp_tasks] = [content_backend_service.content_api_create(relative_path: input[:options][:file_name],
30
+ repository_id: repository.id,
30
31
  artifact: artifact_href,
31
32
  content_type: content_type)]
32
33
  end
@@ -184,7 +184,7 @@ module Katello
184
184
  def net_http_class
185
185
  if proxy
186
186
  uri = URI(proxy.url) #Net::HTTP::Proxy ignores port as part of the url
187
- Net::HTTP::Proxy("#{uri.host}#{uri.path}", uri.port, proxy.username, proxy.password)
187
+ Net::HTTP::Proxy("#{uri.host}", uri.port, proxy.username, proxy.password)
188
188
  else
189
189
  Net::HTTP
190
190
  end
@@ -32,7 +32,7 @@ module Katello
32
32
  self.prefix = "/pulpcore_registry/"
33
33
  self.site = "#{uri.scheme}://#{uri.host}:#{uri.port}"
34
34
  self.ca_cert_file = Setting[:ssl_ca_file]
35
- pulp_primary.pulp3_ssl_configuration(self)
35
+ pulp_primary.pulp3_ssl_configuration(self, :net_http)
36
36
 
37
37
  self
38
38
  end
@@ -34,7 +34,7 @@ module Katello
34
34
  :content_type => katello_content_type,
35
35
  :unprotected => unprotected?,
36
36
  :download_policy => download_policy,
37
- :mirror_on_sync => true
37
+ :mirroring_policy => Katello::RootRepository::MIRRORING_POLICY_COMPLETE
38
38
  )
39
39
 
40
40
  Repository.new(:root => root,
@@ -109,7 +109,7 @@ module Katello
109
109
  self.host_statuses.where(type: ::Katello::HostStatusManager::STATUSES.map(&:name)).each do |status|
110
110
  status.refresh!
111
111
  end
112
- refresh_global_status!
112
+ refresh_global_status
113
113
  end
114
114
 
115
115
  def queue_refresh_content_host_status
@@ -190,7 +190,7 @@ module Katello
190
190
  service.update_model(model, generic_content_type)
191
191
  elsif self == ::Katello::Erratum
192
192
  # Errata will change pulp_hrefs if the upstream repo updates them
193
- erratum_updated_ids << service.update_model(model)
193
+ erratum_updated_ids << service.update_model(model, repository)
194
194
  else
195
195
  service.update_model(model)
196
196
  end
@@ -185,17 +185,17 @@ module Katello
185
185
  end
186
186
  end
187
187
 
188
- def pulp3_ssl_configuration(config)
188
+ def pulp3_ssl_configuration(config, connection_adapter = Faraday.default_adapter)
189
189
  legacy_pulp_cert = !self.setting(PULP3_FEATURE, 'client_authentication')&.include?('client_certificate')
190
190
 
191
- if Faraday.default_adapter == :excon
191
+ if connection_adapter == :excon
192
192
  config.ssl_client_cert = ::Cert::Certs.ssl_client_cert_filename(use_admin_as_cn_cert: legacy_pulp_cert)
193
193
  config.ssl_client_key = ::Cert::Certs.ssl_client_key_filename(use_admin_as_cn_cert: legacy_pulp_cert)
194
- elsif Faraday.default_adapter == :net_http
194
+ elsif connection_adapter == :net_http
195
195
  config.ssl_client_cert = ::Cert::Certs.ssl_client_cert(use_admin_as_cn_cert: legacy_pulp_cert)
196
196
  config.ssl_client_key = ::Cert::Certs.ssl_client_key(use_admin_as_cn_cert: legacy_pulp_cert)
197
197
  else
198
- fail "Unexpected faraday default_adapter #{Faraday.default_adapter}! Cannot continue, this is likely a bug."
198
+ fail "Unexpected connection_adapter #{Faraday.default_adapter}! Cannot continue, this is likely a bug."
199
199
  end
200
200
  end
201
201
 
@@ -446,14 +446,22 @@ module Katello
446
446
  def rhsm_url
447
447
  # Since Foreman 3.1 this setting is set
448
448
  if (rhsm_url = setting(SmartProxy::PULP3_FEATURE, 'rhsm_url'))
449
- rhsm_url
449
+ URI(rhsm_url)
450
450
  # Compatibility fall back
451
451
  elsif pulp_primary?
452
- "https://#{URI.parse(url).host}/rhsm"
452
+ URI("https://#{URI.parse(url).host}/rhsm")
453
453
  elsif pulp_mirror?
454
- "https://#{URI.parse(url).host}:8443/rhsm"
454
+ URI("https://#{URI.parse(url).host}:8443/rhsm")
455
455
  end
456
456
  end
457
+
458
+ def pulp_content_url
459
+ URI(setting(SmartProxy::PULP3_FEATURE, 'content_app_url'))
460
+ end
461
+
462
+ class ::SmartProxy::Jail < ::Safemode::Jail
463
+ allow :rhsm_url, :pulp_content_url
464
+ end
457
465
  end
458
466
  end
459
467
  end
@@ -153,7 +153,7 @@ module Katello
153
153
  end
154
154
 
155
155
  unless params_to_query_for_delete.empty?
156
- RepositoryDockerMetaTag.where(:docker_meta_tag => DockerMetaTag.where(params_to_query_for_delete.join(" OR "))).delete_all
156
+ RepositoryDockerMetaTag.where(:repository_id => repo.id).where(:docker_meta_tag => DockerMetaTag.where(params_to_query_for_delete.join(" OR "))).delete_all
157
157
  end
158
158
 
159
159
  metatags = []
@@ -1,6 +1,6 @@
1
1
  module Katello
2
2
  module Glue::Provider
3
- DISTRIBUTOR_VERSION = 'sat-6.7'.freeze
3
+ DISTRIBUTOR_VERSION = 'sat-6.10'.freeze
4
4
 
5
5
  def self.included(base)
6
6
  base.send :include, InstanceMethods
@@ -136,6 +136,8 @@ module Katello
136
136
  repo_param[:download_policy] = Setting[:default_download_policy]
137
137
  end
138
138
 
139
+ repo_param[:mirroring_policy] = Katello::RootRepository::MIRRORING_POLICY_ADDITIVE if repo_param[:mirroring_policy].blank?
140
+
139
141
  RootRepository.new(repo_param.merge(:product_id => self.id))
140
142
  end
141
143
  end
@@ -173,7 +173,7 @@ module Katello
173
173
  delegate :name, :label, :docker_upstream_name, :url, :download_concurrency, :to => :root
174
174
 
175
175
  delegate :name, :created_at, :updated_at, :major, :minor, :gpg_key_id, :gpg_key, :arch, :label, :url, :unprotected,
176
- :content_type, :product_id, :checksum_type, :docker_upstream_name, :mirror_on_sync, :"mirror_on_sync?",
176
+ :content_type, :product_id, :checksum_type, :docker_upstream_name, :mirroring_policy,
177
177
  :download_policy, :verify_ssl_on_sync, :"verify_ssl_on_sync?", :upstream_username, :upstream_password,
178
178
  :upstream_authentication_token, :deb_releases,
179
179
  :deb_components, :deb_architectures, :ssl_ca_cert_id, :ssl_ca_cert, :ssl_client_cert, :ssl_client_cert_id,
@@ -285,14 +285,19 @@ module Katello
285
285
  ::Katello::Resources::CDN::CdnResource.ca_file if ::Katello::Resources::CDN::CdnResource.redhat_cdn?(url)
286
286
  end
287
287
 
288
- def using_mirrored_metadata?
289
- self.yum? && self.library_instance? && self.mirror_on_sync
288
+ def soft_copy_of_library?
289
+ return false if self.version_href.nil?
290
+ self.version_href.starts_with?(self.library_instance.backend_service(SmartProxy.pulp_primary).repository_reference.repository_href)
290
291
  end
291
292
 
292
293
  def archive?
293
294
  self.environment.nil?
294
295
  end
295
296
 
297
+ def using_mirrored_metadata?
298
+ self.yum? && self.library_instance? && self.root.mirroring_policy == Katello::RootRepository::MIRRORING_POLICY_COMPLETE
299
+ end
300
+
296
301
  def in_default_view?
297
302
  content_view_version&.default_content_view?
298
303
  end
@@ -38,6 +38,11 @@ module Katello
38
38
  RHEL9 = 'rhel-9'.freeze
39
39
  ALLOWED_OS_VERSIONS = [RHEL6, RHEL7, RHEL8, RHEL9].freeze
40
40
 
41
+ MIRRORING_POLICY_ADDITIVE = 'additive'.freeze
42
+ MIRRORING_POLICY_CONTENT = 'mirror_content_only'.freeze
43
+ MIRRORING_POLICY_COMPLETE = 'mirror_complete'.freeze
44
+ MIRRORING_POLICIES = [MIRRORING_POLICY_ADDITIVE, MIRRORING_POLICY_COMPLETE, MIRRORING_POLICY_CONTENT].freeze
45
+
41
46
  belongs_to :product, :inverse_of => :root_repositories, :class_name => "Katello::Product"
42
47
  has_one :provider, :through => :product
43
48
 
@@ -74,6 +79,7 @@ module Katello
74
79
  validate :ensure_valid_authentication_token, :if => :yum?
75
80
  validate :ensure_valid_deb_constraints, :if => :deb?
76
81
  validate :ensure_no_checksum_on_demand
82
+ validate :ensure_valid_mirroring_policy
77
83
  validates :checksum_type, :inclusion => {:in => CHECKSUM_TYPES}, :allow_blank => true
78
84
  validates :product_id, :presence => true
79
85
  validates :content_type, :inclusion => {
@@ -107,6 +113,7 @@ module Katello
107
113
  }
108
114
  scope :orphaned, -> { where.not(id: Katello::Repository.pluck(:root_id).uniq) }
109
115
  scope :redhat, -> { joins(:provider).merge(Katello::Provider.redhat) }
116
+ scope :custom, -> { where.not(:id => self.redhat) }
110
117
  delegate :redhat?, :provider, :organization, to: :product
111
118
  delegate :cdn_configuration, to: :organization
112
119
 
@@ -145,6 +152,21 @@ module Katello
145
152
  end
146
153
  end
147
154
 
155
+ def valid_mirroring_policies
156
+ if self.yum?
157
+ MIRRORING_POLICIES
158
+ else
159
+ [MIRRORING_POLICY_ADDITIVE, MIRRORING_POLICY_CONTENT]
160
+ end
161
+ end
162
+
163
+ def ensure_valid_mirroring_policy
164
+ unless valid_mirroring_policies.include?(self.mirroring_policy)
165
+ errors.add(:mirroring_policy, _("Invalid mirroring policy for repository type %{type}, only %{policies} are valid.") %
166
+ {:type => self.content_type, :policies => valid_mirroring_policies.join(', ')})
167
+ end
168
+ end
169
+
148
170
  def ensure_valid_docker_attributes
149
171
  if (!url.blank? && docker_upstream_name.blank?)
150
172
  errors.add(:docker_upstream_name, N_("cannot be blank when Repository URL is provided."))
@@ -325,12 +347,16 @@ module Katello
325
347
  (%w(unprotected checksum_type container_repsoitory_name) & previous_changes.keys).any?
326
348
  end
327
349
 
350
+ def using_mirrored_content?
351
+ self.mirroring_policy != Katello::RootRepository::MIRRORING_POLICY_ADDITIVE
352
+ end
353
+
328
354
  def on_demand?
329
355
  self.download_policy == DOWNLOAD_ON_DEMAND
330
356
  end
331
357
 
332
358
  def pulp_update_needed?
333
- changeable_attributes = %w(url unprotected checksum_type docker_upstream_name download_policy mirror_on_sync verify_ssl_on_sync
359
+ changeable_attributes = %w(url unprotected checksum_type docker_upstream_name download_policy mirroring_policy verify_ssl_on_sync
334
360
  upstream_username upstream_password ignorable_content
335
361
  ssl_ca_cert_id ssl_client_cert_id ssl_client_key_id http_proxy_policy http_proxy_id download_concurrency)
336
362
  changeable_attributes += %w(name container_repository_name docker_tags_whitelist) if docker?
@@ -10,7 +10,7 @@ module Cert
10
10
  end
11
11
 
12
12
  def uuid
13
- drop_cn_prefix_from_subject(@cert.subject.to_s)
13
+ @uuid ||= @cert.subject.to_a.detect { |name, _, _| name == 'CN' }&.second
14
14
  end
15
15
 
16
16
  private
@@ -26,10 +26,6 @@ module Cert
26
26
  end
27
27
  end
28
28
 
29
- def drop_cn_prefix_from_subject(subject_string)
30
- subject_string.sub(/\/CN=/i, '')
31
- end
32
-
33
29
  def strip_cert(cert)
34
30
  cert = cert.to_s.gsub("-----BEGIN CERTIFICATE-----", "").gsub("-----END CERTIFICATE-----", "")
35
31
  cert.delete!(' ')
@@ -20,7 +20,7 @@ module Katello
20
20
  not_added_cvs = views.reject { |component_content_view| Katello::ContentViewComponent.where(composite_content_view_id: composite_cv.id, content_view_id: component_content_view.id).first }
21
21
  not_added_cvs.map { |component_content_view| ComponentViewPresenter.new(composite_cv, nil, Katello::ContentViewComponent.where(composite_content_view_id: composite_cv.id, content_view_id: component_content_view.id, latest: true).new) }
22
22
  else
23
- views.map { |component_content_view| ComponentViewPresenter.new(cv, component_content_view) }
23
+ views.map { |component_content_view| ComponentViewPresenter.new(composite_cv, component_content_view) }
24
24
  end
25
25
  end
26
26
  end
@@ -16,7 +16,7 @@ module Katello
16
16
  User.as_anonymous_admin do
17
17
  Organization.not_created_in_katello.each do |org|
18
18
  creator = self.new(org)
19
- creator.create!
19
+ creator.create!(raise_validation_errors: false)
20
20
  end
21
21
  end
22
22
  end
@@ -28,7 +28,9 @@ module Katello
28
28
  def seed!
29
29
  ActiveRecord::Base.transaction do
30
30
  @organization.setup_label_from_name
31
- @organization.save!
31
+
32
+ # existing validation errors are not resolvable here, so don't validatate
33
+ @organization.save(validate: false)
32
34
 
33
35
  create_library_environment
34
36
  create_library_view
@@ -40,14 +42,19 @@ module Katello
40
42
  end
41
43
  end
42
44
 
43
- def create!
45
+ def create!(raise_validation_errors: true)
44
46
  ActiveRecord::Base.transaction do
45
47
  seed!
46
48
 
47
49
  create_backend_objects!
48
50
 
49
51
  @organization.created_in_katello = true
50
- @organization.save!
52
+
53
+ begin
54
+ @organization.save!
55
+ rescue => e
56
+ raise e if raise_validation_errors
57
+ end
51
58
  end
52
59
  end
53
60