katello 3.16.0 → 3.16.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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +1 -1
  3. data/app/controllers/katello/api/v2/host_tracer_controller.rb +0 -5
  4. data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +15 -0
  5. data/app/controllers/katello/api/v2/repositories_controller.rb +10 -1
  6. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +11 -5
  7. data/app/lib/actions/katello/capsule_content/refresh_repos.rb +1 -1
  8. data/app/lib/actions/katello/capsule_content/sync.rb +3 -2
  9. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +17 -3
  10. data/app/lib/actions/katello/product/destroy.rb +25 -4
  11. data/app/lib/actions/katello/repository/destroy.rb +5 -1
  12. data/app/lib/actions/katello/repository/multi_clone_contents.rb +5 -9
  13. data/app/lib/actions/katello/repository/sync.rb +35 -25
  14. data/app/lib/actions/katello/repository/update.rb +11 -16
  15. data/app/lib/actions/katello/repository/verify_checksum.rb +28 -0
  16. data/app/lib/actions/pulp/orchestration/repository/sync.rb +2 -1
  17. data/app/lib/actions/pulp/repository/sync.rb +2 -1
  18. data/app/lib/actions/pulp3/capsule_content/refresh_content_guard.rb +17 -0
  19. data/app/lib/actions/pulp3/capsule_content/sync.rb +3 -1
  20. data/app/lib/actions/pulp3/{ContentGuard → content_guard}/refresh.rb +0 -0
  21. data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +1 -2
  22. data/app/lib/actions/pulp3/orchestration/repository/sync.rb +3 -1
  23. data/app/lib/actions/pulp3/orchestration/repository/trigger_update_repo_cert_guard.rb +22 -0
  24. data/app/lib/actions/pulp3/repository/copy_content.rb +0 -1
  25. data/app/lib/actions/pulp3/repository/multi_copy_content.rb +1 -1
  26. data/app/lib/actions/pulp3/repository/presenters/repair_presenter.rb +85 -0
  27. data/app/lib/actions/pulp3/repository/repair.rb +29 -0
  28. data/app/lib/actions/pulp3/repository/save_version.rb +20 -16
  29. data/app/lib/actions/pulp3/repository/sync.rb +1 -1
  30. data/app/lib/actions/pulp3/repository/update_cv_repository_cert_guard.rb +6 -2
  31. data/app/lib/actions/pulp3/repository/upload_file.rb +1 -1
  32. data/app/lib/katello/concerns/base_template_scope_extensions.rb +4 -0
  33. data/app/lib/katello/resources/cdn.rb +3 -2
  34. data/app/lib/katello/util/cdn_var_substitutor.rb +9 -6
  35. data/app/models/katello/concerns/smart_proxy_extensions.rb +14 -3
  36. data/app/models/katello/content_view_package_filter.rb +1 -1
  37. data/app/models/katello/host/content_facet.rb +1 -0
  38. data/app/models/katello/ping.rb +1 -3
  39. data/app/models/katello/repository.rb +5 -0
  40. data/app/models/setting/content.rb +1 -1
  41. data/app/services/cert/certs.rb +10 -2
  42. data/app/services/katello/pulp3/repository.rb +7 -8
  43. data/app/services/katello/pulp3/repository/yum.rb +73 -6
  44. data/app/services/katello/pulp3/repository_mirror.rb +7 -2
  45. data/app/services/katello/pulp3/smart_proxy_mirror_repository.rb +1 -1
  46. data/app/services/katello/smart_proxy_helper.rb +13 -16
  47. data/config/routes/api/rhsm.rb +1 -0
  48. data/config/routes/api/v2.rb +2 -0
  49. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/product-bulk-action.factory.js +1 -0
  50. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details.controller.js +6 -0
  51. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-details.html +7 -1
  52. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/repository.factory.js +1 -0
  53. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.controller.js +15 -0
  54. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/views/products.html +6 -0
  55. data/lib/katello/permission_creator.rb +2 -2
  56. data/lib/katello/plugin.rb +0 -1
  57. data/lib/katello/version.rb +1 -1
  58. data/webpack/redux/actions/RedHatRepositories/helpers.js +1 -1
  59. metadata +14 -4
  60. data/app/lib/actions/katello/repository/update_cv_repo_cert_guard.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c1b5ae508e6d13abb97dd4fa5dcb3a869b5a8ee2f6a2a2e574bcde16faa1c41
4
- data.tar.gz: e5dc1c88a336020bf333e9f781eac5790b588139bd8d813433bea739ee7077ca
3
+ metadata.gz: 961e7dd9a56b1752c55e19c1f29dc6b4e55366db3e87ab59610d7b89e8dea975
4
+ data.tar.gz: aa5c95aec6191209c2bc76988bc81b18984167176bf71eaa4186f517a06028f6
5
5
  SHA512:
6
- metadata.gz: c6e0279e68e389701bcf84815bd401fe64375259da0ff533e4ae53fbf51f99b93837be754c0fb8d2d0457e6a8d299e4527c26d5c51fb4e81870f78592bbd46bf
7
- data.tar.gz: 2296caf477bbb72d78f187e53a493b9e4c8657119424939063a8a6c6c40435d5e9bda70490351101207694cf9511a59de939397c53c623f11a2f30eba564ff91
6
+ metadata.gz: a60d61a7d375ff622d7d4db78fd7c5da3d78f8421d45cb5204ce7b690b031515412e727e03c906d96fb3ba538c585819350c2671d103e6415ea51987481df037
7
+ data.tar.gz: b62c7366deacc4d5875488bff0913e11fa61cf0a4e7077391a459a78587d598b032ce815b45ade45d0e6e3e870e09e87ebef0ba60034d5166aa83cf8520f501e
@@ -480,7 +480,7 @@ module Katello
480
480
  else
481
481
  User.consumer? || ::User.current.can?(:view_organizations, self)
482
482
  end
483
- when "rhsm_proxy_owner_servicelevels_path"
483
+ when "rhsm_proxy_owner_servicelevels_path", "rhsm_proxy_owner_system_purpose_path"
484
484
  (User.consumer? || ::User.current.can?(:view_organizations, self))
485
485
  when "rhsm_proxy_consumer_accessible_content_path", "rhsm_proxy_consumer_certificates_path",
486
486
  "rhsm_proxy_consumer_releases_path", "rhsm_proxy_certificate_serials_path",
@@ -2,11 +2,6 @@ module Katello
2
2
  class Api::V2::HostTracerController < Api::V2::ApiController
3
3
  before_action :find_host, :only => :index
4
4
 
5
- resource_description do
6
- api_version 'v2'
7
- api_base_url "/api"
8
- end
9
-
10
5
  api :GET, "/hosts/:host_id/traces", N_("List services that need restarting on the host")
11
6
  param :host_id, :number, :required => true, :desc => N_("ID of the host")
12
7
  def index
@@ -50,6 +50,21 @@ module Katello
50
50
  respond_for_async :resource => task
51
51
  end
52
52
 
53
+ api :PUT, "/products/bulk/verify_checksum", N_("Verify checksum for one or more products")
54
+ param :ids, Array, :desc => N_("List of product ids"), :required => true
55
+ def verify_checksum_products
56
+ repairable_products = @products.syncable
57
+ repairable_roots = RootRepository.where(:product_id => repairable_products).
58
+ where(:content_type => ::Katello::Repository::YUM_TYPE).has_url.select { |r| r.library_instance }.uniq
59
+
60
+ repairable_repositories = Katello::Repository.where(:root_id => repairable_roots)
61
+ task = async_task(::Actions::BulkAction,
62
+ ::Actions::Katello::Repository::VerifyChecksum,
63
+ repairable_repositories)
64
+
65
+ respond_for_async :resource => task
66
+ end
67
+
53
68
  api :PUT, "/products/bulk/http_proxy", N_("Update the HTTP proxy configuration on the repositories of one or more products.")
54
69
  param :ids, Array, :desc => N_("List of product ids"), :required => true
55
70
  param :http_proxy_policy, ::Katello::RootRepository::HTTP_PROXY_POLICIES, :desc => N_("policy for HTTP proxy for content sync")
@@ -15,7 +15,7 @@ module Katello
15
15
  before_action :find_organization_from_product, :only => [:create]
16
16
  before_action :find_repository, :only => [:show, :update, :destroy, :sync, :export,
17
17
  :remove_content, :upload_content, :republish,
18
- :import_uploads, :gpg_key_content]
18
+ :import_uploads, :gpg_key_content, :verify_checksum]
19
19
  before_action :find_content, :only => :remove_content
20
20
  before_action :find_organization_from_repo, :only => [:update]
21
21
  before_action :error_on_rh_product, :only => [:create]
@@ -294,6 +294,15 @@ module Katello
294
294
  raise HttpErrors::BadRequest, e.message
295
295
  end
296
296
 
297
+ api :POST, "/repositories/:id/verify_checksum", N_("Verify checksum of repository contents")
298
+ param :id, :number, :required => true, :desc => N_("repository ID")
299
+ def verify_checksum
300
+ task = async_task(::Actions::Katello::Repository::VerifyChecksum, @repository)
301
+ respond_for_async :resource => task
302
+ rescue Errors::InvalidActionOptionError => e
303
+ raise HttpErrors::BadRequest, e.message
304
+ end
305
+
297
306
  api :POST, "/repositories/:id/export", N_("Export a repository")
298
307
  param :id, :number, :desc => N_("Repository identifier"), :required => true
299
308
  param :export_to_iso, :bool, :desc => N_("Export to ISO format"), :required => false
@@ -19,11 +19,17 @@ module Katello
19
19
  prepend Overrides
20
20
 
21
21
  def update_multiple_taxonomies(type)
22
- registered_host = @hosts.detect { |host| host.subscription_facet }
23
- unless registered_host.nil?
24
- error _("Unregister host %s before assigning an organization") % registered_host.name
25
- redirect_back_or_to hosts_path
26
- return
22
+ if type == :organization
23
+ new_org_id = params.dig(type, 'id')
24
+
25
+ if new_org_id
26
+ registered_host = @hosts.where.not(organization_id: new_org_id).joins(:subscription_facet).first
27
+ if registered_host
28
+ error _("Unregister host %s before assigning an organization") % registered_host.name
29
+ redirect_back_or_to hosts_path
30
+ return
31
+ end
32
+ end
27
33
  end
28
34
 
29
35
  super
@@ -37,7 +37,7 @@ module Actions
37
37
  current_repos_on_capsule = smart_proxy_service.current_repositories(environment, content_view)
38
38
  current_repos_on_capsule_ids = current_repos_on_capsule.pluck(:id)
39
39
 
40
- list_of_repos_to_sync = smart_proxy_helper.repos_available_to_capsule(environment, content_view, repository)
40
+ list_of_repos_to_sync = smart_proxy_helper.combined_repos_available_to_capsule(environment, content_view, repository)
41
41
  list_of_repos_to_sync.each do |repo|
42
42
  if repo.is_a?(Katello::ContentViewPuppetEnvironment)
43
43
  repo = repo.nonpersisted_repository
@@ -31,8 +31,8 @@ module Actions
31
31
  fail _("Action not allowed for the default smart proxy.") if smart_proxy.pulp_master?
32
32
 
33
33
  smart_proxy_helper = ::Katello::SmartProxyHelper.new(smart_proxy)
34
- repositories = smart_proxy_helper.repos_available_to_capsule(environment, content_view, repository)
35
- smart_proxy.ping_pulp3 if repositories.any? { |repo| smart_proxy.pulp3_support?(repo) }
34
+ repositories = smart_proxy_helper.combined_repos_available_to_capsule(environment, content_view, repository)
35
+
36
36
  smart_proxy.ping_pulp if repositories.any? { |repo| !smart_proxy.pulp3_support?(repo) }
37
37
 
38
38
  refresh_options = options.merge(content_view: content_view,
@@ -40,6 +40,7 @@ module Actions
40
40
  repository: repository)
41
41
  sequence do
42
42
  plan_action(Actions::Pulp::Orchestration::Repository::RefreshRepos, smart_proxy, refresh_options)
43
+ plan_action(Actions::Pulp3::CapsuleContent::RefreshContentGuard, smart_proxy) if repositories.any? { |repo| smart_proxy.pulp3_support?(repo) }
43
44
  plan_action(Actions::Pulp3::Orchestration::Repository::RefreshRepos, smart_proxy, refresh_options) if smart_proxy.pulp3_enabled?
44
45
  plan_action(SyncCapsule, smart_proxy, refresh_options)
45
46
  end
@@ -10,11 +10,12 @@ module Actions
10
10
  repository = options[:repository]
11
11
  skip_metadata_check = options.fetch(:skip_metadata_check, false)
12
12
 
13
- smart_proxy_helper = ::Katello::SmartProxyHelper.new(smart_proxy)
14
13
  sequence do
15
- smart_proxy_helper.repos_available_to_capsule(environment, content_view, repository).in_groups_of(Setting[:foreman_proxy_content_batch_size], false) do |repos|
14
+ repos = repos_to_sync(smart_proxy, environment, content_view, repository)
15
+
16
+ repos.in_groups_of(Setting[:foreman_proxy_content_batch_size], false) do |repo_batch|
16
17
  concurrence do
17
- repos.each do |repo|
18
+ repo_batch.each do |repo|
18
19
  plan_pulp_action([Actions::Pulp::Orchestration::Repository::SmartProxySync,
19
20
  Actions::Pulp3::CapsuleContent::Sync],
20
21
  repo, smart_proxy,
@@ -33,6 +34,19 @@ module Actions
33
34
  end
34
35
  end
35
36
 
37
+ def repos_to_sync(smart_proxy, environment, content_view, repository)
38
+ smart_proxy_helper = ::Katello::SmartProxyHelper.new(smart_proxy)
39
+ smart_proxy_helper.lifecycle_environment_check(environment, repository)
40
+
41
+ if repository
42
+ [repository]
43
+ else
44
+ repositories = smart_proxy_helper.repositories_available_to_capsule(environment, content_view).by_rpm_count
45
+ puppet_envs = smart_proxy_helper.puppet_environments_available_to_capsule(environment, content_view)
46
+ repositories + puppet_envs
47
+ end
48
+ end
49
+
36
50
  def resource_locks
37
51
  :link
38
52
  end
@@ -5,6 +5,8 @@ module Actions
5
5
  # rubocop:disable Metrics/MethodLength
6
6
  def plan(product, options = {})
7
7
  organization_destroy = options.fetch(:organization_destroy, false)
8
+ skip_environment_update = options.fetch(:skip_environment_update, false) ||
9
+ options.fetch(:organization_destroy, false)
8
10
 
9
11
  unless organization_destroy || product.user_deletable?
10
12
  if product.redhat?
@@ -24,11 +26,13 @@ module Actions
24
26
 
25
27
  sequence do
26
28
  unless organization_destroy
29
+ sequence do
30
+ # ContentDestroy must be called sequentially due to Candlepin's
31
+ # issues with running multiple remove_content calls at the same time.
32
+ plan_content_destruction(product, skip_environment_update)
33
+ end
27
34
  concurrence do
28
- product.repositories.in_default_view.each do |repo|
29
- repo_options = options.clone
30
- plan_action(Katello::Repository::Destroy, repo, repo_options)
31
- end
35
+ plan_repo_destruction(product, options)
32
36
  end
33
37
  plan_action(Candlepin::Product::DeletePools,
34
38
  cp_id: product.cp_id, organization_label: product.organization.label)
@@ -65,6 +69,23 @@ module Actions
65
69
  product.pool_products.delete_all
66
70
  end
67
71
 
72
+ def plan_content_destruction(product, skip_environment_update)
73
+ product.repositories.in_default_view.each do |repo|
74
+ if repo.root.repositories.where.not(id: repo.id).empty? &&
75
+ !repo.redhat? &&
76
+ !skip_environment_update
77
+ plan_action(::Actions::Katello::Product::ContentDestroy, repo.root)
78
+ end
79
+ end
80
+ end
81
+
82
+ def plan_repo_destruction(product, options)
83
+ product.repositories.in_default_view.each do |repo|
84
+ repo_options = options.clone
85
+ plan_action(Katello::Repository::Destroy, repo, repo_options.merge(destroy_content: false))
86
+ end
87
+ end
88
+
68
89
  def view_versions(product)
69
90
  cvvs = product.published_content_view_versions.uniq
70
91
  views = cvvs.inject({}) do |result, version|
@@ -7,9 +7,11 @@ module Actions
7
7
 
8
8
  # options:
9
9
  # skip_environment_update - defaults to false. skips updating the CP environment
10
+ # destroy_content - can be disabled to skip Candlepin remove_content
10
11
  def plan(repository, options = {})
11
12
  skip_environment_update = options.fetch(:skip_environment_update, false) ||
12
13
  options.fetch(:organization_destroy, false)
14
+ destroy_content = options.fetch(:destroy_content, true)
13
15
  action_subject(repository)
14
16
 
15
17
  unless repository.destroyable?
@@ -29,7 +31,9 @@ module Actions
29
31
  if repository.redhat?
30
32
  handle_redhat_content(repository) unless skip_environment_update
31
33
  else
32
- handle_custom_content(repository) unless skip_environment_update
34
+ if destroy_content && !skip_environment_update
35
+ handle_custom_content(repository)
36
+ end
33
37
  end
34
38
  end
35
39
  end
@@ -46,19 +46,15 @@ module Actions
46
46
 
47
47
  plan_action(Katello::Repository::MetadataGenerate, new_repository, metadata_options)
48
48
  unless source_repositories.first.saved_checksum_type == new_repository.saved_checksum_type
49
- checksum_mapping = {}
50
- repository_mapping.each do |source_repos, dest_repo|
51
- checksum_mapping[dest_repo.id] = source_repos.first.saved_checksum_type
52
- end
53
- plan_self(:checksum_mapping => checksum_mapping)
49
+ plan_self(:source_checksum_type => source_repositories.first.saved_checksum_type,
50
+ :target_repo_id => new_repository.id)
54
51
  end
55
52
  end
56
53
 
57
54
  def finalize
58
- input[:checksum_mapping].each do |repo_id, checksum_type|
59
- repository = ::Katello::Repository.find(repo_id)
60
- repository.update!(saved_checksum_type: checksum_type) if (repository && checksum_type)
61
- end
55
+ repository = ::Katello::Repository.find(input[:target_repo_id])
56
+ source_checksum_type = input[:source_checksum_type]
57
+ repository.update!(saved_checksum_type: source_checksum_type) if (repository && source_checksum_type)
62
58
  end
63
59
  end
64
60
  end
@@ -34,38 +34,47 @@ module Actions
34
34
 
35
35
  pulp_sync_options = {}
36
36
  pulp_sync_options[:download_policy] = ::Runcible::Models::YumImporter::DOWNLOAD_ON_DEMAND if validate_contents && repo.yum?
37
+
38
+ #pulp2 options
37
39
  pulp_sync_options[:force_full] = true if skip_metadata_check && repo.yum?
38
40
  pulp_sync_options[:repair_sync] = true if validate_contents && repo.deb?
39
41
  pulp_sync_options[:remove_missing] = false if incremental
42
+ pulp_sync_options[:source_url] = source_url
43
+
44
+ #pulp3 options
45
+ pulp_sync_options[:optimize] = false if skip_metadata_check && repo.yum?
40
46
 
41
47
  sequence do
42
- plan_action(Pulp::Repository::RemoveUnits, :repo_id => repo.id, :content_unit_type => ::Katello::YumMetadataFile::CONTENT_TYPE) if validate_contents && repo.yum?
43
- sync_args = {:smart_proxy_id => SmartProxy.pulp_master.id, :repo_id => repo.id, :source_url => source_url, :options => pulp_sync_options}
44
- sync_action = plan_pulp_action([Actions::Pulp::Orchestration::Repository::Sync,
45
- Actions::Pulp3::Orchestration::Repository::Sync],
46
- repo,
47
- SmartProxy.pulp_master,
48
- sync_args)
49
- output = sync_action.output
50
-
51
- contents_changed = skip_metadata_check || output[:contents_changed]
52
-
53
- plan_action(Katello::Repository::IndexContent, :id => repo.id, :contents_changed => contents_changed)
54
- plan_action(Katello::Foreman::ContentUpdate, repo.environment, repo.content_view, repo)
55
- plan_action(Katello::Repository::FetchPxeFiles, :id => repo.id)
56
- plan_action(Katello::Repository::CorrectChecksum, repo)
57
- concurrence do
58
- plan_action(Pulp::Repository::Download, :pulp_id => repo.pulp_id, :options => {:verify_all_units => true}) if validate_contents && repo.yum?
59
- plan_action(Katello::Repository::MetadataGenerate, repo, :force => true) if skip_metadata_check && repo.yum?
60
- plan_action(Katello::Repository::ErrataMail, repo, nil, contents_changed)
61
- if generate_applicability
62
- regenerate_applicability(repo, contents_changed)
48
+ if SmartProxy.pulp_master.pulp3_support?(repo) && validate_contents
49
+ plan_action(Katello::Repository::VerifyChecksum, repo)
50
+ else
51
+ plan_action(Pulp::Repository::RemoveUnits, :repo_id => repo.id, :content_unit_type => ::Katello::YumMetadataFile::CONTENT_TYPE) if validate_contents && repo.yum?
52
+ sync_action = plan_pulp_action([Actions::Pulp::Orchestration::Repository::Sync,
53
+ Actions::Pulp3::Orchestration::Repository::Sync],
54
+ repo,
55
+ SmartProxy.pulp_master,
56
+ pulp_sync_options)
57
+ output = sync_action.output
58
+
59
+ contents_changed = skip_metadata_check || output[:contents_changed]
60
+
61
+ plan_action(Katello::Repository::IndexContent, :id => repo.id, :contents_changed => contents_changed)
62
+ plan_action(Katello::Foreman::ContentUpdate, repo.environment, repo.content_view, repo)
63
+ plan_action(Katello::Repository::FetchPxeFiles, :id => repo.id)
64
+ plan_action(Katello::Repository::CorrectChecksum, repo)
65
+ concurrence do
66
+ plan_action(Pulp::Repository::Download, :pulp_id => repo.pulp_id, :options => {:verify_all_units => true}) if validate_contents && repo.yum?
67
+ plan_action(Katello::Repository::MetadataGenerate, repo, :force => true) if skip_metadata_check && repo.yum?
68
+ plan_action(Katello::Repository::ErrataMail, repo, nil, contents_changed)
69
+ if generate_applicability
70
+ regenerate_applicability(repo, contents_changed)
71
+ end
63
72
  end
73
+ plan_self(:id => repo.id, :sync_result => output, :skip_metadata_check => skip_metadata_check, :validate_contents => validate_contents,
74
+ :contents_changed => contents_changed)
75
+ plan_action(Katello::Repository::ImportApplicability, :repo_id => repo.id, :contents_changed => contents_changed) if generate_applicability
76
+ plan_action(Katello::Repository::SyncHook, :id => repo.id)
64
77
  end
65
- plan_self(:id => repo.id, :sync_result => output, :skip_metadata_check => skip_metadata_check, :validate_contents => validate_contents,
66
- :contents_changed => contents_changed)
67
- plan_action(Katello::Repository::ImportApplicability, :repo_id => repo.id, :contents_changed => contents_changed) if generate_applicability
68
- plan_action(Katello::Repository::SyncHook, :id => repo.id)
69
78
  end
70
79
  end
71
80
 
@@ -91,6 +100,7 @@ module Actions
91
100
  def presenter
92
101
  found = all_planned_actions(Pulp::Repository::Sync)
93
102
  found = all_planned_actions(Pulp3::Repository::Sync) if found.empty?
103
+ found = all_planned_actions(Pulp3::Repository::Repair) if found.empty?
94
104
  Helpers::Presenter::Delegated.new(self, found)
95
105
  end
96
106
 
@@ -10,8 +10,7 @@ module Actions
10
10
  action_subject root.library_instance
11
11
 
12
12
  repo_params[:url] = nil if repo_params[:url] == ''
13
- update_cv_cert_protected = (repo_params[:unprotected] != repository.unprotected)
14
-
13
+ update_cv_cert_protected = repo_params.key?(:unprotected) && (repo_params[:unprotected] != repository.unprotected)
15
14
  root.update!(repo_params)
16
15
 
17
16
  if root.download_policy == ::Runcible::Models::YumImporter::DOWNLOAD_BACKGROUND
@@ -42,28 +41,24 @@ module Actions
42
41
  gpg_url: repository.yum_gpg_key_url)
43
42
  end
44
43
  if root.pulp_update_needed?
45
- plan_pulp_action([::Actions::Pulp::Orchestration::Repository::Refresh,
46
- ::Actions::Pulp3::Orchestration::Repository::Update],
47
- repository,
48
- SmartProxy.pulp_master)
49
- plan_self(:repository_id => root.library_instance.id, :update_cv_cert_protected => update_cv_cert_protected)
44
+ sequence do
45
+ plan_pulp_action([::Actions::Pulp::Orchestration::Repository::Refresh,
46
+ ::Actions::Pulp3::Orchestration::Repository::Update],
47
+ repository,
48
+ SmartProxy.pulp_master)
49
+ plan_self(:repository_id => root.library_instance.id)
50
+ if update_cv_cert_protected
51
+ plan_optional_pulp_action([::Actions::Pulp3::Orchestration::Repository::TriggerUpdateRepoCertGuard], repository, ::SmartProxy.pulp_master)
52
+ end
53
+ end
50
54
  end
51
55
  end
52
56
 
53
57
  def run
54
58
  repository = ::Katello::Repository.find(input[:repository_id])
55
- output[:repository_id] = input[:repository_id]
56
- output[:update_cv_cert_protected] = input[:update_cv_cert_protected]
57
59
  ForemanTasks.async_task(Katello::Repository::MetadataGenerate, repository)
58
60
  end
59
61
 
60
- def finalize
61
- repository = ::Katello::Repository.find(output[:repository_id])
62
- if output[:update_cv_cert_protected]
63
- ForemanTasks.async_task(::Actions::Katello::Repository::UpdateCVRepoCertGuard, repository, SmartProxy.pulp_master)
64
- end
65
- end
66
-
67
62
  private
68
63
 
69
64
  def update_content?(repository)
@@ -0,0 +1,28 @@
1
+ module Actions
2
+ module Katello
3
+ module Repository
4
+ class VerifyChecksum < Actions::EntryAction
5
+ include Helpers::Presenter
6
+ include Actions::Katello::PulpSelector
7
+
8
+ def plan(repo)
9
+ action_subject(repo)
10
+
11
+ if SmartProxy.pulp_master.pulp3_support?(repo)
12
+ plan_action(Actions::Pulp3::Repository::Repair, repo.id, SmartProxy.pulp_master)
13
+ else
14
+ options = {}
15
+ options[:validate_contents] = true
16
+ plan_action(Actions::Katello::Repository::Sync, repo, nil, options)
17
+ end
18
+ end
19
+
20
+ def presenter
21
+ found = all_planned_actions(Katello::Repository::Sync)
22
+ found = all_planned_actions(Pulp3::Repository::Repair) if found.empty?
23
+ Helpers::Presenter::Delegated.new(self, found)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -4,8 +4,9 @@ module Actions
4
4
  module Repository
5
5
  class Sync < Pulp::Abstract
6
6
  include Actions::Helpers::OutputPropagator
7
- def plan(_repository, _smart_proxy, options)
7
+ def plan(repository, smart_proxy, options)
8
8
  sequence do
9
+ options.merge!(:repo_id => repository.id, :smart_proxy_id => smart_proxy.id)
9
10
  action_output = plan_action(Actions::Pulp::Repository::Sync, options).output
10
11
  plan_self(:subaction_output => action_output)
11
12
  end
@@ -14,8 +14,9 @@ module Actions
14
14
  overrides = {}
15
15
  overrides[:feed] = input[:source_url] if input[:source_url]
16
16
  overrides[:validate] = !(SETTINGS[:katello][:pulp][:skip_checksum_validation])
17
- overrides[:options] = input[:options] if input[:options]
17
+ overrides.merge(input[:options]) if input[:options]
18
18
  repo = ::Katello::Repository.find(input[:repo_id])
19
+
19
20
  output[:pulp_tasks] = repo.backend_service(::SmartProxy.pulp_master).sync(overrides)
20
21
  end
21
22