katello 3.16.0.rc5 → 3.16.1.2

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 (97) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/registry/registry_proxies_controller.rb +39 -23
  3. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +1 -1
  4. data/app/controllers/katello/api/v2/content_view_filters_controller.rb +5 -1
  5. data/app/controllers/katello/api/v2/host_tracer_controller.rb +0 -5
  6. data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +15 -0
  7. data/app/controllers/katello/api/v2/repositories_controller.rb +10 -1
  8. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +11 -5
  9. data/app/helpers/katello/content_view_helper.rb +15 -0
  10. data/app/lib/actions/katello/capsule_content/refresh_repos.rb +1 -1
  11. data/app/lib/actions/katello/capsule_content/sync.rb +3 -2
  12. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +17 -3
  13. data/app/lib/actions/katello/content_view/incremental_updates.rb +3 -1
  14. data/app/lib/actions/katello/content_view/publish.rb +55 -16
  15. data/app/lib/actions/katello/content_view_version/incremental_update.rb +84 -53
  16. data/app/lib/actions/katello/host/attach_subscriptions.rb +5 -1
  17. data/app/lib/actions/katello/product/destroy.rb +25 -4
  18. data/app/lib/actions/katello/repository/destroy.rb +5 -1
  19. data/app/lib/actions/katello/repository/multi_clone_contents.rb +62 -0
  20. data/app/lib/actions/katello/repository/multi_clone_to_version.rb +30 -0
  21. data/app/lib/actions/katello/repository/sync.rb +35 -25
  22. data/app/lib/actions/katello/repository/update.rb +11 -16
  23. data/app/lib/actions/katello/repository/verify_checksum.rb +28 -0
  24. data/app/lib/actions/katello/sync_plan/run.rb +1 -1
  25. data/app/lib/actions/pulp/orchestration/repository/sync.rb +2 -1
  26. data/app/lib/actions/pulp/repository/sync.rb +2 -1
  27. data/app/lib/actions/pulp3/abstract_async_task.rb +62 -58
  28. data/app/lib/actions/pulp3/capsule_content/refresh_content_guard.rb +17 -0
  29. data/app/lib/actions/pulp3/capsule_content/sync.rb +3 -1
  30. data/app/lib/actions/pulp3/{ContentGuard → content_guard}/refresh.rb +0 -0
  31. data/app/lib/actions/pulp3/content_migration.rb +4 -0
  32. data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +2 -4
  33. data/app/lib/actions/pulp3/orchestration/repository/multi_copy_all_units.rb +36 -0
  34. data/app/lib/actions/pulp3/orchestration/repository/sync.rb +3 -1
  35. data/app/lib/actions/pulp3/orchestration/repository/trigger_update_repo_cert_guard.rb +22 -0
  36. data/app/lib/actions/pulp3/repository/copy_content.rb +0 -1
  37. data/app/lib/actions/pulp3/repository/multi_copy_content.rb +28 -0
  38. data/app/lib/actions/pulp3/repository/multi_copy_units.rb +14 -7
  39. data/app/lib/actions/pulp3/repository/presenters/content_unit_presenter.rb +1 -1
  40. data/app/lib/actions/pulp3/repository/presenters/repair_presenter.rb +85 -0
  41. data/app/lib/actions/pulp3/repository/repair.rb +29 -0
  42. data/app/lib/actions/pulp3/repository/save_version.rb +20 -8
  43. data/app/lib/actions/pulp3/repository/save_versions.rb +47 -13
  44. data/app/lib/actions/pulp3/repository/sync.rb +1 -1
  45. data/app/lib/actions/pulp3/repository/update_cv_repository_cert_guard.rb +6 -2
  46. data/app/lib/actions/pulp3/repository/upload_file.rb +1 -1
  47. data/app/lib/katello/concerns/base_template_scope_extensions.rb +4 -0
  48. data/app/lib/katello/errors.rb +1 -15
  49. data/app/lib/katello/resources/cdn.rb +3 -2
  50. data/app/lib/katello/util/cdn_var_substitutor.rb +9 -6
  51. data/app/models/katello/concerns/smart_proxy_extensions.rb +14 -3
  52. data/app/models/katello/content_view.rb +18 -6
  53. data/app/models/katello/content_view_erratum_filter.rb +13 -0
  54. data/app/models/katello/content_view_filter.rb +4 -0
  55. data/app/models/katello/content_view_module_stream_filter.rb +30 -3
  56. data/app/models/katello/content_view_package_filter.rb +1 -1
  57. data/app/models/katello/host/content_facet.rb +1 -0
  58. data/app/models/katello/module_stream.rb +1 -1
  59. data/app/models/katello/ping.rb +1 -3
  60. data/app/models/katello/repository.rb +16 -0
  61. data/app/models/setting/content.rb +1 -1
  62. data/app/presenters/katello/sync_status_presenter.rb +4 -2
  63. data/app/services/cert/certs.rb +10 -2
  64. data/app/services/katello/pulp/repository/yum.rb +2 -1
  65. data/app/services/katello/pulp3/api/core.rb +4 -0
  66. data/app/services/katello/pulp3/erratum.rb +3 -1
  67. data/app/services/katello/pulp3/migration.rb +10 -5
  68. data/app/services/katello/pulp3/migration_plan.rb +6 -6
  69. data/app/services/katello/pulp3/repository.rb +13 -5
  70. data/app/services/katello/pulp3/repository/yum.rb +235 -35
  71. data/app/services/katello/pulp3/repository_mirror.rb +7 -2
  72. data/app/services/katello/pulp3/smart_proxy_mirror_repository.rb +1 -1
  73. data/app/services/katello/pulp3/task.rb +100 -0
  74. data/app/services/katello/pulp3/task_group.rb +79 -0
  75. data/app/services/katello/smart_proxy_helper.rb +13 -16
  76. data/app/views/katello/api/v2/content_view_filters/base.json.rabl +4 -0
  77. data/config/routes/api/rhsm.rb +1 -0
  78. data/config/routes/api/v2.rb +2 -0
  79. data/db/migrate/20200709021250_add_original_modules_to_content_view_module_stream_filter.rb +5 -0
  80. data/db/migrate/20200721142707_remove_duplicate_katello_pools_index.rb +5 -0
  81. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.routes.js +1 -13
  82. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/filter-details.controller.js +17 -4
  83. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/module-stream-filter-details.html +17 -0
  84. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/product-bulk-action.factory.js +1 -0
  85. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details.controller.js +6 -0
  86. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-details.html +7 -1
  87. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/repository.factory.js +1 -0
  88. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.controller.js +15 -0
  89. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/views/products.html +6 -0
  90. data/lib/katello/permission_creator.rb +2 -2
  91. data/lib/katello/plugin.rb +0 -1
  92. data/lib/katello/tasks/pulp3_post_migration_check.rake +2 -1
  93. data/lib/katello/tasks/reports.rake +16 -0
  94. data/lib/katello/version.rb +1 -1
  95. data/webpack/redux/actions/RedHatRepositories/helpers.js +6 -6
  96. metadata +34 -14
  97. data/app/lib/actions/katello/repository/update_cv_repo_cert_guard.rb +0 -17
@@ -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
@@ -19,7 +19,7 @@ module Actions
19
19
  syncable_products = sync_plan.products.syncable
20
20
  syncable_roots = ::Katello::RootRepository.where(:product_id => syncable_products).has_url
21
21
 
22
- plan_action(::Actions::BulkAction, ::Actions::Katello::Repository::Sync, syncable_roots.map(&:library_instance)) unless syncable_roots.empty?
22
+ plan_action(::Actions::BulkAction, ::Actions::Katello::Repository::Sync, syncable_roots.map(&:library_instance).compact) unless syncable_roots.empty?
23
23
  plan_self(:sync_plan_name => sync_plan.name)
24
24
  end
25
25
  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
 
@@ -4,41 +4,6 @@ module Actions
4
4
  include Actions::Base::Polling
5
5
  include ::Dynflow::Action::Cancellable
6
6
 
7
- WAITING = ['waiting',
8
- SKIPPED = 'skipped'.freeze,
9
- RUNNING = 'running'.freeze,
10
- COMPLETED = 'completed'.freeze,
11
- FAILED = 'failed'.freeze,
12
- CANCELED = 'canceled'.freeze].freeze
13
-
14
- FINISHED_STATES = [COMPLETED, FAILED, CANCELED, SKIPPED].freeze
15
-
16
- # A call report Looks like: {"task":"/pulp/api/v3/tasks/5/"}
17
- # {
18
- # "pulp_href":"/pulp/api/v3/tasks/4/",
19
- # "pulp_created":"2019-02-21T19:50:40.476767Z",
20
- # "job_id":"d0359658-d926-47a2-b430-1b2092b3bd86",
21
- # "state":"completed",
22
- # "name":"pulp_file.app.tasks.publishing.publish",
23
- # "started_at":"2019-02-21T19:50:40.556002Z",
24
- # "finished_at":"2019-02-21T19:50:40.618397Z",
25
- # "non_fatal_errors":[
26
- #
27
- # ],
28
- # "error":null,
29
- # "worker":"/pulp/api/v3/workers/1/",
30
- # "parent":null,
31
- # "spawned_tasks":[
32
- #
33
- # ],
34
- # "progress_reports":[
35
- #
36
- # ],
37
- # "created_resources":[
38
- # "/pulp/api/v3/publications/1/"
39
- # ]
40
- # }
41
-
42
7
  def run(event = nil)
43
8
  # do nothing when the action is being skipped
44
9
  unless event == Dynflow::Action::Skip
@@ -49,16 +14,16 @@ module Actions
49
14
  def humanized_state
50
15
  case state
51
16
  when :running
52
- if self.external_task.nil?
17
+ if self.combined_tasks.empty?
53
18
  _("initiating Pulp task")
54
19
  else
55
20
  _("checking Pulp task status")
56
21
  end
57
22
  when :suspended
58
- if external_task&.all? { |task| task[:start_time].nil? }
59
- _("waiting for Pulp to start the task")
60
- else
23
+ if combined_tasks.any?(&:started?)
61
24
  _("waiting for Pulp to finish the task")
25
+ else
26
+ _("waiting for Pulp to start the task")
62
27
  end
63
28
  else
64
29
  super
@@ -66,28 +31,49 @@ module Actions
66
31
  end
67
32
 
68
33
  def done?
69
- external_task&.all? { |task| task[:finish_time] || FINISHED_STATES.include?(task[:state]) }
34
+ combined_tasks&.all? { |task| task.done? }
70
35
  end
71
36
 
72
37
  def external_task
73
- output[:pulp_tasks]
38
+ #this must return nil until external_task= is called
39
+ combined_tasks
40
+ end
41
+
42
+ def combined_tasks
43
+ return nil if pulp_tasks.nil? || task_groups.nil?
44
+ pulp_tasks + task_groups
45
+ end
46
+
47
+ def pulp_tasks
48
+ return nil if output[:pulp_tasks].nil?
49
+ output[:pulp_tasks] = new_or_existing_objects(::Katello::Pulp3::Task, output[:pulp_tasks])
50
+ end
51
+
52
+ def task_groups
53
+ return nil if output[:task_groups].nil?
54
+ output[:task_groups] = new_or_existing_objects(::Katello::Pulp3::TaskGroup, output[:task_groups])
55
+ end
56
+
57
+ def new_or_existing_objects(object_class, objects)
58
+ objects.map do |object|
59
+ if object.is_a?(object_class)
60
+ object
61
+ else
62
+ object_class.new(smart_proxy, object)
63
+ end
64
+ end
74
65
  end
75
66
 
76
67
  def cancel!
77
68
  cancel
78
- self.external_task = poll_external_task
69
+ poll_external_task
79
70
  # We suspend the action and the polling will take care of finding
80
71
  # out if the cancelling was successful
81
72
  suspend unless done?
82
73
  end
83
74
 
84
75
  def cancel
85
- output[:pulp_tasks].each do |pulp_task|
86
- data = PulpcoreClient::Task.new(state: 'canceled')
87
- tasks_api.tasks_cancel(pulp_task['pulp_href'], data)
88
- #the main task may have completed, so cancel spawned tasks too
89
- pulp_task['spawned_tasks']&.each { |spawned| tasks_api.tasks_cancel(spawned['pulp_href'], data) }
90
- end
76
+ pulp_tasks.each { |task| task.cancel }
91
77
  end
92
78
 
93
79
  def rescue_external_task(error)
@@ -109,24 +95,42 @@ module Actions
109
95
  response
110
96
  end
111
97
 
98
+ def check_for_errors
99
+ combined_tasks.each do |task|
100
+ if (message = task.error)
101
+ fail ::Katello::Errors::Pulp3Error, message
102
+ end
103
+ end
104
+ end
105
+
112
106
  def external_task=(external_task_data)
113
- output[:pulp_tasks] = transform_task_response(external_task_data)
114
- output[:pulp_tasks].each do |pulp_task|
115
- if (pulp_exception = ::Katello::Errors::Pulp3Error.from_task(pulp_task))
116
- fail pulp_exception
107
+ #currently we assume everything coming from invoke_external_task_methods are tasks
108
+ tasks = transform_task_response(external_task_data)
109
+ output[:pulp_tasks] = new_or_existing_objects(::Katello::Pulp3::Task, tasks)
110
+
111
+ add_task_groups
112
+ check_for_errors
113
+ end
114
+
115
+ def add_task_groups
116
+ output[:task_groups] ||= []
117
+ pulp_tasks.each do |task|
118
+ if task.task_group_href && !tracking_task_group?(task.task_group_href)
119
+ output[:task_groups] << ::Katello::Pulp3::TaskGroup.new_from_href(smart_proxy, task.task_group_href)
117
120
  end
118
121
  end
119
122
  end
120
123
 
121
- def tasks_api
122
- ::Katello::Pulp3::Api::Core.new(smart_proxy).tasks_api
124
+ def tracking_task_group?(href)
125
+ task_groups&.any? { |group| group.href == href }
123
126
  end
124
127
 
125
128
  def poll_external_task
126
- external_task.map do |task|
127
- task = tasks_api.read(task['pulp_href'] || task['task'])
128
- task.as_json
129
- end
129
+ pulp_tasks.each(&:poll)
130
+ output[:task_groups] = task_groups.each(&:poll) if task_groups
131
+ add_task_groups
132
+ check_for_errors
133
+ pulp_tasks
130
134
  end
131
135
  end
132
136
  end
@@ -0,0 +1,17 @@
1
+ module Actions
2
+ module Pulp3
3
+ module CapsuleContent
4
+ class RefreshContentGuard < Pulp3::AbstractAsyncTask
5
+ def plan(smart_proxy, options = {})
6
+ content_guard_api = ::Katello::Pulp3::Api::ContentGuard.new(smart_proxy)
7
+ content_guard_href = content_guard_api.list&.results&.first&.pulp_href
8
+ if content_guard_href && options.try(:[], :update)
9
+ content_guard_api.partial_update content_guard_href
10
+ else
11
+ content_guard_api.create
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -11,7 +11,9 @@ module Actions
11
11
 
12
12
  def invoke_external_task
13
13
  repo = ::Katello::Repository.find(input[:repository_id])
14
- output[:pulp_tasks] = repo.backend_service(smart_proxy).with_mirror_adapter.sync
14
+ sync_options = {}
15
+ sync_options[:optimize] = false if sync_options[:skip_metadata_check]
16
+ output[:pulp_tasks] = repo.backend_service(smart_proxy).with_mirror_adapter.sync(sync_options)
15
17
  end
16
18
 
17
19
  def rescue_strategy_for_self
@@ -12,6 +12,10 @@ module Actions
12
12
  migration_service = ::Katello::Pulp3::Migration.new(smart_proxy)
13
13
  migration_service.create_and_run_migrations
14
14
  end
15
+
16
+ def rescue_strategy
17
+ Dynflow::Action::Rescue::Skip
18
+ end
15
19
  end
16
20
  end
17
21
  end
@@ -16,13 +16,11 @@ module Actions
16
16
  copy_action = plan_action(Actions::Pulp3::Repository::CopyContent, source_repositories.first, smart_proxy, target_repo,
17
17
  filter_ids: filter_ids, solve_dependencies: solve_dependencies,
18
18
  rpm_filenames: rpm_filenames)
19
- plan_action(Actions::Pulp3::Repository::SaveVersion, target_repo,
20
- repository_details: { latest_version_href: copy_action.output[:latest_version_href] }, tasks: copy_action.output[:pulp_tasks])
19
+ plan_action(Actions::Pulp3::Repository::SaveVersion, target_repo, tasks: copy_action.output[:pulp_tasks])
21
20
  else
22
21
  #if we are not filtering, copy the version to the cv repository, and the units for each additional repo
23
22
  action = plan_action(Actions::Pulp3::Repository::CopyVersion, source_repositories.first, smart_proxy, target_repo)
24
- plan_action(Actions::Pulp3::Repository::SaveVersion, target_repo,
25
- repository_details: { latest_version_href: action.output[:latest_version_output] }, tasks: action.output[:pulp_tasks])
23
+ plan_action(Actions::Pulp3::Repository::SaveVersion, target_repo, tasks: action.output[:pulp_tasks])
26
24
  copy_actions = []
27
25
  #since we're creating a new version from the first repo, start copying at the 2nd
28
26
  source_repositories[1..-1].each do |source_repo|
@@ -0,0 +1,36 @@
1
+ module Actions
2
+ module Pulp3
3
+ module Orchestration
4
+ module Repository
5
+ class MultiCopyAllUnits < Pulp3::Abstract
6
+ def plan(extended_repo_map, smart_proxy, options = {})
7
+ solve_dependencies = options.fetch(:solve_dependencies, false)
8
+ if extended_repo_map.values.pluck(:filters).flatten.present? ||
9
+ extended_repo_map.keys.detect { |source_repos| source_repos.length > 1 }
10
+ sequence do
11
+ copy_action = plan_action(Actions::Pulp3::Repository::MultiCopyContent, extended_repo_map, smart_proxy,
12
+ solve_dependencies: solve_dependencies)
13
+ plan_action(Actions::Pulp3::Repository::SaveVersions, extended_repo_map.values.pluck(:dest_repo),
14
+ tasks: copy_action.output[:pulp_tasks])
15
+ end
16
+ else
17
+ repo_id_map = {}
18
+ extended_repo_map.each do |source_repos, dest_repo_map|
19
+ repo_id_map[source_repos.first.id] = dest_repo_map[:dest_repo].id
20
+ end
21
+ plan_self(repo_id_map: repo_id_map)
22
+ end
23
+ end
24
+
25
+ def run
26
+ input[:repo_id_map].each do |source_repo_id, dest_repo_id|
27
+ dest_repo = ::Katello::Repository.find(dest_repo_id)
28
+ source_repo = ::Katello::Repository.find(source_repo_id)
29
+ dest_repo.update!(version_href: source_repo.version_href)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -7,7 +7,9 @@ module Actions
7
7
  def plan(repository, smart_proxy, options)
8
8
  sequence do
9
9
  action_output = plan_action(Actions::Pulp3::Repository::Sync, repository, smart_proxy, options).output
10
- version_output = plan_action(Pulp3::Repository::SaveVersion, repository, tasks: action_output[:pulp_tasks]).output
10
+
11
+ force_fetch_version = true if options[:optimize] == false
12
+ version_output = plan_action(Pulp3::Repository::SaveVersion, repository, tasks: action_output[:pulp_tasks], :force_fetch_version => force_fetch_version).output
11
13
  plan_action(Pulp3::Orchestration::Repository::GenerateMetadata, repository, smart_proxy, :contents_changed => version_output[:contents_changed])
12
14
  plan_self(:subaction_output => version_output)
13
15
  end
@@ -0,0 +1,22 @@
1
+ module Actions
2
+ module Pulp3
3
+ module Orchestration
4
+ module Repository
5
+ class TriggerUpdateRepoCertGuard < Pulp3::Abstract
6
+ def plan(repository, smart_proxy)
7
+ plan_self(:repository_id => repository.id, :smart_proxy_id => smart_proxy.id)
8
+ end
9
+
10
+ def run
11
+ repository = ::Katello::Repository.find(input[:repository_id])
12
+ ForemanTasks.async_task(::Actions::Pulp3::Repository::UpdateCVRepositoryCertGuard, repository, smart_proxy)
13
+ end
14
+
15
+ def humanized_name
16
+ _("Updating repository authentication configuration")
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -11,7 +11,6 @@ module Actions
11
11
  def invoke_external_task
12
12
  source = ::Katello::Repository.find(input[:source_repository_id])
13
13
  target = ::Katello::Repository.find(input[:target_repository_id] || input[:target_repository])
14
- output[:latest_version_href] = target.backend_service(smart_proxy).read.latest_version_href
15
14
  output[:pulp_tasks] = target.backend_service(smart_proxy).copy_content_for_source(source, input)
16
15
  end
17
16
  end
@@ -0,0 +1,28 @@
1
+ module Actions
2
+ module Pulp3
3
+ module Repository
4
+ class MultiCopyContent < Pulp3::AbstractAsyncTask
5
+ def plan(extended_repo_map, smart_proxy, options)
6
+ repo_id_map = {}
7
+
8
+ extended_repo_map.each do |source_repos, dest_repo_map|
9
+ repo_id_map[source_repos&.map(&:id)] = { :dest_repo => dest_repo_map[:dest_repo].id,
10
+ :filter_ids => dest_repo_map[:filters]&.map(&:id) }
11
+ end
12
+
13
+ plan_self(options.merge(:repo_id_map => repo_id_map, :smart_proxy_id => smart_proxy.id))
14
+ end
15
+
16
+ def invoke_external_task
17
+ repo_id_map = {}
18
+
19
+ input[:repo_id_map].each do |source_repo_ids, dest_repo_map|
20
+ repo_id_map[JSON.parse(source_repo_ids)] = dest_repo_map.deep_dup
21
+ end
22
+
23
+ output[:pulp_tasks] = ::Katello::Repository.find(repo_id_map.values.first[:dest_repo]).backend_service(smart_proxy).copy_content_from_mapping(repo_id_map, input)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end