katello 3.16.0.rc5.1 → 3.16.0

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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/registry/registry_proxies_controller.rb +39 -23
  3. data/app/helpers/katello/content_view_helper.rb +15 -0
  4. data/app/lib/actions/katello/content_view/incremental_updates.rb +3 -1
  5. data/app/lib/actions/katello/content_view/publish.rb +55 -16
  6. data/app/lib/actions/katello/content_view_version/incremental_update.rb +81 -51
  7. data/app/lib/actions/katello/repository/multi_clone_contents.rb +66 -0
  8. data/app/lib/actions/katello/repository/multi_clone_to_version.rb +30 -0
  9. data/app/lib/actions/pulp3/abstract_async_task.rb +62 -58
  10. data/app/lib/actions/pulp3/content_migration.rb +4 -0
  11. data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +1 -2
  12. data/app/lib/actions/pulp3/orchestration/repository/multi_copy_all_units.rb +36 -0
  13. data/app/lib/actions/pulp3/repository/multi_copy_content.rb +28 -0
  14. data/app/lib/actions/pulp3/repository/multi_copy_units.rb +14 -7
  15. data/app/lib/actions/pulp3/repository/save_version.rb +11 -3
  16. data/app/lib/actions/pulp3/repository/save_versions.rb +47 -13
  17. data/app/lib/katello/errors.rb +1 -15
  18. data/app/models/katello/content_view.rb +18 -6
  19. data/app/models/katello/content_view_erratum_filter.rb +13 -0
  20. data/app/models/katello/content_view_module_stream_filter.rb +19 -0
  21. data/app/models/katello/module_stream.rb +1 -1
  22. data/app/services/katello/pulp3/api/core.rb +4 -0
  23. data/app/services/katello/pulp3/erratum.rb +3 -1
  24. data/app/services/katello/pulp3/migration.rb +3 -2
  25. data/app/services/katello/pulp3/migration_plan.rb +6 -6
  26. data/app/services/katello/pulp3/repository.rb +10 -1
  27. data/app/services/katello/pulp3/repository/yum.rb +168 -35
  28. data/app/services/katello/pulp3/task.rb +100 -0
  29. data/app/services/katello/pulp3/task_group.rb +79 -0
  30. data/lib/katello/version.rb +1 -1
  31. data/webpack/redux/actions/RedHatRepositories/helpers.js +5 -5
  32. metadata +17 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c713303404ad8912ded54dd3d110d6ef3f8e1ed9500f55abf1f31f2180d08a2
4
- data.tar.gz: 07eb7edbe97e87b35d0ebd26eb90c0da64a8eddb69d4435333a546eaa82d298b
3
+ metadata.gz: 3c1b5ae508e6d13abb97dd4fa5dcb3a869b5a8ee2f6a2a2e574bcde16faa1c41
4
+ data.tar.gz: e5dc1c88a336020bf333e9f781eac5790b588139bd8d813433bea739ee7077ca
5
5
  SHA512:
6
- metadata.gz: 67508f99358a420af1f1fbdb332e427bec5ee59092c69f05790029be0d14b624f6306dc351c550f02671819add178da8ae92938aeb2f66a262bebbd287cbad66
7
- data.tar.gz: 5267fc924abe8504b4688481792f964adab5b530f2110e3bb8954717fef6a6d691635f0c64d9f2a56b7bf311620df1b5cde767e9e9d2894ad454d134552f9425
6
+ metadata.gz: c6e0279e68e389701bcf84815bd401fe64375259da0ff533e4ae53fbf51f99b93837be754c0fb8d2d0457e6a8d299e4527c26d5c51fb4e81870f78592bbd46bf
7
+ data.tar.gz: 2296caf477bbb72d78f187e53a493b9e4c8657119424939063a8a6c6c40435d5e9bda70490351101207694cf9511a59de939397c53c623f11a2f30eba564ff91
@@ -6,8 +6,8 @@ module Katello
6
6
  before_action :confirm_push_settings, only: [:start_upload_blob, :upload_blob, :finish_upload_blob,
7
7
  :chunk_upload_blob, :push_manifest]
8
8
  skip_before_action :authorize
9
- before_action :optional_authorize, only: [:token]
10
- before_action :registry_authorize, except: [:token, :v1_search]
9
+ before_action :optional_authorize, only: [:token, :catalog]
10
+ before_action :registry_authorize, except: [:token, :v1_search, :catalog]
11
11
  before_action :authorize_repository_read, only: [:pull_manifest, :tags_list]
12
12
  before_action :authorize_repository_write, only: [:push_manifest]
13
13
  skip_before_action :check_content_type, only: [:start_upload_blob, :upload_blob, :finish_upload_blob,
@@ -39,20 +39,7 @@ module Katello
39
39
  "scope=\"repository:registry:pull,push\""
40
40
  end
41
41
 
42
- def optional_authorize
43
- @repository = find_scope_repository
44
- if @repository && (@repository.environment.registry_unauthenticated_pull || ssl_client_authorized?(@repository.organization.label))
45
- true
46
- else
47
- authorize
48
- end
49
- end
50
-
51
- def registry_authorize
52
- @repository = find_readable_repository
53
- return true if ['GET', 'HEAD'].include?(request.method) && @repository && !require_user_authorization?
54
-
55
- token = request.headers['Authorization']
42
+ def set_user_by_token(token, redirect_on_failure = true)
56
43
  if token
57
44
  token_type, token = token.split
58
45
  if token_type == 'Bearer' && token
@@ -63,10 +50,34 @@ module Katello
63
50
  end
64
51
  elsif token_type == 'Basic' && token
65
52
  return true if authorize
66
- redirect_authorization_headers
53
+ redirect_authorization_headers if redirect_on_failure
67
54
  return false
68
55
  end
69
56
  end
57
+ false
58
+ end
59
+
60
+ def optional_authorize
61
+ @repository = find_scope_repository
62
+ if @repository && (@repository.environment.registry_unauthenticated_pull || ssl_client_authorized?(@repository.organization.label))
63
+ true
64
+ elsif params['action'] == 'catalog'
65
+ set_user_by_token(request.headers['Authorization'], false)
66
+ elsif (params['action'] == 'token' && params['scope'].blank? && params['account'].blank?)
67
+ true
68
+ else
69
+ authorize
70
+ end
71
+ end
72
+
73
+ def registry_authorize
74
+ @repository = find_readable_repository
75
+ return true if ['GET', 'HEAD'].include?(request.method) && @repository && !require_user_authorization?
76
+
77
+ is_user_set = set_user_by_token(request.headers['Authorization'])
78
+
79
+ return true if is_user_set
80
+
70
81
  redirect_authorization_headers
71
82
  render_error('unauthorized', :status => :unauthorized)
72
83
  return false
@@ -87,12 +98,8 @@ module Katello
87
98
  # Also include repositories in lifecycle environments with registry_unauthenticated_pull=true
88
99
  def readable_repositories
89
100
  table_name = Repository.table_name
90
- in_products = Repository.in_product(Katello::Product.authorized(:view_products)).select(:id)
91
- in_environments = Repository.where(:environment_id => Katello::KTEnvironment.authorized(:view_lifecycle_environments)).select(:id)
92
101
  in_unauth_environments = Repository.joins(:environment).where("#{Katello::KTEnvironment.table_name}.registry_unauthenticated_pull" => true).select(:id)
93
- in_content_views = Repository.joins(:content_view_repositories).where("#{ContentViewRepository.table_name}.content_view_id" => Katello::ContentView.readable).select(:id)
94
- in_versions = Repository.joins(:content_view_version).where("#{Katello::ContentViewVersion.table_name}.content_view_id" => Katello::ContentView.readable).select(:id)
95
- Repository.where("#{table_name}.id in (?) or #{table_name}.id in (?) or #{table_name}.id in (?) or #{table_name}.id in (?) or #{table_name}.id in (?)", in_products, in_content_views, in_versions, in_environments, in_unauth_environments)
102
+ Repository.readable.or(Repository.joins(:root).where("#{table_name}.id in (?)", in_unauth_environments))
96
103
  end
97
104
 
98
105
  def find_readable_repository
@@ -105,7 +112,8 @@ module Katello
105
112
  end
106
113
 
107
114
  def require_user_authorization?(repository = @repository)
108
- !repository || (!repository.environment.registry_unauthenticated_pull && !ssl_client_authorized?(repository.organization.label))
115
+ !(params['action'] == 'token' && params['scope'].blank? && params['account'].blank?) &&
116
+ (!repository || (!repository.environment.registry_unauthenticated_pull && !ssl_client_authorized?(repository.organization.label)))
109
117
  end
110
118
 
111
119
  def ssl_client_authorized?(org_label)
@@ -293,6 +301,14 @@ module Katello
293
301
  end
294
302
 
295
303
  def v1_search
304
+ # Checks for podman client and issues a 404 in that case. Podman
305
+ # examines the response from a /v1_search request. If the result
306
+ # is a 4XX, it will then proceed with a request to /_catalog
307
+ if request.headers['HTTP_USER_AGENT'].downcase.include?('libpod')
308
+ render json: {}, status: :not_found
309
+ return
310
+ end
311
+
296
312
  authenticate # to set current_user, not to enforce
297
313
  options = {
298
314
  resource_class: Katello::Repository
@@ -0,0 +1,15 @@
1
+ module Katello
2
+ module ContentViewHelper
3
+ def separated_repo_mapping(repo_mapping)
4
+ separated_mapping = { :pulp3_yum => {}, :other => {} }
5
+ repo_mapping.each do |source_repos, dest_repo|
6
+ if dest_repo.content_type == "yum" && SmartProxy.pulp_master.pulp3_support?(dest_repo)
7
+ separated_mapping[:pulp3_yum][source_repos] = dest_repo
8
+ else
9
+ separated_mapping[:other][source_repos] = dest_repo
10
+ end
11
+ end
12
+ separated_mapping
13
+ end
14
+ end
15
+ end
@@ -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
- output_for_version_ids << {:version_id => action.new_content_view_version.id, :output => action.output}
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
@@ -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
- plan_action(Repository::CloneToVersion, repositories, version, repository_mapping[repositories],
47
- :repos_units => options[:repos_units])
48
- plan_action(Repository::CloneToEnvironment, repository_mapping[repositories], library)
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
- plan_action(ContentViewPuppetEnvironment::Clone, version, :environment => library,
59
- :puppet_modules_present => has_modules)
60
- plan_action(Candlepin::Environment::SetContent, content_view, library, content_view.content_view_environment(library))
61
- plan_action(Katello::Foreman::ContentUpdate, library, content_view)
62
- plan_action(ContentView::ErrataMail, content_view, library)
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
- ::Katello::Host::ContentFacet.where(:content_view_id => input[:content_view_id],
99
- :lifecycle_environment_id => input[:environment_id]).each do |facet|
100
- facet.update_applicability_counts
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
- content_view.create_new_version(options[:major], options[:minor])
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,18 +67,24 @@ module Actions
51
67
  end
52
68
 
53
69
  concurrence do
54
- if SmartProxy.pulp_master.pulp3_support?(repos_to_clone.first.first)
55
- extended_repo_mapping = pulp3_repo_mapping(repository_mapping, old_version)
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
- copy_action_outputs << plan_action(Pulp3::Repository::MultiCopyUnits, extended_repo_mapping, unit_map,
59
- dependency_solving: true).output
60
- else
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
- copy_action_outputs += copy_repos(repository_mapping[source_repos],
63
- new_content_view_version,
64
- content,
65
- dep_solve)
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 |source_repo, dest_repo|
102
- source_repo = source_repo.first.library_instance? ? source_repo : [source_repo.first.library_instance]
103
- pulp3_repo_mapping[source_repo.first.id] = { dest_repo: dest_repo.id,
104
- base_version: pulp3_dest_base_version(
105
- ::Katello::ContentViewVersion.find(old_version.id), dest_repo) }
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].last[:pulp_tasks].last[:pulp_href]&.include?("/pulp/api/v3/")
183
- new_repos.each do |new_repo|
184
- matched_old_repo = base_repos.where(root_id: new_repo.root_id).first
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
- new_errata = new_repo.errata - matched_old_repo.errata
187
- new_module_streams = new_repo.module_streams - matched_old_repo.module_streams
188
- new_rpms = new_repo.rpms - matched_old_repo.rpms
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
- new_errata.each do |erratum|
191
- content[::Katello::Erratum::CONTENT_TYPE] << erratum.errata_id
192
- end
193
- new_module_streams.each do |module_stream|
194
- content[::Katello::ModuleStream::CONTENT_TYPE] <<
195
- "#{module_stream.name}:#{module_stream.stream}:#{module_stream.version}"
196
- end
197
- new_rpms.each do |rpm|
198
- content[::Katello::Rpm::CONTENT_TYPE] << rpm.nvra
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
- end
201
- else
202
- input[:copy_action_outputs].each do |copy_output|
203
- copy_output[:pulp_tasks].each do |pulp_task|
204
- pulp_task[:result][:units_successful].each do |unit|
205
- type = unit['type_id']
206
- unit = unit['unit_key']
207
- case type
208
- when ::Katello::Erratum::CONTENT_TYPE
209
- content[::Katello::Erratum::CONTENT_TYPE] << unit['id']
210
- when ::Katello::ModuleStream::CONTENT_TYPE
211
- content[::Katello::ModuleStream::CONTENT_TYPE] << "#{unit['name']}:#{unit['stream']}:#{unit['version']}"
212
- when ::Katello::Rpm::CONTENT_TYPE
213
- content[::Katello::Rpm::CONTENT_TYPE] << ::Katello::Util::Package.build_nvra(unit)
214
- when ::Katello::Deb::CONTENT_TYPE
215
- content[::Katello::Deb::CONTENT_TYPE] << "#{unit['name']}_#{unit['version']}_#{unit['architecture']}"
216
- when ::Katello::PuppetModule::CONTENT_TYPE
217
- content[::Katello::PuppetModule::CONTENT_TYPE] << "#{unit['author']}-#{unit['name']}-#{unit['version']}"
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
@@ -315,10 +349,6 @@ module Actions
315
349
  copy_outputs
316
350
  end
317
351
 
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
352
  def copy_yum_content(new_repo, dep_solve, package_ids, errata_ids)
323
353
  copy_outputs = []
324
354
  if new_repo.content_type == ::Katello::Repository::YUM_TYPE