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.
- 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/content_view_filters_controller.rb +5 -1
- data/app/controllers/katello/api/v2/host_tracer_controller.rb +0 -5
- 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/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/host/attach_subscriptions.rb +5 -1
- 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 +62 -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/katello/sync_plan/run.rb +1 -1
- 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 +62 -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/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/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/content_unit_presenter.rb +1 -1
- 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_filter.rb +4 -0
- data/app/models/katello/content_view_module_stream_filter.rb +30 -3
- data/app/models/katello/content_view_package_filter.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 +16 -0
- data/app/models/setting/content.rb +1 -1
- data/app/presenters/katello/sync_status_presenter.rb +4 -2
- data/app/services/cert/certs.rb +10 -2
- data/app/services/katello/pulp/repository/yum.rb +2 -1
- 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 +10 -5
- data/app/services/katello/pulp3/migration_plan.rb +6 -6
- data/app/services/katello/pulp3/repository.rb +13 -5
- data/app/services/katello/pulp3/repository/yum.rb +235 -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 +79 -0
- data/app/services/katello/smart_proxy_helper.rb +13 -16
- data/app/views/katello/api/v2/content_view_filters/base.json.rabl +4 -0
- data/config/routes/api/rhsm.rb +1 -0
- data/config/routes/api/v2.rb +2 -0
- data/db/migrate/20200709021250_add_original_modules_to_content_view_module_stream_filter.rb +5 -0
- data/db/migrate/20200721142707_remove_duplicate_katello_pools_index.rb +5 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.routes.js +1 -13
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/filter-details.controller.js +17 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/module-stream-filter-details.html +17 -0
- 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/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/plugin.rb +0 -1
- data/lib/katello/tasks/pulp3_post_migration_check.rake +2 -1
- data/lib/katello/tasks/reports.rake +16 -0
- data/lib/katello/version.rb +1 -1
- data/webpack/redux/actions/RedHatRepositories/helpers.js +6 -6
- metadata +34 -14
- data/app/lib/actions/katello/repository/update_cv_repo_cert_guard.rb +0 -17
@@ -1,7 +1,9 @@
|
|
1
1
|
module Actions
|
2
2
|
module Katello
|
3
3
|
module ContentViewVersion
|
4
|
+
# rubocop:disable Metrics/ClassLength
|
4
5
|
class IncrementalUpdate < Actions::EntryAction
|
6
|
+
include ::Katello::ContentViewHelper
|
5
7
|
attr_accessor :new_content_view_version
|
6
8
|
|
7
9
|
HUMANIZED_TYPES = {
|
@@ -30,6 +32,19 @@ module Actions
|
|
30
32
|
validate_environments(environments, old_version)
|
31
33
|
|
32
34
|
new_minor = old_version.content_view.versions.where(:major => old_version.major).maximum(:minor) + 1
|
35
|
+
if SmartProxy.pulp_master.pulp3_repository_type_support?("yum") && is_composite
|
36
|
+
sequence do
|
37
|
+
publish_action = plan_action(::Actions::Katello::ContentView::Publish, old_version.content_view, description,
|
38
|
+
:major => old_version.major, :minor => new_minor,
|
39
|
+
:override_components => new_components, :skip_promotion => true)
|
40
|
+
if old_version.environments.present?
|
41
|
+
plan_action(::Actions::Katello::ContentView::Promote, publish_action.version,
|
42
|
+
old_version.environments, true, description)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
return
|
46
|
+
end
|
47
|
+
|
33
48
|
self.new_content_view_version = old_version.content_view.create_new_version(old_version.major, new_minor, all_components)
|
34
49
|
history = ::Katello::ContentViewHistory.create!(:content_view_version => new_content_view_version, :user => ::User.current.login,
|
35
50
|
:action => ::Katello::ContentViewHistory.actions[:publish],
|
@@ -41,6 +56,7 @@ module Actions
|
|
41
56
|
|
42
57
|
sequence do
|
43
58
|
repository_mapping = plan_action(ContentViewVersion::CreateRepos, new_content_view_version, repos_to_clone).repository_mapping
|
59
|
+
separated_repo_map = separated_repo_mapping(repository_mapping)
|
44
60
|
|
45
61
|
repos_to_clone.each do |source_repos|
|
46
62
|
plan_action(Repository::CloneToVersion,
|
@@ -51,18 +67,24 @@ module Actions
|
|
51
67
|
end
|
52
68
|
|
53
69
|
concurrence do
|
54
|
-
if
|
55
|
-
extended_repo_mapping = pulp3_repo_mapping(
|
70
|
+
if separated_repo_map[:pulp3_yum].keys.flatten.present?
|
71
|
+
extended_repo_mapping = pulp3_repo_mapping(separated_repo_map[:pulp3_yum], old_version)
|
56
72
|
unit_map = pulp3_content_mapping(content)
|
57
73
|
|
58
|
-
|
59
|
-
|
60
|
-
|
74
|
+
unless extended_repo_mapping.empty? || unit_map.values.flatten.empty?
|
75
|
+
copy_action_outputs << plan_action(Pulp3::Repository::MultiCopyUnits, extended_repo_mapping, unit_map,
|
76
|
+
dependency_solving: true).output
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
if separated_repo_map[:other].keys.flatten.present?
|
61
81
|
repos_to_clone.each do |source_repos|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
82
|
+
if separated_repo_map[:other].keys.include?(source_repos)
|
83
|
+
copy_action_outputs += copy_repos(repository_mapping[source_repos],
|
84
|
+
new_content_view_version,
|
85
|
+
content,
|
86
|
+
dep_solve)
|
87
|
+
end
|
66
88
|
end
|
67
89
|
end
|
68
90
|
|
@@ -98,11 +120,21 @@ module Actions
|
|
98
120
|
|
99
121
|
def pulp3_repo_mapping(repo_mapping, old_version)
|
100
122
|
pulp3_repo_mapping = {}
|
101
|
-
repo_mapping.each do |
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
123
|
+
repo_mapping.each do |source_repos, dest_repo|
|
124
|
+
old_version_repo = old_version.repositories.archived.find_by(root_id: dest_repo.root_id)
|
125
|
+
|
126
|
+
next if old_version_repo.version_href == old_version_repo.library_instance.version_href
|
127
|
+
|
128
|
+
source_library_repo = source_repos.first.library_instance? ? source_repos.first : source_repos.first.library_instance
|
129
|
+
|
130
|
+
source_repos = [source_library_repo]
|
131
|
+
if old_version_repo.version_href
|
132
|
+
base_version = old_version_repo.version_href.split("/")[-1].to_i
|
133
|
+
else
|
134
|
+
base_version = 0
|
135
|
+
end
|
136
|
+
|
137
|
+
pulp3_repo_mapping[source_repos.map(&:id)] = { dest_repo: dest_repo.id, base_version: base_version }
|
106
138
|
end
|
107
139
|
pulp3_repo_mapping
|
108
140
|
end
|
@@ -179,42 +211,44 @@ module Actions
|
|
179
211
|
base_repos = ::Katello::ContentViewVersion.find(input[:old_version]).repositories
|
180
212
|
new_repos = ::Katello::ContentViewVersion.find(input[:new_content_view_version_id]).repositories
|
181
213
|
|
182
|
-
if input[:copy_action_outputs].
|
183
|
-
|
184
|
-
|
214
|
+
if input[:copy_action_outputs].present? && input[:copy_action_outputs].last[:pulp_tasks].present?
|
215
|
+
if input[:copy_action_outputs].last[:pulp_tasks].last[:pulp_href]&.include?("/pulp/api/v3/")
|
216
|
+
new_repos.each do |new_repo|
|
217
|
+
matched_old_repo = base_repos.where(root_id: new_repo.root_id).first
|
185
218
|
|
186
|
-
|
187
|
-
|
188
|
-
|
219
|
+
new_errata = new_repo.errata - matched_old_repo.errata
|
220
|
+
new_module_streams = new_repo.module_streams - matched_old_repo.module_streams
|
221
|
+
new_rpms = new_repo.rpms - matched_old_repo.rpms
|
189
222
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
223
|
+
new_errata.each do |erratum|
|
224
|
+
content[::Katello::Erratum::CONTENT_TYPE] << erratum.errata_id
|
225
|
+
end
|
226
|
+
new_module_streams.each do |module_stream|
|
227
|
+
content[::Katello::ModuleStream::CONTENT_TYPE] <<
|
228
|
+
"#{module_stream.name}:#{module_stream.stream}:#{module_stream.version}"
|
229
|
+
end
|
230
|
+
new_rpms.each do |rpm|
|
231
|
+
content[::Katello::Rpm::CONTENT_TYPE] << rpm.nvra
|
232
|
+
end
|
199
233
|
end
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
234
|
+
else
|
235
|
+
input[:copy_action_outputs].each do |copy_output|
|
236
|
+
copy_output[:pulp_tasks].each do |pulp_task|
|
237
|
+
pulp_task[:result][:units_successful].each do |unit|
|
238
|
+
type = unit['type_id']
|
239
|
+
unit = unit['unit_key']
|
240
|
+
case type
|
241
|
+
when ::Katello::Erratum::CONTENT_TYPE
|
242
|
+
content[::Katello::Erratum::CONTENT_TYPE] << unit['id']
|
243
|
+
when ::Katello::ModuleStream::CONTENT_TYPE
|
244
|
+
content[::Katello::ModuleStream::CONTENT_TYPE] << "#{unit['name']}:#{unit['stream']}:#{unit['version']}"
|
245
|
+
when ::Katello::Rpm::CONTENT_TYPE
|
246
|
+
content[::Katello::Rpm::CONTENT_TYPE] << ::Katello::Util::Package.build_nvra(unit)
|
247
|
+
when ::Katello::Deb::CONTENT_TYPE
|
248
|
+
content[::Katello::Deb::CONTENT_TYPE] << "#{unit['name']}_#{unit['version']}_#{unit['architecture']}"
|
249
|
+
when ::Katello::PuppetModule::CONTENT_TYPE
|
250
|
+
content[::Katello::PuppetModule::CONTENT_TYPE] << "#{unit['author']}-#{unit['name']}-#{unit['version']}"
|
251
|
+
end
|
218
252
|
end
|
219
253
|
end
|
220
254
|
end
|
@@ -232,8 +266,9 @@ module Actions
|
|
232
266
|
history.status = ::Katello::ContentViewHistory::SUCCESSFUL
|
233
267
|
history.save!
|
234
268
|
|
235
|
-
|
236
|
-
|
269
|
+
cvv_yum_repos = version.repositories.yum_type
|
270
|
+
unless cvv_yum_repos.empty? || SmartProxy.pulp_master.pulp3_support?(cvv_yum_repos.first)
|
271
|
+
cvv_yum_repos.each do |repo|
|
237
272
|
SmartProxy.pulp_master.pulp_api.extensions.send(:module_default).
|
238
273
|
copy(repo.library_instance.pulp_id,
|
239
274
|
repo.pulp_id)
|
@@ -315,10 +350,6 @@ module Actions
|
|
315
350
|
copy_outputs
|
316
351
|
end
|
317
352
|
|
318
|
-
def pulp3_dest_base_version(old_cvv, new_repo)
|
319
|
-
old_cvv.repositories.archived.find_by(root_id: new_repo.root_id).version_href.split("/")[-1].to_i
|
320
|
-
end
|
321
|
-
|
322
353
|
def copy_yum_content(new_repo, dep_solve, package_ids, errata_ids)
|
323
354
|
copy_outputs = []
|
324
355
|
if new_repo.content_type == ::Katello::Repository::YUM_TYPE
|
@@ -8,12 +8,16 @@ module Actions
|
|
8
8
|
|
9
9
|
def plan(host, pools_with_quantities_params)
|
10
10
|
action_subject(host)
|
11
|
+
|
12
|
+
subscription_facet = host.subscription_facet
|
13
|
+
fail _("Register host '%s' before attaching subscriptions") % host.name unless subscription_facet
|
14
|
+
|
11
15
|
sequence do
|
12
16
|
pool_ids = []
|
13
17
|
pools_with_quantities = pools_with_quantities_params.map do |pool_with_quantity|
|
14
18
|
::Katello::PoolWithQuantities.fetch(pool_with_quantity)
|
15
19
|
end
|
16
|
-
existing_pool_ids =
|
20
|
+
existing_pool_ids = subscription_facet.candlepin_consumer.pool_ids
|
17
21
|
pools_with_quantities.each do |pool_with_quantities|
|
18
22
|
unless existing_pool_ids.include?(pool_with_quantities.pool.cp_id.to_s)
|
19
23
|
pool_ids << pool_with_quantities.pool.id
|
@@ -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
|
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
|
-
|
34
|
+
if destroy_content && !skip_environment_update
|
35
|
+
handle_custom_content(repository)
|
36
|
+
end
|
33
37
|
end
|
34
38
|
end
|
35
39
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Actions
|
2
|
+
module Katello
|
3
|
+
module Repository
|
4
|
+
class MultiCloneContents < Actions::Base
|
5
|
+
include Actions::Katello::PulpSelector
|
6
|
+
def plan(extended_repo_mapping, options)
|
7
|
+
generate_metadata = options.fetch(:generate_metadata, true)
|
8
|
+
copy_contents = options.fetch(:copy_contents, true)
|
9
|
+
solve_dependencies = options.fetch(:solve_dependencies, false)
|
10
|
+
|
11
|
+
sequence do
|
12
|
+
if copy_contents
|
13
|
+
plan_action(Pulp3::Orchestration::Repository::MultiCopyAllUnits,
|
14
|
+
extended_repo_mapping,
|
15
|
+
SmartProxy.pulp_master,
|
16
|
+
solve_dependencies: solve_dependencies)
|
17
|
+
end
|
18
|
+
|
19
|
+
extended_repo_mapping.each do |source_repos, dest_repo_map|
|
20
|
+
if generate_metadata
|
21
|
+
metadata_generate(source_repos, dest_repo_map[:dest_repo], dest_repo_map[:filters])
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
extended_repo_mapping.values.each do |dest_repo_map|
|
26
|
+
plan_action(Katello::Repository::IndexContent, id: dest_repo_map[:dest_repo].id)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def metadata_generate(source_repositories, new_repository, filters)
|
32
|
+
metadata_options = {}
|
33
|
+
|
34
|
+
if source_repositories.count == 1 && filters.empty?
|
35
|
+
metadata_options[:source_repository] = source_repositories.first
|
36
|
+
end
|
37
|
+
|
38
|
+
check_matching_content = ::Katello::RepositoryTypeManager.find(new_repository.content_type).metadata_publish_matching_check
|
39
|
+
if new_repository.environment && source_repositories.count == 1 && check_matching_content
|
40
|
+
match_check_output = plan_action(Katello::Repository::CheckMatchingContent,
|
41
|
+
:source_repo_id => source_repositories.first.id,
|
42
|
+
:target_repo_id => new_repository.id).output
|
43
|
+
|
44
|
+
metadata_options[:matching_content] = match_check_output[:matching_content]
|
45
|
+
end
|
46
|
+
|
47
|
+
plan_action(Katello::Repository::MetadataGenerate, new_repository, metadata_options)
|
48
|
+
unless source_repositories.first.saved_checksum_type == new_repository.saved_checksum_type
|
49
|
+
plan_self(:source_checksum_type => source_repositories.first.saved_checksum_type,
|
50
|
+
:target_repo_id => new_repository.id)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def finalize
|
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)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Actions
|
2
|
+
module Katello
|
3
|
+
module Repository
|
4
|
+
class MultiCloneToVersion < Actions::Base
|
5
|
+
def plan(repository_mapping, content_view_version, options = {})
|
6
|
+
incremental = options.fetch(:incremental, false)
|
7
|
+
content_view = content_view_version.content_view
|
8
|
+
extended_repo_map = extended_repo_mapping(repository_mapping, content_view, incremental)
|
9
|
+
sequence do
|
10
|
+
plan_action(::Actions::Katello::Repository::MultiCloneContents, extended_repo_map,
|
11
|
+
copy_contents: true,
|
12
|
+
solve_dependencies: content_view.solve_dependencies,
|
13
|
+
metadata_generate: !incremental)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def extended_repo_mapping(repo_map, content_view, incremental)
|
18
|
+
# Example: {[source_repos] => {dest_repo: dest_repo, filters: filters}}
|
19
|
+
extended_repo_map = {}
|
20
|
+
repo_map.each do |source_repos, dest_repo|
|
21
|
+
filters = incremental ? [] : content_view.filters.applicable(source_repos.first)
|
22
|
+
extended_repo_map[source_repos] = { :dest_repo => dest_repo,
|
23
|
+
:filters => filters }
|
24
|
+
end
|
25
|
+
extended_repo_map
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
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
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
plan_action(
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
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
|
|