katello 4.0.2.1 → 4.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60cb9d2337d887d068fbe7f6886e157de5c3c35518a2ad3ef78e9a384ed8cb50
4
- data.tar.gz: 34cb737891925c363205d7464793bedf3cc8f80a8ed5778c056962d0f3f9a46f
3
+ metadata.gz: bce7f44a7f2b8e7a0eda1ca43fc7835ff63a4e13f37dc989b34e5902a1aed53a
4
+ data.tar.gz: 9347b0be58ab615b998c47b00ec3db414e21a0802072c1abd1b0d09ebe45b46d
5
5
  SHA512:
6
- metadata.gz: fbb101788bbe74c6829b244b9e3f48ef9f04b7c059b3410d9ab563c1b44ee4d35aa1e76579f99a605bd122005f9b1112ccbf3e9a85c3d018e72a7a184ddd7476
7
- data.tar.gz: e48ae02b0e60e82a9b8b27e56662940728de4f8c564492bd0e4681e39824d42934ce16a38c1ca2cdfe69e4da19ca3b19081723805464a1873cf898c6b40a8893
6
+ metadata.gz: 302db8a69576d6ede5e7b76a2a68d1ec255490bfe6d08748f503b43b3b57d2930ab872e7cb5f2bc26330fd08781650eab35e05bf1adab85505090f471886cc32
7
+ data.tar.gz: ca2ec5c259ed700896a7509da48bf7ccb814e273e9391210d96473c7ae37563904a1291062e2b04adb1afe1bbf8f50394d4d05edc199a5843148612e8a5c57f3
@@ -74,11 +74,13 @@ module Katello
74
74
  def initialize(url:, ssl_cert_file:, ssl_key_file:, ssl_ca_file:)
75
75
  @url = url
76
76
  ssl_domain = ::Qpid::Proton::SSLDomain.new(::Qpid::Proton::SSLDomain::MODE_CLIENT)
77
+ ssl_domain.peer_authentication(::Qpid::Proton::SSLDomain::VERIFY_PEER_NAME)
77
78
  ssl_domain.credentials(ssl_cert_file, ssl_key_file, nil) if ssl_cert_file && ssl_key_file
78
79
  ssl_domain.trusted_ca_db(ssl_ca_file) if ssl_ca_file
79
80
  @connection_options = {
80
81
  ssl_domain: ssl_domain,
81
- sasl_allowed_mechs: 'external'
82
+ sasl_allowed_mechs: 'external',
83
+ virtual_host: URI.parse(url).host
82
84
  }
83
85
  end
84
86
 
@@ -233,10 +233,15 @@ module Katello
233
233
  new_ids = new_available_module_streams.keys - old_associated_ids
234
234
  new_ids.each do |new_id|
235
235
  module_stream = new_available_module_streams[new_id]
236
+ status = module_stream["status"]
237
+ # Set status to "unknown" only if the active field is in use and set to false and the module is enabled
238
+ if enabled_module_stream_inactive?(module_stream)
239
+ status = "unknown"
240
+ end
236
241
  self.host_available_module_streams.create!(host_id: self.id,
237
242
  available_module_stream_id: new_id,
238
243
  installed_profiles: module_stream["installed_profiles"],
239
- status: module_stream["status"])
244
+ status: status)
240
245
  end
241
246
 
242
247
  upgradable_streams.each do |hams|
@@ -246,6 +251,10 @@ module Katello
246
251
  if hams.attributes.slice(*shared_keys) != module_stream_data
247
252
  hams.update!(module_stream_data)
248
253
  end
254
+ # Set status to "unknown" only if the active field is in use and set to false and the module is enabled
255
+ if enabled_module_stream_inactive?(module_stream)
256
+ hams.update!(status: "unknown")
257
+ end
249
258
  end
250
259
  end
251
260
 
@@ -365,6 +374,10 @@ module Katello
365
374
  self.get_status(::Katello::TraceStatus).refresh!
366
375
  self.refresh_global_status!
367
376
  end
377
+
378
+ def enabled_module_stream_inactive?(module_stream)
379
+ !module_stream["active"].nil? && module_stream["active"] == false && module_stream["status"] == "enabled"
380
+ end
368
381
  end
369
382
  end
370
383
  end
@@ -92,7 +92,8 @@ module Katello
92
92
  ::Katello::ModuleStream.
93
93
  joins("inner join katello_available_module_streams on
94
94
  katello_module_streams.name = katello_available_module_streams.name and
95
- katello_module_streams.stream = katello_available_module_streams.stream").
95
+ katello_module_streams.stream = katello_available_module_streams.stream and
96
+ katello_module_streams.context = katello_available_module_streams.context").
96
97
  joins("inner join katello_host_available_module_streams on
97
98
  katello_available_module_streams.id = katello_host_available_module_streams.available_module_stream_id").
98
99
  where("katello_host_available_module_streams.host_id = :content_facet_id and
@@ -204,7 +204,7 @@ module Katello
204
204
 
205
205
  if to_find
206
206
  found = migrated_repo_items.find { |migrated_repo| migrated_repo.pulp2_repo_id == to_find.pulp_id }
207
- import_repo(yum_repo, found)
207
+ import_repo(yum_repo, found) if found
208
208
  end
209
209
  end
210
210
  end
@@ -64,6 +64,8 @@ module Katello
64
64
  def library_migration_for(root)
65
65
  repo = root.library_instance
66
66
 
67
+ return nil unless library_repo_safe_to_migrate?(repo)
68
+
67
69
  migration = {
68
70
  name: repo.pulp_id,
69
71
  repository_versions: [
@@ -77,10 +79,49 @@ module Katello
77
79
  migration
78
80
  end
79
81
 
82
+ def library_repo_safe_to_migrate?(repo)
83
+ publish_tasks = ForemanTasks::Task.where(label: 'Actions::Katello::ContentView::Publish')
84
+ publishing_repo_ids = publish_tasks.where(state: ['scheduled', 'running']).collect do |task|
85
+ ::Katello::ContentViewVersion.find(task.input[:content_view_version_id]).library_repos.pluck(:id)
86
+ end
87
+ publishing_repo_ids = publishing_repo_ids.flatten
88
+
89
+ if publishing_repo_ids.include?(repo.id)
90
+ warn_string = "Library repository with ID #{repo.id} and name #{repo.name} unmigrated due to being "\
91
+ "associated with an actively-publishing content view. The migration will need to be run again."
92
+ Rails.logger.warn(warn_string)
93
+ return false
94
+ end
95
+
96
+ create_root_tasks = ForemanTasks::Task.where(label: 'Actions::Katello::Repository::CreateRoot')
97
+ active_creation_task = create_root_tasks.where(state: ['scheduled', 'running']).detect do |task|
98
+ task.input[:repository][:id] == repo.id
99
+ end
100
+
101
+ if active_creation_task.present?
102
+ warn_string = "Repository with ID #{repo.id} and name #{repo.name} unmigrated due to being "\
103
+ "created during the Pulp 3 migration. The migration will need to be run again."
104
+ Rails.logger.warn(warn_string)
105
+ return false
106
+ end
107
+ true
108
+ end
109
+
80
110
  def content_view_migrations_for(root)
111
+ publish_tasks = ForemanTasks::Task.where(label: 'Actions::Katello::ContentView::Publish')
112
+ publishing_cv_ids = publish_tasks.where(state: ['scheduled', 'running']).collect do |task|
113
+ task.input[:content_view_id]
114
+ end
115
+
81
116
  plans = []
82
117
  ContentView.non_default.published_with_repositories(root).sort_by(&:label).each do |cv|
83
- plans << content_view_migration(cv, root)
118
+ if publishing_cv_ids.include?(cv.id)
119
+ warn_string = "Repositories belonging to Content View with ID #{cv.id} and name #{cv.name} unmigrated "\
120
+ "due to being created during the Pulp 3 migration. The migration will need to be run again."
121
+ Rails.logger.warn(warn_string)
122
+ else
123
+ plans << content_view_migration(cv, root)
124
+ end
84
125
  end
85
126
  plans
86
127
  end
@@ -39,13 +39,23 @@ class DeletePuppetAndOstreeRepos < ActiveRecord::Migration[6.0]
39
39
  FakeContentViewPuppetEnvironment.delete_all
40
40
  FakePuppetModule.delete_all
41
41
 
42
- ::Katello::Repository.delete(puppet_repositories) if puppet_repositories.any?
42
+ if puppet_repositories.any?
43
+ User.as_anonymous_admin do
44
+ ::Katello::Repository.delete(puppet_repositories)
45
+ ::Katello::RootRepository.where(content_type: 'puppet').destroy_all
46
+ end
47
+ end
43
48
 
44
49
  FakeRepositoryOstreeBranch.delete_all
45
50
  FakeOstreeBranch.delete_all
46
- Katello::Repository.ostree_type.where.not(:library_instance_id => nil, :environment_id => nil).destroy_all #CV LCE repos
47
- Katello::Repository.ostree_type.where.not(:library_instance_id => nil).destroy_all # archive repos
48
- Katello::Repository.ostree_type.destroy_all #all the rest (should just be library repos)
51
+
52
+ if Katello::Repository.ostree_type.any?
53
+ User.as_anonymous_admin do
54
+ Katello::Repository.ostree_type.where.not(:library_instance_id => nil, :environment_id => nil).destroy_all #CV LCE repos
55
+ Katello::Repository.ostree_type.where.not(:library_instance_id => nil).destroy_all # archive repos
56
+ Katello::Repository.ostree_type.destroy_all #all the rest (should just be library repos)
57
+ end
58
+ end
49
59
 
50
60
  Katello::ContentViewVersion.where.not(:content_counts => nil).each do |version|
51
61
  version.content_counts.except!('ostree', 'puppet_module')
@@ -5,11 +5,13 @@ namespace :katello do
5
5
  task :remove_ostree_puppet_content => ["environment", "check_ping"] do
6
6
  contents = Katello::Content.where(content_type: ['ostree', 'puppet'])
7
7
  contents.each do |content|
8
- Katello::Resources::Candlepin::Content.destroy(content.organization.label, content.cp_content_id)
8
+ unless content.products.any?(&:redhat?)
9
+ Katello::Resources::Candlepin::Content.destroy(content.organization.label, content.cp_content_id)
10
+ content.destroy
11
+ end
9
12
  rescue RestClient::NotFound
10
13
  #skip content not found
11
14
  end
12
- contents.destroy_all
13
15
  end
14
16
  end
15
17
  end
@@ -1,3 +1,3 @@
1
1
  module Katello
2
- VERSION = "4.0.2.1".freeze
2
+ VERSION = "4.0.3".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katello
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.2.1
4
+ version: 4.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - N/A
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-03 00:00:00.000000000 Z
11
+ date: 2021-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -129,6 +129,9 @@ dependencies:
129
129
  - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: 1.2.0
132
+ - - "<"
133
+ - !ruby/object:Gem::Version
134
+ version: 1.6.0
132
135
  type: :runtime
133
136
  prerelease: false
134
137
  version_requirements: !ruby/object:Gem::Requirement
@@ -136,6 +139,9 @@ dependencies:
136
139
  - - ">="
137
140
  - !ruby/object:Gem::Version
138
141
  version: 1.2.0
142
+ - - "<"
143
+ - !ruby/object:Gem::Version
144
+ version: 1.6.0
139
145
  - !ruby/object:Gem::Dependency
140
146
  name: activerecord-import
141
147
  requirement: !ruby/object:Gem::Requirement