katello 3.16.0.rc5.1 → 3.16.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.
- checksums.yaml +4 -4
- data/app/controllers/katello/api/registry/registry_proxies_controller.rb +39 -23
- data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +1 -1
- data/app/controllers/katello/api/v2/host_tracer_controller.rb +8 -33
- data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +11 -1
- data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +15 -0
- data/app/controllers/katello/api/v2/repositories_controller.rb +10 -1
- data/app/controllers/katello/concerns/hosts_controller_extensions.rb +11 -5
- data/app/helpers/katello/content_view_helper.rb +15 -0
- data/app/lib/actions/katello/applicability/hosts/bulk_generate.rb +6 -2
- data/app/lib/actions/katello/capsule_content/refresh_repos.rb +1 -1
- data/app/lib/actions/katello/capsule_content/sync.rb +3 -2
- data/app/lib/actions/katello/capsule_content/sync_capsule.rb +17 -3
- data/app/lib/actions/katello/content_view/incremental_updates.rb +3 -1
- data/app/lib/actions/katello/content_view/publish.rb +55 -16
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +84 -53
- data/app/lib/actions/katello/product/destroy.rb +25 -4
- data/app/lib/actions/katello/repository/destroy.rb +5 -1
- data/app/lib/actions/katello/repository/multi_clone_contents.rb +64 -0
- data/app/lib/actions/katello/repository/multi_clone_to_version.rb +30 -0
- data/app/lib/actions/katello/repository/sync.rb +35 -25
- data/app/lib/actions/katello/repository/update.rb +11 -16
- data/app/lib/actions/katello/repository/verify_checksum.rb +28 -0
- data/app/lib/actions/pulp/orchestration/repository/sync.rb +2 -1
- data/app/lib/actions/pulp/repository/sync.rb +2 -1
- data/app/lib/actions/pulp3/abstract_async_task.rb +63 -58
- data/app/lib/actions/pulp3/capsule_content/refresh_content_guard.rb +17 -0
- data/app/lib/actions/pulp3/capsule_content/sync.rb +3 -1
- data/app/lib/actions/pulp3/{ContentGuard → content_guard}/refresh.rb +0 -0
- data/app/lib/actions/pulp3/content_migration.rb +4 -0
- data/app/lib/actions/pulp3/content_view/delete_repository_references.rb +1 -1
- data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +2 -4
- data/app/lib/actions/pulp3/orchestration/repository/multi_copy_all_units.rb +36 -0
- data/app/lib/actions/pulp3/orchestration/repository/sync.rb +3 -1
- data/app/lib/actions/pulp3/orchestration/repository/trigger_update_repo_cert_guard.rb +22 -0
- data/app/lib/actions/pulp3/repository/copy_content.rb +0 -1
- data/app/lib/actions/pulp3/repository/delete.rb +1 -1
- data/app/lib/actions/pulp3/repository/multi_copy_content.rb +28 -0
- data/app/lib/actions/pulp3/repository/multi_copy_units.rb +14 -7
- data/app/lib/actions/pulp3/repository/presenters/repair_presenter.rb +85 -0
- data/app/lib/actions/pulp3/repository/repair.rb +29 -0
- data/app/lib/actions/pulp3/repository/save_version.rb +20 -8
- data/app/lib/actions/pulp3/repository/save_versions.rb +47 -13
- data/app/lib/actions/pulp3/repository/sync.rb +1 -1
- data/app/lib/actions/pulp3/repository/update_cv_repository_cert_guard.rb +6 -2
- data/app/lib/actions/pulp3/repository/upload_file.rb +1 -1
- data/app/lib/katello/concerns/base_template_scope_extensions.rb +4 -0
- data/app/lib/katello/errors.rb +1 -15
- data/app/lib/katello/resources/cdn.rb +3 -2
- data/app/lib/katello/util/cdn_var_substitutor.rb +9 -6
- data/app/models/katello/concerns/smart_proxy_extensions.rb +14 -3
- data/app/models/katello/content_view.rb +18 -6
- data/app/models/katello/content_view_erratum_filter.rb +13 -0
- data/app/models/katello/content_view_module_stream_filter.rb +19 -0
- data/app/models/katello/content_view_package_filter.rb +1 -1
- data/app/models/katello/glue/pulp/repo.rb +1 -1
- data/app/models/katello/host/content_facet.rb +1 -0
- data/app/models/katello/module_stream.rb +1 -1
- data/app/models/katello/ping.rb +1 -3
- data/app/models/katello/repository.rb +5 -0
- data/app/models/katello/root_repository.rb +5 -1
- data/app/models/setting/content.rb +1 -1
- data/app/services/cert/certs.rb +10 -2
- data/app/services/katello/host_trace_manager.rb +38 -0
- data/app/services/katello/pulp3/api/core.rb +4 -0
- data/app/services/katello/pulp3/erratum.rb +3 -1
- data/app/services/katello/pulp3/migration.rb +4 -3
- data/app/services/katello/pulp3/migration_plan.rb +6 -6
- data/app/services/katello/pulp3/repository.rb +16 -8
- data/app/services/katello/pulp3/repository/yum.rb +234 -35
- data/app/services/katello/pulp3/repository_mirror.rb +7 -2
- data/app/services/katello/pulp3/smart_proxy_mirror_repository.rb +1 -1
- data/app/services/katello/pulp3/task.rb +100 -0
- data/app/services/katello/pulp3/task_group.rb +85 -0
- data/app/services/katello/smart_proxy_helper.rb +13 -16
- data/config/routes/api/rhsm.rb +1 -0
- data/config/routes/api/v2.rb +2 -6
- data/config/routes/overrides.rb +4 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-traces-modal.controller.js +3 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-bulk-action.factory.js +2 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/product-bulk-action.factory.js +1 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details.controller.js +6 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-details.html +7 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +2 -2
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/repository.factory.js +1 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.controller.js +15 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/views/products.html +6 -0
- data/lib/katello/permission_creator.rb +2 -2
- data/lib/katello/permissions/host_permissions.rb +1 -0
- data/lib/katello/plugin.rb +0 -1
- data/lib/katello/tasks/pulp3_post_migration_check.rake +2 -1
- data/lib/katello/tasks/reimport.rake +1 -1
- data/lib/katello/version.rb +1 -1
- data/webpack/redux/actions/RedHatRepositories/helpers.js +6 -6
- metadata +30 -13
- data/app/lib/actions/katello/repository/update_cv_repo_cert_guard.rb +0 -17
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-traces-resolve.factory.js +0 -18
@@ -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(
|
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
|
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.
|
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
|
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,50 @@ module Actions
|
|
66
31
|
end
|
67
32
|
|
68
33
|
def done?
|
69
|
-
|
34
|
+
combined_tasks&.all? { |task| task.done? }
|
70
35
|
end
|
71
36
|
|
72
37
|
def external_task
|
73
|
-
|
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
|
-
|
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
|
-
|
86
|
-
|
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 }
|
77
|
+
task_groups.each { |task_group| task_group.cancel }
|
91
78
|
end
|
92
79
|
|
93
80
|
def rescue_external_task(error)
|
@@ -109,24 +96,42 @@ module Actions
|
|
109
96
|
response
|
110
97
|
end
|
111
98
|
|
99
|
+
def check_for_errors
|
100
|
+
combined_tasks.each do |task|
|
101
|
+
if (message = task.error)
|
102
|
+
fail ::Katello::Errors::Pulp3Error, message
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
112
107
|
def external_task=(external_task_data)
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
108
|
+
#currently we assume everything coming from invoke_external_task_methods are tasks
|
109
|
+
tasks = transform_task_response(external_task_data)
|
110
|
+
output[:pulp_tasks] = new_or_existing_objects(::Katello::Pulp3::Task, tasks)
|
111
|
+
|
112
|
+
add_task_groups
|
113
|
+
check_for_errors
|
114
|
+
end
|
115
|
+
|
116
|
+
def add_task_groups
|
117
|
+
output[:task_groups] ||= []
|
118
|
+
pulp_tasks.each do |task|
|
119
|
+
if task.task_group_href && !tracking_task_group?(task.task_group_href)
|
120
|
+
output[:task_groups] << ::Katello::Pulp3::TaskGroup.new_from_href(smart_proxy, task.task_group_href)
|
117
121
|
end
|
118
122
|
end
|
119
123
|
end
|
120
124
|
|
121
|
-
def
|
122
|
-
|
125
|
+
def tracking_task_group?(href)
|
126
|
+
task_groups&.any? { |group| group.href == href }
|
123
127
|
end
|
124
128
|
|
125
129
|
def poll_external_task
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
+
pulp_tasks.each(&:poll)
|
131
|
+
output[:task_groups] = task_groups.each(&:poll) if task_groups
|
132
|
+
add_task_groups
|
133
|
+
check_for_errors
|
134
|
+
pulp_tasks
|
130
135
|
end
|
131
136
|
end
|
132
137
|
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
|
-
|
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
|
File without changes
|
@@ -14,7 +14,7 @@ module Actions
|
|
14
14
|
content_view.repository_references.each do |repository_reference|
|
15
15
|
repo = repository_reference.root_repository.library_instance
|
16
16
|
#force pulp3 in case we've done migrations, but haven't switched over yet
|
17
|
-
tasks << repo.backend_service(smart_proxy, true).
|
17
|
+
tasks << repo.backend_service(smart_proxy, true).delete_repository(repository_reference)
|
18
18
|
end
|
19
19
|
content_view.repository_references.destroy_all
|
20
20
|
|
@@ -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
|
-
|
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
|
@@ -3,7 +3,7 @@ module Actions
|
|
3
3
|
module Repository
|
4
4
|
class MultiCopyUnits < Pulp3::AbstractAsyncTask
|
5
5
|
# repo_map example: {
|
6
|
-
# <
|
6
|
+
# [<source_repo_ids>]: {
|
7
7
|
# dest_repo: <dest_repo_id>,
|
8
8
|
# base_version: <base_version>
|
9
9
|
# }
|
@@ -22,7 +22,11 @@ module Actions
|
|
22
22
|
|
23
23
|
def invoke_external_task
|
24
24
|
unit_hrefs = []
|
25
|
-
repo_map =
|
25
|
+
repo_map = {}
|
26
|
+
|
27
|
+
input[:repo_map].each do |source_repo_ids, dest_repo_map|
|
28
|
+
repo_map[JSON.parse(source_repo_ids)] = dest_repo_map
|
29
|
+
end
|
26
30
|
|
27
31
|
if input[:unit_map][:errata].any?
|
28
32
|
unit_hrefs << ::Katello::RepositoryErratum.
|
@@ -34,13 +38,16 @@ module Actions
|
|
34
38
|
if input[:unit_map][:rpms].any?
|
35
39
|
unit_hrefs << ::Katello::Rpm.where(:id => input[:unit_map][:rpms]).map(&:pulp_id)
|
36
40
|
end
|
41
|
+
unit_hrefs.flatten!
|
42
|
+
|
43
|
+
repo_map.each do |_source_repos, dest_repo_map|
|
44
|
+
dest_repo_map[:content_unit_hrefs] = unit_hrefs
|
45
|
+
end
|
37
46
|
|
38
|
-
# TODO: Fix this workaround by refactoring copy_units after general content view dep solving is refactored
|
39
|
-
source_repo = ::Katello::Repository.find(repo_map.keys.first)
|
40
47
|
target_repo = ::Katello::Repository.find(repo_map.values.first[:dest_repo])
|
41
|
-
|
42
|
-
|
43
|
-
|
48
|
+
unless unit_hrefs.flatten.empty?
|
49
|
+
output[:pulp_tasks] = target_repo.backend_service(SmartProxy.pulp_master).multi_copy_units(repo_map, input[:dependency_solving])
|
50
|
+
end
|
44
51
|
end
|
45
52
|
end
|
46
53
|
end
|