katello 3.16.0.rc4 → 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.
- 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 +3 -3
- data/app/controllers/katello/api/v2/api_controller.rb +1 -0
- data/app/controllers/katello/api/v2/content_view_filters_controller.rb +5 -1
- data/app/controllers/katello/api/v2/content_view_versions_controller.rb +3 -0
- data/app/controllers/katello/api/v2/content_views_controller.rb +7 -0
- 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/api/v2/associations_permission_check.rb +67 -0
- 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 +5 -1
- data/app/lib/actions/katello/capsule_content/sync.rb +3 -6
- data/app/lib/actions/katello/capsule_content/sync_capsule.rb +31 -17
- data/app/lib/actions/katello/content_view/incremental_updates.rb +8 -1
- data/app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb +2 -1
- data/app/lib/actions/katello/content_view/publish.rb +55 -16
- data/app/lib/actions/katello/content_view_version/incremental_update.rb +120 -26
- 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/abstract_async_task.rb +1 -0
- data/app/lib/actions/pulp/consumer/sync_capsule.rb +8 -0
- data/app/lib/actions/pulp/orchestration/repository/sync.rb +2 -1
- data/app/lib/actions/pulp/repository/presenters/deb_presenter.rb +2 -2
- 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 +55 -0
- 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 +73 -0
- 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 -14
- 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/glue/pulp/repo.rb +1 -0
- data/app/models/katello/host/content_facet.rb +11 -5
- 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 +3 -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 +9 -4
- 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 +246 -25
- 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/errata/errata.routes.js +1 -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/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/engines/bastion_katello/app/assets/stylesheets/bastion_katello/bastion_katello.scss +4 -0
- data/lib/katello/engine.rb +0 -1
- data/lib/katello/permission_creator.rb +2 -2
- data/lib/katello/plugin.rb +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 +37 -14
- data/app/lib/actions/katello/repository/update_cv_repo_cert_guard.rb +0 -17
@@ -52,7 +52,9 @@ module Actions
|
|
52
52
|
action = plan_action(ContentViewVersion::IncrementalUpdate, composite_version, environments,
|
53
53
|
:new_components => new_components, :description => description,
|
54
54
|
:content => {:puppet_module_ids => puppet_module_ids})
|
55
|
-
|
55
|
+
unless SmartProxy.pulp_master.pulp3_repository_type_support?("yum")
|
56
|
+
output_for_version_ids << {:version_id => action.new_content_view_version.id, :output => action.output}
|
57
|
+
end
|
56
58
|
end
|
57
59
|
end
|
58
60
|
end
|
@@ -80,6 +82,7 @@ module Actions
|
|
80
82
|
added_units = version_output.try(:[], :output).try(:[], :added_units)
|
81
83
|
if added_units
|
82
84
|
total_count[:errata_count] = added_units[:erratum].try(:count)
|
85
|
+
total_count[:modulemd_count] = added_units[:modulemd].try(:count)
|
83
86
|
total_count[:rpm_count] = added_units[:rpm].try(:count)
|
84
87
|
total_count[:puppet_module_count] = added_units[:puppet_module].try(:count)
|
85
88
|
end
|
@@ -117,6 +120,10 @@ module Actions
|
|
117
120
|
errata = _(" %{errata_count} Errata" % {:errata_count => total_count[:errata_count]})
|
118
121
|
content << errata
|
119
122
|
end
|
123
|
+
if total_count[:modulemd_count] && total_count[:modulemd_count] > 0
|
124
|
+
modulemd = _(" %{modulemd_count} Module Stream(s)" % {:modulemd_count => total_count[:modulemd_count]})
|
125
|
+
content << modulemd
|
126
|
+
end
|
120
127
|
if total_count[:rpm_count] && total_count[:rpm_count] > 0
|
121
128
|
rpm = _(" %{package_count} Package(s)" % {:package_count => total_count[:rpm_count]})
|
122
129
|
content << rpm
|
@@ -5,6 +5,7 @@ module Actions
|
|
5
5
|
class IncrementalUpdatesPresenter < Helpers::Presenter::Base
|
6
6
|
HUMANIZED_TYPES = {
|
7
7
|
::Katello::Erratum::CONTENT_TYPE => "Errata",
|
8
|
+
::Katello::ModuleStream::CONTENT_TYPE => "Module Streams",
|
8
9
|
::Katello::Rpm::CONTENT_TYPE => "Packages",
|
9
10
|
::Katello::PuppetModule::CONTENT_TYPE => "Puppet Modules"
|
10
11
|
}.freeze
|
@@ -25,7 +26,7 @@ module Actions
|
|
25
26
|
if cvv
|
26
27
|
humanized_lines << "Content View: #{cvv.content_view.name} version #{cvv.version}"
|
27
28
|
humanized_lines << _("Added Content:")
|
28
|
-
[::Katello::Erratum, ::Katello::Rpm, ::Katello::PuppetModule].each do |content_type|
|
29
|
+
[::Katello::Erratum, ::Katello::ModuleStream, ::Katello::Rpm, ::Katello::PuppetModule].each do |content_type|
|
29
30
|
unless output[:added_units][content_type::CONTENT_TYPE].blank?
|
30
31
|
humanized_lines << " #{HUMANIZED_TYPES[content_type::CONTENT_TYPE]}:"
|
31
32
|
humanized_lines += output[:added_units][content_type::CONTENT_TYPE].sort.map { |unit| " #{unit}" }
|
@@ -3,6 +3,8 @@ module Actions
|
|
3
3
|
module Katello
|
4
4
|
module ContentView
|
5
5
|
class Publish < Actions::EntryAction
|
6
|
+
include ::Katello::ContentViewHelper
|
7
|
+
attr_accessor :version
|
6
8
|
# rubocop:disable Metrics/MethodLength,Metrics/AbcSize
|
7
9
|
def plan(content_view, description = "", options = {})
|
8
10
|
action_subject(content_view)
|
@@ -21,7 +23,11 @@ module Actions
|
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
26
|
+
# Add non-override components back in
|
27
|
+
options[:override_components] = include_other_components(options[:override_components], content_view)
|
28
|
+
|
24
29
|
version = version_for_publish(content_view, options)
|
30
|
+
self.version = version
|
25
31
|
library = content_view.organization.library
|
26
32
|
history = ::Katello::ContentViewHistory.create!(:content_view_version => version,
|
27
33
|
:user => ::User.current.login,
|
@@ -32,20 +38,30 @@ module Actions
|
|
32
38
|
:triggered_by => options[:triggered_by]
|
33
39
|
)
|
34
40
|
source_repositories = []
|
35
|
-
content_view.publish_repositories do |repositories|
|
41
|
+
content_view.publish_repositories(options[:override_cvvs]) do |repositories|
|
36
42
|
source_repositories += [repositories]
|
37
43
|
end
|
38
44
|
|
39
45
|
sequence do
|
40
|
-
plan_action(ContentView::AddToEnvironment, version, library)
|
46
|
+
plan_action(ContentView::AddToEnvironment, version, library) unless options[:skip_promotion]
|
41
47
|
repository_mapping = plan_action(ContentViewVersion::CreateRepos, version, source_repositories).repository_mapping
|
42
48
|
|
49
|
+
# Split Pulp 3 Yum repos out of the repository_mapping. Only Pulp 3 RPM plugin has multi repo copy support.
|
50
|
+
separated_repo_map = separated_repo_mapping(repository_mapping)
|
51
|
+
|
52
|
+
if separated_repo_map[:pulp3_yum].keys.flatten.present? &&
|
53
|
+
SmartProxy.pulp_master.pulp3_support?(separated_repo_map[:pulp3_yum].keys.flatten.first)
|
54
|
+
plan_action(Repository::MultiCloneToVersion, separated_repo_map[:pulp3_yum], version)
|
55
|
+
end
|
56
|
+
|
43
57
|
concurrence do
|
44
58
|
source_repositories.each do |repositories|
|
45
59
|
sequence do
|
46
|
-
|
47
|
-
|
48
|
-
|
60
|
+
if repositories.present? && separated_repo_map[:other].keys.include?(repositories)
|
61
|
+
plan_action(Repository::CloneToVersion, repositories, version, repository_mapping[repositories],
|
62
|
+
:repos_units => options[:repos_units])
|
63
|
+
end
|
64
|
+
plan_action(Repository::CloneToEnvironment, repository_mapping[repositories], library) unless options[:skip_promotion]
|
49
65
|
end
|
50
66
|
end
|
51
67
|
|
@@ -55,16 +71,18 @@ module Actions
|
|
55
71
|
end
|
56
72
|
has_modules = content_view.publish_puppet_environment?
|
57
73
|
plan_action(ContentViewPuppetEnvironment::CreateForVersion, version)
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
plan_action(
|
74
|
+
unless options[:skip_promotion]
|
75
|
+
plan_action(ContentViewPuppetEnvironment::Clone, version, :environment => library,
|
76
|
+
:puppet_modules_present => has_modules)
|
77
|
+
end
|
78
|
+
plan_action(Candlepin::Environment::SetContent, content_view, library, content_view.content_view_environment(library)) unless options[:skip_promotion]
|
79
|
+
plan_action(Katello::Foreman::ContentUpdate, library, content_view) unless options[:skip_promotion]
|
80
|
+
plan_action(ContentView::ErrataMail, content_view, library) unless options[:skip_promotion]
|
63
81
|
plan_self(history_id: history.id, content_view_id: content_view.id,
|
64
82
|
auto_publish_composite_ids: auto_publish_composite_ids(content_view),
|
65
83
|
content_view_version_name: version.name,
|
66
84
|
content_view_version_id: version.id,
|
67
|
-
environment_id: library.id, user_id: ::User.current.id)
|
85
|
+
environment_id: library.id, user_id: ::User.current.id, skip_promotion: options[:skip_promotion])
|
68
86
|
end
|
69
87
|
end
|
70
88
|
|
@@ -85,6 +103,7 @@ module Actions
|
|
85
103
|
|
86
104
|
output[:content_view_id] = input[:content_view_id]
|
87
105
|
output[:content_view_version_id] = input[:content_view_version_id]
|
106
|
+
output[:skip_promotion] = input[:skip_promotion]
|
88
107
|
end
|
89
108
|
|
90
109
|
def rescue_strategy_for_self
|
@@ -95,9 +114,11 @@ module Actions
|
|
95
114
|
version = ::Katello::ContentViewVersion.find(input[:content_view_version_id])
|
96
115
|
version.update_content_counts!
|
97
116
|
# update errata applicability counts for all hosts in the CV & Library
|
98
|
-
|
99
|
-
|
100
|
-
|
117
|
+
unless input[:skip_promotion]
|
118
|
+
::Katello::Host::ContentFacet.where(:content_view_id => input[:content_view_id],
|
119
|
+
:lifecycle_environment_id => input[:environment_id]).each do |facet|
|
120
|
+
facet.update_applicability_counts
|
121
|
+
end
|
101
122
|
end
|
102
123
|
|
103
124
|
history = ::Katello::ContentViewHistory.find(input[:history_id])
|
@@ -105,7 +126,7 @@ module Actions
|
|
105
126
|
history.save!
|
106
127
|
environment = ::Katello::KTEnvironment.find(input[:environment_id])
|
107
128
|
view = ::Katello::ContentView.find(input[:content_view_id])
|
108
|
-
if SmartProxy.sync_needed?(environment) && Setting[:foreman_proxy_content_auto_sync]
|
129
|
+
if SmartProxy.sync_needed?(environment) && Setting[:foreman_proxy_content_auto_sync] && !input[:skip_promotion]
|
109
130
|
ForemanTasks.async_task(ContentView::CapsuleSync,
|
110
131
|
view,
|
111
132
|
environment)
|
@@ -115,6 +136,20 @@ module Actions
|
|
115
136
|
|
116
137
|
private
|
117
138
|
|
139
|
+
def include_other_components(override_components, content_view)
|
140
|
+
if override_components.present?
|
141
|
+
content_view.components.each do |component|
|
142
|
+
component_has_override = override_components.detect do |override_component|
|
143
|
+
component.content_view_id == override_component.content_view_id
|
144
|
+
end
|
145
|
+
unless component_has_override
|
146
|
+
override_components << component
|
147
|
+
end
|
148
|
+
end
|
149
|
+
override_components
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
118
153
|
def repos_to_delete(content_view)
|
119
154
|
if content_view.composite?
|
120
155
|
library_instances = content_view.repositories_to_publish.map(&:library_instance_id)
|
@@ -132,7 +167,11 @@ module Actions
|
|
132
167
|
|
133
168
|
def version_for_publish(content_view, options)
|
134
169
|
if options[:minor] && options[:major]
|
135
|
-
|
170
|
+
if options[:override_components]
|
171
|
+
content_view.create_new_version(options[:major], options[:minor], options[:override_components])
|
172
|
+
else
|
173
|
+
content_view.create_new_version(options[:major], options[:minor])
|
174
|
+
end
|
136
175
|
else
|
137
176
|
content_view.create_new_version
|
138
177
|
end
|
@@ -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,11 +67,25 @@ module Actions
|
|
51
67
|
end
|
52
68
|
|
53
69
|
concurrence do
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
70
|
+
if separated_repo_map[:pulp3_yum].keys.flatten.present?
|
71
|
+
extended_repo_mapping = pulp3_repo_mapping(separated_repo_map[:pulp3_yum], old_version)
|
72
|
+
unit_map = pulp3_content_mapping(content)
|
73
|
+
|
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?
|
81
|
+
repos_to_clone.each do |source_repos|
|
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
|
88
|
+
end
|
59
89
|
end
|
60
90
|
|
61
91
|
sequence do
|
@@ -68,11 +98,47 @@ module Actions
|
|
68
98
|
plan_self(:content_view_id => old_version.content_view.id,
|
69
99
|
:new_content_view_version_id => self.new_content_view_version.id,
|
70
100
|
:environment_ids => environments.map(&:id), :user_id => ::User.current.id,
|
71
|
-
:history_id => history.id, :copy_action_outputs => copy_action_outputs
|
101
|
+
:history_id => history.id, :copy_action_outputs => copy_action_outputs,
|
102
|
+
:old_version => old_version.id)
|
72
103
|
promote(new_content_view_version, environments)
|
73
104
|
end
|
74
105
|
end
|
75
106
|
|
107
|
+
def pulp3_content_mapping(content)
|
108
|
+
units = ::Katello::Erratum.with_identifiers(content[:errata_ids]) +
|
109
|
+
::Katello::Rpm.with_identifiers(content[:package_ids])
|
110
|
+
unit_map = { :errata => [], :rpms => [] }
|
111
|
+
units.each do |unit|
|
112
|
+
if unit.class.name == "Katello::Erratum"
|
113
|
+
unit_map[:errata] << unit.id
|
114
|
+
elsif unit.class.name == "Katello::Rpm"
|
115
|
+
unit_map[:rpms] << unit.id
|
116
|
+
end
|
117
|
+
end
|
118
|
+
unit_map
|
119
|
+
end
|
120
|
+
|
121
|
+
def pulp3_repo_mapping(repo_mapping, old_version)
|
122
|
+
pulp3_repo_mapping = {}
|
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 }
|
138
|
+
end
|
139
|
+
pulp3_repo_mapping
|
140
|
+
end
|
141
|
+
|
76
142
|
def repos_to_copy(old_version, new_components)
|
77
143
|
old_version.archived_repos.map do |source_repo|
|
78
144
|
components_repo_instances(source_repo, new_components)
|
@@ -142,22 +208,48 @@ module Actions
|
|
142
208
|
::Katello::PuppetModule::CONTENT_TYPE => []
|
143
209
|
}
|
144
210
|
|
145
|
-
input[:
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
content[::Katello::
|
159
|
-
|
160
|
-
|
211
|
+
base_repos = ::Katello::ContentViewVersion.find(input[:old_version]).repositories
|
212
|
+
new_repos = ::Katello::ContentViewVersion.find(input[:new_content_view_version_id]).repositories
|
213
|
+
|
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
|
218
|
+
|
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
|
222
|
+
|
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
|
233
|
+
end
|
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
|
252
|
+
end
|
161
253
|
end
|
162
254
|
end
|
163
255
|
end
|
@@ -174,10 +266,12 @@ module Actions
|
|
174
266
|
history.status = ::Katello::ContentViewHistory::SUCCESSFUL
|
175
267
|
history.save!
|
176
268
|
|
177
|
-
version.repositories.
|
178
|
-
|
179
|
-
|
180
|
-
|
269
|
+
unless SmartProxy.pulp_master.pulp3_support?(version.repositories.first)
|
270
|
+
version.repositories.each do |repo|
|
271
|
+
SmartProxy.pulp_master.pulp_api.extensions.send(:module_default).
|
272
|
+
copy(repo.library_instance.pulp_id,
|
273
|
+
repo.pulp_id)
|
274
|
+
end
|
181
275
|
end
|
182
276
|
end
|
183
277
|
|
@@ -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|
|