katello 3.18.3.1 → 3.18.4

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: c9aff3d142eea532e4af243e46c2b98a4cc1016a60f652d2dd9514dc9f416371
4
- data.tar.gz: ea80686280189f05d2ffcbfe8e3cf0406fa2b985082b43e15338f62bca099209
3
+ metadata.gz: df5549e179ab505d6ebd9d8f3acb01cc2555b6bb9904d8d2e88f151c30f6113f
4
+ data.tar.gz: 1e23f8b93a96fcdc0e2a437f7c7f0b69a2411ba95a93c0ddf79e1b7a5312a254
5
5
  SHA512:
6
- metadata.gz: b569aa5d2a488f3f248c4e29dfaf4c51ad1c014b9bcd2c20bf1c99f09f27d57b4490f1e8fd9c5f78b65a1f584e3f2f1262b91f6d0b57cb9c487781176a16de52
7
- data.tar.gz: d0f344773b0172a608ca677effbb942fbf2b62386cf1179aefe3e8faf7fa5e0c16940cffb834a3e7be3007c6314525a09883989b51e714191160baa4dba65470
6
+ metadata.gz: d72e8ce1315c1825d18ceb696b0cb402cb9127afc17adc59b3c144bee1901ffb1045334f0043e87bc57af2c73edca6dfd1efd1ebf3c88dd2a8029933e981cab8
7
+ data.tar.gz: 164f2d886dae6691f7d6c212a5f5258930ef0945098508bc37a7c7e065bfed20ff374c7f3c0d50f4bbd20737d0e30551dc00682bed95af8148cf97730c0c213c
@@ -53,7 +53,7 @@ module Katello
53
53
 
54
54
  class PulpcoreMissingCapabilities < StandardError
55
55
  def message
56
- _("A smart proxy seems to have been refreshed without pulpcore being running. You may want to ")
56
+ _("A smart proxy seems to have been refreshed without pulpcore being running. Please refresh the smart proxy after ensuring that pulpcore services are running.")
57
57
  end
58
58
  end
59
59
 
@@ -9,7 +9,7 @@ module Katello
9
9
  SETTINGS[:katello][:use_pulp_2_for_content_type].nil? || (!SETTINGS[:katello][:use_pulp_2_for_content_type][:yum] &&
10
10
  !SETTINGS[:katello][:use_pulp_2_for_content_type][:docker] &&
11
11
  !SETTINGS[:katello][:use_pulp_2_for_content_type][:file]) ||
12
- system('systemctl is-enabled pulpcore-api.service')
12
+ File.exist?('/etc/systemd/system/multi-user.target.wants/pulpcore-api.service')
13
13
  end
14
14
 
15
15
  def services(capsule_id = nil)
@@ -166,7 +166,7 @@ module Katello
166
166
 
167
167
  def create_migrations
168
168
  plan = migration_plan
169
- Rails.logger.info("Migration Plan: #{plan}")
169
+ Rails.logger.info("Migration Plan: #{plan.to_yaml}")
170
170
 
171
171
  if plan['plugins'].empty?
172
172
  Rails.logger.error("No Repositories to migrate")
@@ -310,6 +310,24 @@ module Katello
310
310
  on_duplicate_key_update: {conflict_target: [:erratum_id, :repository_id], columns: [:erratum_pulp3_href]})
311
311
  to_import = {}
312
312
  end
313
+ correct_missing_errata
314
+ end
315
+
316
+ def correct_missing_errata
317
+ Katello::RepositoryErratum.where(:erratum_pulp3_href => nil).pluck(:repository_id).uniq.each do |repo_id|
318
+ repo = Katello::Repository.find(repo_id)
319
+ if repo.link?
320
+ target = repo.target_repository
321
+ to_import = []
322
+ target.repository_errata.each do |repo_errata|
323
+ to_import << {erratum_id: repo_errata.erratum_id, erratum_pulp3_href: repo_errata.erratum_pulp3_href, repository_id: repo_id}
324
+ end
325
+ Katello::RepositoryErratum.import([:erratum_id, :erratum_pulp3_href, :repository_id], to_import, :validate => false,
326
+ on_duplicate_key_update: {conflict_target: [:erratum_id, :repository_id], columns: [:erratum_pulp3_href]})
327
+ else
328
+ Rails.logger.error("Unexpectedly found target repo (ID=#{repo_id}) with missing migrated errata!")
329
+ end
330
+ end
313
331
  end
314
332
 
315
333
  def mark_missing_content(content_type)
@@ -14,7 +14,6 @@ module Katello
14
14
  Katello::Logging.time("CONTENT_MIGRATION - Generating Migration plan") do
15
15
  plan[:plugins] = generate_plugins
16
16
  end
17
- Rails.logger.error("Migration Plan: #{plan.to_json}")
18
17
  plan
19
18
  end
20
19
 
@@ -105,7 +104,15 @@ module Katello
105
104
  end
106
105
 
107
106
  def name_for_content_view(content_view, root_repo)
108
- "#{content_view.label}-#{root_repo.label}"
107
+ name = "#{content_view.label}-#{root_repo.label}"
108
+
109
+ if Katello::RootRepository.where(:label => root_repo.label).group(:label).count(:label)[root_repo.label] > 1
110
+ repo_query = Katello::Repository.joins(:root, :content_view_version => :content_view).
111
+ where("#{::Katello::RootRepository.table_name}.id != #{root_repo.id}").
112
+ where("#{::Katello::RootRepository.table_name}.label" => root_repo.label, "#{::Katello::ContentView.table_name}.label" => content_view.label)
113
+ name += "-#{root_repo.id}" if repo_query.any?
114
+ end
115
+ name
109
116
  end
110
117
 
111
118
  def content_view_migration(content_view, root)
@@ -85,7 +85,7 @@ module Katello
85
85
 
86
86
  def cancel
87
87
  tasks_api = core_api.tasks_api
88
- tasks_response = core_api.fetch_from_list do |page_opts|
88
+ tasks_response = core_api.class.fetch_from_list do |page_opts|
89
89
  tasks_api.list(page_opts.merge(task_group: task_group_data['pulp_href'], state__in: 'running,waiting'))
90
90
  end
91
91
  tasks_response.collect do |result|
@@ -7,12 +7,5 @@ namespace :katello do
7
7
  if SETTINGS[:katello][:use_pulp_2_for_content_type].nil?
8
8
  fail fail_msg
9
9
  end
10
-
11
- if !SETTINGS[:katello][:use_pulp_2_for_content_type][:docker] &&
12
- !SETTINGS[:katello][:use_pulp_2_for_content_type][:file] &&
13
- !SETTINGS[:katello][:use_pulp_2_for_content_type][:yum] &&
14
- !SETTINGS[:katello][:use_pulp_2_for_content_type][:deb]
15
- fail fail_msg
16
- end
17
10
  end
18
11
  end
@@ -6,31 +6,38 @@ namespace :katello do
6
6
  task :pulp3_content_switchover => ["dynflow:client", "check_config"] do
7
7
  dryrun = ENV['DRYRUN']
8
8
 
9
- begin
10
- User.current = User.anonymous_admin
9
+ if !SETTINGS[:katello][:use_pulp_2_for_content_type][:docker] &&
10
+ !SETTINGS[:katello][:use_pulp_2_for_content_type][:file] &&
11
+ !SETTINGS[:katello][:use_pulp_2_for_content_type][:yum] &&
12
+ !SETTINGS[:katello][:use_pulp_2_for_content_type][:deb]
13
+ puts "Switchover is already complete, skipping switchover task."
14
+ else
15
+ begin
16
+ User.current = User.anonymous_admin
11
17
 
12
- switchover_service = Katello::Pulp3::MigrationSwitchover.new(SmartProxy.pulp_primary)
13
- switchover_service.remove_orphaned_content #run out of transaction for easier re-run
14
- ActiveRecord::Base.transaction do
15
- switchover_service.run
16
- fail "Dryrun completed without error, aborting and rolling back" if dryrun
18
+ switchover_service = Katello::Pulp3::MigrationSwitchover.new(SmartProxy.pulp_primary)
19
+ switchover_service.remove_orphaned_content #run out of transaction for easier re-run
20
+ ActiveRecord::Base.transaction do
21
+ switchover_service.run
22
+ fail "Dryrun completed without error, aborting and rolling back" if dryrun
23
+ end
24
+ rescue Katello::Pulp3::SwitchOverError => e
25
+ $stderr.print(e.message)
26
+ exit 1
17
27
  end
18
- rescue Katello::Pulp3::SwitchOverError => e
19
- $stderr.print(e.message)
20
- exit 1
21
- end
22
28
 
23
- task = ForemanTasks.async_task(Actions::Pulp3::ContentGuard::RefreshAllDistributions, SmartProxy.pulp_primary)
24
- until !task.pending? || task.paused?
25
- sleep(10)
26
- task = ForemanTasks::Task.find(task.id)
27
- end
28
- if task.result == 'error' || task.result == 'pending'
29
- msg _("Content Guard Configuration failed, switchover aborted. Switchover continuing, but after completion, you will want to investigate: https://#{Socket.gethostname}/foreman_tasks/tasks/#{task.id}")
30
- Rails.logger.error(msg)
31
- $stderr.print(msg)
32
- else
33
- puts _("Content Switchover completed successfully")
29
+ task = ForemanTasks.async_task(Actions::Pulp3::ContentGuard::RefreshAllDistributions, SmartProxy.pulp_primary)
30
+ until !task.pending? || task.paused?
31
+ sleep(10)
32
+ task = ForemanTasks::Task.find(task.id)
33
+ end
34
+ if task.result == 'error' || task.result == 'pending'
35
+ msg _("Content Guard Configuration failed, switchover aborted. Switchover continuing, but after completion, you will want to investigate: https://#{Socket.gethostname}/foreman_tasks/tasks/#{task.id}")
36
+ Rails.logger.error(msg)
37
+ $stderr.print(msg)
38
+ else
39
+ puts _("Content Switchover completed successfully")
40
+ end
34
41
  end
35
42
  end
36
43
  end
@@ -1,48 +1,55 @@
1
1
  namespace :katello do
2
2
  desc "Runs a Pulp 2 to 3 Content Migration for supported types. May be run multiple times. Use wait=false to immediately return with a task url."
3
3
  task :pulp3_migration => ["dynflow:client", 'check_config'] do
4
- services = [:candlepin, :foreman_tasks, :pulp3, :pulp, :pulp_auth]
5
- Katello::Ping.ping!(services: services)
4
+ if !SETTINGS[:katello][:use_pulp_2_for_content_type][:docker] &&
5
+ !SETTINGS[:katello][:use_pulp_2_for_content_type][:file] &&
6
+ !SETTINGS[:katello][:use_pulp_2_for_content_type][:yum] &&
7
+ !SETTINGS[:katello][:use_pulp_2_for_content_type][:deb]
8
+ puts "Switchover is already complete, skipping migration work."
9
+ else
10
+ services = [:candlepin, :foreman_tasks, :pulp3, :pulp, :pulp_auth]
11
+ Katello::Ping.ping!(services: services)
6
12
 
7
- puts "Starting task."
8
- SmartProxy.pulp_primary.refresh
13
+ puts "Starting task."
14
+ SmartProxy.pulp_primary.refresh
9
15
 
10
- reimport_all = ::Foreman::Cast.to_bool(ENV['reimport_all'])
11
- wait = ::Foreman::Cast.to_bool(ENV['wait'] || 'true')
12
- preserve_output = ::Foreman::Cast.to_bool(ENV['preserve_output'])
16
+ reimport_all = ::Foreman::Cast.to_bool(ENV['reimport_all'])
17
+ wait = ::Foreman::Cast.to_bool(ENV['wait'] || 'true')
18
+ preserve_output = ::Foreman::Cast.to_bool(ENV['preserve_output'])
13
19
 
14
- User.current = User.anonymous_api_admin
15
- task = ForemanTasks.async_task(Actions::Pulp3::ContentMigration, SmartProxy.pulp_primary, reimport_all: reimport_all)
20
+ User.current = User.anonymous_api_admin
21
+ task = ForemanTasks.async_task(Actions::Pulp3::ContentMigration, SmartProxy.pulp_primary, reimport_all: reimport_all)
16
22
 
17
- if wait
18
- clear_count = nil
19
- until !task.pending? || task.paused?
20
- $stdout.print("\r#{' ' * clear_count}\r") if clear_count && !preserve_output #clear the line before printing
21
- $stdout.print("\n") if preserve_output
22
- message = "#{Time.now.to_s}: #{task.humanized[:output]}"
23
- clear_count = message.length + 1
24
- $stdout.print(message)
23
+ if wait
24
+ clear_count = nil
25
+ until !task.pending? || task.paused?
26
+ $stdout.print("\r#{' ' * clear_count}\r") if clear_count && !preserve_output #clear the line before printing
27
+ $stdout.print("\n") if preserve_output
28
+ message = "#{Time.now.to_s}: #{task.humanized[:output]}"
29
+ clear_count = message.length + 1
30
+ $stdout.print(message)
25
31
 
26
- sleep(10)
27
- task = ForemanTasks::Task.find(task.id)
28
- end
32
+ sleep(10)
33
+ task = ForemanTasks::Task.find(task.id)
34
+ end
29
35
 
30
- if task.result == 'warning' || task.result == 'pending'
31
- msg = _("Migration failed, You will want to investigate: https://#{Socket.gethostname}/foreman_tasks/tasks/#{task.id}\n")
32
- $stderr.print(msg)
33
- fail ForemanTasks::TaskError, task
34
- else
35
- puts
36
- Katello::Pulp3::Migration::CORRUPTABLE_CONTENT_TYPES.each do |type|
37
- if type.missing_migrated_content.any?
38
- puts "Some corrupted or missing content found, run 'foreman-maintain content migration-stats' for more information."
39
- exit(-1)
36
+ if task.result == 'warning' || task.result == 'pending'
37
+ msg = _("Migration failed, You will want to investigate: https://#{Socket.gethostname}/foreman_tasks/tasks/#{task.id}\n")
38
+ $stderr.print(msg)
39
+ fail ForemanTasks::TaskError, task
40
+ else
41
+ puts
42
+ Katello::Pulp3::Migration::CORRUPTABLE_CONTENT_TYPES.each do |type|
43
+ if type.missing_migrated_content.any?
44
+ puts "Some corrupted or missing content found, run 'foreman-maintain content migration-stats' for more information."
45
+ exit(-1)
46
+ end
40
47
  end
48
+ puts _("Content Migration completed successfully")
41
49
  end
42
- puts _("Content Migration completed successfully")
50
+ else
51
+ puts "Migration started, you may monitor it at: https://#{Socket.gethostname}/foreman_tasks/tasks/#{task.id}"
43
52
  end
44
- else
45
- puts "Migration started, you may monitor it at: https://#{Socket.gethostname}/foreman_tasks/tasks/#{task.id}"
46
53
  end
47
54
  end
48
55
  end
@@ -17,6 +17,12 @@ namespace :katello do
17
17
  cancelled_tasks_count += 1 if cancelled_task
18
18
  end
19
19
 
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
24
+ end
25
+
20
26
  puts _("\e[33mCancelled #{cancelled_tasks_count} tasks.\e[0m")
21
27
  end
22
28
  end
@@ -1,3 +1,3 @@
1
1
  module Katello
2
- VERSION = "3.18.3.1".freeze
2
+ VERSION = "3.18.4".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.3.1
4
+ version: 3.18.4
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-06-14 00:00:00.000000000 Z
11
+ date: 2021-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -100,6 +100,20 @@ dependencies:
100
100
  - - "<"
101
101
  - !ruby/object:Gem::Version
102
102
  version: '4.0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: foreman-tasks-core
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "<"
108
+ - !ruby/object:Gem::Version
109
+ version: '0.4'
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "<"
115
+ - !ruby/object:Gem::Version
116
+ version: '0.4'
103
117
  - !ruby/object:Gem::Dependency
104
118
  name: foreman_remote_execution
105
119
  requirement: !ruby/object:Gem::Requirement
@@ -346,20 +360,20 @@ dependencies:
346
360
  requirements:
347
361
  - - ">="
348
362
  - !ruby/object:Gem::Version
349
- version: 2.6.0
363
+ version: 2.9.0
350
364
  - - "<"
351
365
  - !ruby/object:Gem::Version
352
- version: 2.8.0
366
+ version: 2.10.0
353
367
  type: :runtime
354
368
  prerelease: false
355
369
  version_requirements: !ruby/object:Gem::Requirement
356
370
  requirements:
357
371
  - - ">="
358
372
  - !ruby/object:Gem::Version
359
- version: 2.6.0
373
+ version: 2.9.0
360
374
  - - "<"
361
375
  - !ruby/object:Gem::Version
362
- version: 2.8.0
376
+ version: 2.10.0
363
377
  - !ruby/object:Gem::Dependency
364
378
  name: pulp_rpm_client
365
379
  requirement: !ruby/object:Gem::Requirement