katello 3.18.4 → 3.18.5

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: df5549e179ab505d6ebd9d8f3acb01cc2555b6bb9904d8d2e88f151c30f6113f
4
- data.tar.gz: 1e23f8b93a96fcdc0e2a437f7c7f0b69a2411ba95a93c0ddf79e1b7a5312a254
3
+ metadata.gz: 625ecabd197fcf1e9562afe5ab95076a78aad73960543c9804d0510f36bfc398
4
+ data.tar.gz: 0a6c82ff085f980e9d028a9734f3d071fa5324e6354b0c45b49406bf4400783c
5
5
  SHA512:
6
- metadata.gz: d72e8ce1315c1825d18ceb696b0cb402cb9127afc17adc59b3c144bee1901ffb1045334f0043e87bc57af2c73edca6dfd1efd1ebf3c88dd2a8029933e981cab8
7
- data.tar.gz: 164f2d886dae6691f7d6c212a5f5258930ef0945098508bc37a7c7e065bfed20ff374c7f3c0d50f4bbd20737d0e30551dc00682bed95af8148cf97730c0c213c
6
+ metadata.gz: ff6a670562b076e29b4112e22b8575ae0fbc8a1864377ea538e642207a9b78e574e1bcffb9c611f61691303fb9f5b8a56e80dda96b6391d96ab836b8cfc5ab7c
7
+ data.tar.gz: f8b4a6bb32933ef5a12ebc1dab3e1e06b023c39834b9fd58dad920912ce84f25ac6974cad9611ae6d6cd87b4b2bbd45d38d71604bf42d5ebb8be72f5b93f3293
@@ -6,7 +6,8 @@ module Actions
6
6
  sequence do
7
7
  plan_action(Actions::Pulp3::ContentGuard::Refresh, smart_proxy)
8
8
 
9
- roots = ::Katello::RootRepository.where.not(:content_type => ::Katello::Repository::DOCKER_TYPE).where(:unprotected => false)
9
+ protected_types = [::Katello::Repository::YUM_TYPE, ::Katello::Repository::FILE_TYPE, ::Katello::Repository::DEB_TYPE]
10
+ roots = ::Katello::RootRepository.where(:content_type => protected_types).where(:unprotected => false)
10
11
  repositories = ::Katello::Repository.where(:root => roots)
11
12
  if repositories.any?
12
13
  plan_action(::Actions::BulkAction, Actions::Pulp3::Repository::RefreshDistribution, repositories, smart_proxy.id, assume_content_guard_exists: true)
@@ -38,7 +38,9 @@ module Actions
38
38
  end
39
39
 
40
40
  def humanized_output
41
- report = task_progress_reports.find { |current| current['state'] == 'running' && current['total'] != 0 }
41
+ #prefer running reports where the done and total do not match
42
+ report = task_progress_reports.find { |current| current['state'] == 'running' && current['total'] != 0 && current['done'] != current['total'] }
43
+ report ||= task_progress_reports.find { |current| current['state'] == 'running' && current['total'] != 0 }
42
44
  report ||= task_group_progress_reports.find { |current| current['total'] != 0 && current['done'] != current['total'] }
43
45
 
44
46
  if !report.blank? && report['total'] != 0
@@ -46,7 +48,8 @@ module Actions
46
48
  elsif report
47
49
  report['message']
48
50
  elsif task_progress_reports.empty?
49
- "Content migration starting. "
51
+ "Content migration starting. These steps may take a while to complete. " \
52
+ "Refer to `foreman-maintain content migration-stats` for an estimate."
50
53
  else
51
54
  "Initial Migration steps complete."
52
55
  end
@@ -296,11 +296,13 @@ module Katello
296
296
 
297
297
  if proxy
298
298
  uri = URI(proxy.url)
299
+ username = CGI.escape(proxy.username) if proxy.username
300
+ password = CGI.escape(proxy.password) if proxy.password
299
301
  proxy_options = {
300
302
  proxy_host: uri.scheme + '://' + uri.host,
301
303
  proxy_port: uri.port,
302
- proxy_username: proxy.username,
303
- proxy_password: proxy.password
304
+ proxy_username: username,
305
+ proxy_password: password
304
306
  }
305
307
  return proxy_options
306
308
  end
@@ -216,7 +216,7 @@ module Katello
216
216
 
217
217
  if to_find
218
218
  found = migrated_repo_items.find { |migrated_repo| migrated_repo.pulp2_repo_id == to_find.pulp_id }
219
- import_repo(yum_repo, found)
219
+ import_repo(yum_repo, found) if found
220
220
  end
221
221
  end
222
222
  end
@@ -38,6 +38,7 @@ module Katello
38
38
  roots = Katello::RootRepository.where(:content_type => repo_type).order(:label)
39
39
  plans = []
40
40
  roots.each do |root|
41
+ next unless root.library_instance
41
42
  plans << library_migration_for(root)
42
43
  plans += content_view_migrations_for(root)
43
44
  end
@@ -63,6 +64,8 @@ module Katello
63
64
  def library_migration_for(root)
64
65
  repo = root.library_instance
65
66
 
67
+ return nil unless library_repo_safe_to_migrate?(repo)
68
+
66
69
  migration = {
67
70
  name: repo.pulp_id,
68
71
  repository_versions: [
@@ -76,10 +79,49 @@ module Katello
76
79
  migration
77
80
  end
78
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
+
79
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
+
80
116
  plans = []
81
117
  ContentView.non_default.published_with_repositories(root).sort_by(&:label).each do |cv|
82
- 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
83
125
  end
84
126
  plans
85
127
  end
@@ -18,6 +18,7 @@ namespace :katello do
18
18
  preserve_output = ::Foreman::Cast.to_bool(ENV['preserve_output'])
19
19
 
20
20
  User.current = User.anonymous_api_admin
21
+ Katello::Pulp3::MigrationSwitchover.new(SmartProxy.pulp_primary).remove_orphaned_content
21
22
  task = ForemanTasks.async_task(Actions::Pulp3::ContentMigration, SmartProxy.pulp_primary, reimport_all: reimport_all)
22
23
 
23
24
  if wait
@@ -28,6 +29,7 @@ namespace :katello do
28
29
  message = "#{Time.now.to_s}: #{task.humanized[:output]}"
29
30
  clear_count = message.length + 1
30
31
  $stdout.print(message)
32
+ $stdout.flush
31
33
 
32
34
  sleep(10)
33
35
  task = ForemanTasks::Task.find(task.id)
@@ -18,9 +18,11 @@ namespace :katello do
18
18
  end
19
19
 
20
20
  api = Katello::Pulp3::Api::Core.new(SmartProxy.pulp_primary)
21
- api.tasks_api.list(:state__in => 'running,waiting', :name => 'pulp_2to3_migration.app.migration.complex_repo_migration').results.each do |task|
22
- api.cancel_task(task.pulp_href)
23
- cancelled_tasks_count += 1
21
+ %w(pulp_2to3_migration.app.tasks.migrate.migrate_from_pulp2 pulp_2to3_migration.app.migration.complex_repo_migration).each do |task_label|
22
+ api.tasks_api.list(:state__in => 'running,waiting', :name => task_label).results.each do |task|
23
+ api.cancel_task(task.pulp_href)
24
+ cancelled_tasks_count += 1
25
+ end
24
26
  end
25
27
 
26
28
  puts _("\e[33mCancelled #{cancelled_tasks_count} tasks.\e[0m")
@@ -1,13 +1,18 @@
1
1
  namespace :katello do
2
2
  desc "Marks corrupted or missing content as approved to be ignored during the migration"
3
- task :approve_corrupted_migration_content => ["dynflow:client", "check_ping"] do
3
+ task :approve_corrupted_migration_content => ["dynflow:client"] do
4
+ services = [:candlepin, :foreman_tasks, :pulp3, :pulp, :pulp_auth]
5
+ Katello::Ping.ping!(services: services)
6
+
4
7
  Katello::Pulp3::Migration::CORRUPTABLE_CONTENT_TYPES.each do |type|
5
8
  type.missing_migrated_content.update_all(:ignore_missing_from_migration => true)
6
9
  end
7
10
  puts "Any missing or corrupt content will be ignored on migration to Pulp 3. This can be undone with 'foreman-rake katello:unapprove_corrupted_migration_content'"
8
11
  end
9
12
 
10
- task :unapprove_corrupted_migration_content => ["dynflow:client", "check_ping"] do
13
+ task :unapprove_corrupted_migration_content => ["dynflow:client"] do
14
+ services = [:candlepin, :foreman_tasks, :pulp3, :pulp, :pulp_auth]
15
+ Katello::Ping.ping!(services: services)
11
16
  Katello::Pulp3::Migration::CORRUPTABLE_CONTENT_TYPES.each do |type|
12
17
  type.ignored_missing_migrated_content.update_all(:ignore_missing_from_migration => false)
13
18
  end
@@ -28,10 +28,14 @@ namespace :katello do
28
28
  puts "Migrated/Total RPMs: #{migrated_rpm_count}/#{::Katello::Rpm.count}"
29
29
  puts "Migrated/Total errata: #{migrated_erratum_count}/#{::Katello::RepositoryErratum.count}"
30
30
  puts "Migrated/Total repositories: #{migrated_repo_count}/#{migratable_repo_count}"
31
- puts
31
+
32
32
  # The timing formulas go negative if the amount of content is negligibly small
33
33
  if migration_minutes >= 5
34
34
  puts "Estimated migration time based on yum content: #{hours} hours, #{minutes} minutes"
35
+ elsif migrated_rpm_count == ::Katello::Rpm.count &&
36
+ migrated_erratum_count == ::Katello::RepositoryErratum.count &&
37
+ migrated_repo_count == migratable_repo_count
38
+ puts "All content has been migrated."
35
39
  else
36
40
  puts "Estimated migration time based on yum content: fewer than 5 minutes"
37
41
  end
@@ -40,6 +44,11 @@ namespace :katello do
40
44
  puts "\e[33mNote:\e[0m ensure there is sufficient storage space for /var/lib/pulp/published to triple in size before starting the migration process."
41
45
  puts "Check the size of /var/lib/pulp/published with 'du -sh /var/lib/pulp/published/'"
42
46
 
47
+ puts
48
+ puts "\e[33mNote:\e[0m ensure there is sufficient storage space for postgresql."
49
+ puts "You will need additional space for your postgresql database. The partition holding '/var/opt/rh/rh-postgresql12/lib/pgsql/data/'"
50
+ puts " will need additional free space equivalent to the size of your Mongo db database (/var/lib/mongodb/)."
51
+
43
52
  displayed_warning = false
44
53
  found_missing = false
45
54
  path = Dir.mktmpdir('unmigratable_content-')
@@ -1,3 +1,3 @@
1
1
  module Katello
2
- VERSION = "3.18.4".freeze
2
+ VERSION = "3.18.5".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: 3.18.4
4
+ version: 3.18.5
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-07-15 00:00:00.000000000 Z
11
+ date: 2021-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -283,7 +283,7 @@ dependencies:
283
283
  version: 3.6.0
284
284
  - - "<"
285
285
  - !ruby/object:Gem::Version
286
- version: 3.8.0
286
+ version: 3.7.7
287
287
  type: :runtime
288
288
  prerelease: false
289
289
  version_requirements: !ruby/object:Gem::Requirement
@@ -293,7 +293,7 @@ dependencies:
293
293
  version: 3.6.0
294
294
  - - "<"
295
295
  - !ruby/object:Gem::Version
296
- version: 3.8.0
296
+ version: 3.7.7
297
297
  - !ruby/object:Gem::Dependency
298
298
  name: pulp_file_client
299
299
  requirement: !ruby/object:Gem::Requirement