foreman_maintain 1.6.7 → 1.6.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -5
  3. data/definitions/checks/check_ipv6_disable.rb +23 -0
  4. data/definitions/features/capsule.rb +1 -2
  5. data/definitions/features/dynflow_sidekiq.rb +1 -6
  6. data/definitions/features/foreman_server.rb +0 -1
  7. data/definitions/features/foreman_tasks.rb +0 -8
  8. data/definitions/features/instance.rb +0 -1
  9. data/definitions/features/katello.rb +0 -15
  10. data/definitions/procedures/hammer_setup.rb +3 -0
  11. data/definitions/procedures/packages/update.rb +2 -0
  12. data/definitions/procedures/pulpcore/container_handle_image_metadata.rb +26 -0
  13. data/definitions/procedures/restore/configs.rb +0 -19
  14. data/definitions/procedures/restore/drop_databases.rb +1 -3
  15. data/definitions/procedures/restore/reindex_databases.rb +6 -0
  16. data/definitions/procedures/restore/required_packages.rb +0 -1
  17. data/definitions/scenarios/backup.rb +9 -20
  18. data/definitions/scenarios/foreman_upgrade.rb +2 -1
  19. data/definitions/scenarios/restore.rb +11 -29
  20. data/definitions/scenarios/self_upgrade.rb +1 -4
  21. data/definitions/scenarios/update.rb +1 -0
  22. data/definitions/scenarios/upgrade_to_capsule_6_16.rb +2 -0
  23. data/definitions/scenarios/upgrade_to_satellite_6_16.rb +2 -0
  24. data/lib/foreman_maintain/cli/upgrade_command.rb +0 -10
  25. data/lib/foreman_maintain/concerns/base_database.rb +0 -6
  26. data/lib/foreman_maintain/concerns/system_helpers.rb +3 -2
  27. data/lib/foreman_maintain/package_manager/apt.rb +3 -1
  28. data/lib/foreman_maintain/package_manager/dnf.rb +10 -5
  29. data/lib/foreman_maintain/utils/backup.rb +2 -23
  30. data/lib/foreman_maintain/version.rb +1 -1
  31. metadata +4 -8
  32. data/definitions/features/gofer.rb +0 -16
  33. data/definitions/procedures/pulpcore/migrate.rb +0 -24
  34. data/definitions/procedures/restore/candlepin_reset_migrations.rb +0 -14
  35. data/definitions/procedures/selinux/set_file_security.rb +0 -25
  36. data/definitions/scenarios/upgrade_to_capsule_6_16_z.rb +0 -97
  37. data/definitions/scenarios/upgrade_to_satellite_6_16_z.rb +0 -98
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c513edc079ddea8f18904feeed2d3299c59949183703f7344946c8828abee6b6
4
- data.tar.gz: 2fb58c156aaf22a0b1be982768a267926f8f080b063a2169ab6868fa1955b26d
3
+ metadata.gz: 693bf5fa41d37437188c4990278301d1965819e37fad7b0dc680e1fdff8f8631
4
+ data.tar.gz: d56694b7ed8093eeaa814fdf950f5c308d76eeffbf97a654ecbb20ef55611759
5
5
  SHA512:
6
- metadata.gz: bbd8eb809ab9f165b461dd2b29e8af8b5ffdee2d285462d9a9b626e93f922ac20066d166a751524c80edbadb6c465cbb6a5661529591da7188608ff0d48467b3
7
- data.tar.gz: 7450630a6ab864eec72be71fd6b948f016d59f8f1e6dcbc11c8110d41bbde62504f16acc40b9bd3ff2e5b902cd316555fb03ebf72c2606b851824fbf8d50fb6f
6
+ metadata.gz: 40503012245738da00890d0d224141754f00c110f9bbc7c62112b3e11bea7beb066718bfffdc36056ae9afbed29f2ac8ca6d9dd474e4af9a1eee50099a636352
7
+ data.tar.gz: d71cfc02366e99a507f1453706d0ffcfe01f1dcdb8cf231a03a4b8468716f1c4b3ae25acfa5938f32858bf17fb37d974d511173b047808b84a03e8dd38ce1d1a
data/README.md CHANGED
@@ -17,7 +17,6 @@ Subcommands:
17
17
  --tags tags Run only those with all specific set of tags
18
18
 
19
19
  upgrade Upgrade related commands
20
- list-versions List versions this system is upgradable to
21
20
  check --target-version TARGET_VERSION Run pre-upgrade checks for upgrading to specified version
22
21
  --disable-self-upgrade Disable automatic self upgrade (default: false)
23
22
  run --target-version TARGET_VERSION Run the full upgrade
@@ -56,12 +55,11 @@ Subcommands:
56
55
  Foreman-maintain implements upgrade tooling that helps the administrator to go
57
56
  through the upgrade process.
58
57
 
59
- Foreman-maintain scans the system to know, what versions are available
60
- for upgrade on the particular system. To see what versions are available
61
- for upgrade, run:
58
+ The foreman-maintain tool is intended to self upgrade itself to the next major
59
+ version of the project. This is needed before upgrading, run:
62
60
 
63
61
  ```
64
- foreman-maintain upgrade list-versions
62
+ foreman-maintain self-upgrade
65
63
  ```
66
64
 
67
65
  To perform just the pre-upgrade checks for the system, run:
@@ -0,0 +1,23 @@
1
+ class Checks::CheckIpv6Disable < ForemanMaintain::Check
2
+ metadata do
3
+ label :check_ipv6_disable
4
+ description 'Check if ipv6.disable=1 is set at kernel level'
5
+ end
6
+
7
+ def run
8
+ cmdline_file = File.read('/proc/cmdline')
9
+
10
+ assert(!cmdline_file.include?("ipv6.disable=1"), error_message)
11
+ end
12
+
13
+ def error_message
14
+ base = "\nThe kernel contains ipv6.disable=1 which is known to break installation and upgrade"\
15
+ ", remove and reboot before continuining."
16
+
17
+ if feature(:instance).downstream
18
+ base += " See https://access.redhat.com/solutions/5045841 for more details."
19
+ end
20
+
21
+ base
22
+ end
23
+ end
@@ -7,8 +7,7 @@ class Features::Capsule < ForemanMaintain::Feature
7
7
 
8
8
  confine do
9
9
  !package_manager.installed?(['satellite']) &&
10
- package_manager.installed?(['satellite-capsule']) ||
11
- package_manager.installed?(['capsule-installer'])
10
+ package_manager.installed?(['satellite-capsule'])
12
11
  end
13
12
  end
14
13
 
@@ -8,14 +8,9 @@ class Features::DynflowSidekiq < ForemanMaintain::Feature
8
8
  end
9
9
 
10
10
  def config_files
11
- # Workaround until foreman-installer can deploy scaled workers
12
- service_symlinks = configured_instances.map do |service|
13
- "/etc/systemd/system/multi-user.target.wants/#{service}.service"
14
- end
15
11
  [
16
12
  '/etc/foreman/dynflow',
17
- service_symlinks,
18
- ].flatten
13
+ ]
19
14
  end
20
15
 
21
16
  def services
@@ -26,7 +26,6 @@ module ForemanMaintain
26
26
  [
27
27
  '/etc/httpd',
28
28
  '/var/www/html/pub/katello-*',
29
- '/etc/squid',
30
29
  '/etc/foreman',
31
30
  '/etc/selinux/targeted/contexts/files/file_contexts.subs',
32
31
  '/etc/sysconfig/foreman',
@@ -125,14 +125,6 @@ class Features::ForemanTasks < ForemanMaintain::Feature
125
125
  puts "\nTimeout: #{e.message}. Try again."
126
126
  end
127
127
 
128
- def services
129
- feature(:dynflow_sidekiq) ? [] : [system_service(service_name, 30)]
130
- end
131
-
132
- def service_name
133
- 'dynflowd'
134
- end
135
-
136
128
  private
137
129
 
138
130
  def check_task_count(state, spinner)
@@ -162,7 +162,6 @@ class Features::Instance < ForemanMaintain::Feature
162
162
  'pulp3' => %w[pulpcore pulpcore_database],
163
163
  'pulp3_content' => %w[pulpcore pulpcore_database],
164
164
  'foreman_tasks' => %w[foreman_tasks],
165
- 'katello_agent' => %w[katello],
166
165
  'katello_events' => %w[katello],
167
166
  }
168
167
  end
@@ -17,14 +17,6 @@ class Features::Katello < ForemanMaintain::Feature
17
17
  @current_version ||= package_version('katello')
18
18
  end
19
19
 
20
- def services
21
- [
22
- system_service('qpidd', 10),
23
- system_service('qdrouterd', 10),
24
- ]
25
- end
26
-
27
- # rubocop:disable Metrics/MethodLength
28
20
  def config_files
29
21
  configs = [
30
22
  '/etc/pki/katello',
@@ -35,11 +27,6 @@ class Features::Katello < ForemanMaintain::Feature
35
27
  '/etc/sysconfig/tomcat*',
36
28
  '/etc/tomcat*',
37
29
  '/var/lib/candlepin',
38
- '/usr/share/foreman/bundler.d/katello.rb',
39
- '/etc/qpid',
40
- '/etc/qpid-dispatch',
41
- '/var/lib/qpidd',
42
- '/etc/qpid-dispatch',
43
30
  ]
44
31
 
45
32
  if installer_scenario_answers['certs']
@@ -53,11 +40,9 @@ class Features::Katello < ForemanMaintain::Feature
53
40
 
54
41
  configs
55
42
  end
56
- # rubocop:enable Metrics/MethodLength
57
43
 
58
44
  def config_files_exclude_for_online
59
45
  [
60
- '/var/lib/qpidd',
61
46
  '/var/lib/candlepin/activemq-artemis',
62
47
  ]
63
48
  end
@@ -2,6 +2,9 @@ class Procedures::HammerSetup < ForemanMaintain::Procedure
2
2
  metadata do
3
3
  description 'Setup hammer'
4
4
  for_feature :hammer
5
+ preparation_steps do
6
+ Checks::ServicesUp.new
7
+ end
5
8
  end
6
9
 
7
10
  def run
@@ -8,6 +8,7 @@ module Procedures::Packages
8
8
  :flag => true, :default => false
9
9
  param :download_only, 'Download and cache packages only', :flag => true, :default => false
10
10
  param :clean_cache, 'If true will cause a DNF cache clean', :flag => true, :default => true
11
+ param :enabled_repos, 'List of repositories to enable', :array => true
11
12
  end
12
13
 
13
14
  def run
@@ -16,6 +17,7 @@ module Procedures::Packages
16
17
  opts = {
17
18
  :assumeyes => assumeyes_val,
18
19
  :download_only => @download_only,
20
+ :enabled_repos => @enabled_repos,
19
21
  }
20
22
  packages_action(:update, @packages, opts)
21
23
  rescue ForemanMaintain::Error::ExecutionError => e
@@ -0,0 +1,26 @@
1
+ module Procedures::Pulpcore
2
+ class ContainerHandleImageMetadata < ForemanMaintain::Procedure
3
+ include ForemanMaintain::Concerns::SystemService
4
+ include ForemanMaintain::Concerns::PulpCommon
5
+
6
+ metadata do
7
+ description 'Initialize and expose container image metadata in the pulpcore db'
8
+ for_feature :pulpcore
9
+ end
10
+
11
+ def run
12
+ with_spinner('Initialize and expose container image metadata in the pulpcore db') do |spinner|
13
+ necessary_services = feature(:pulpcore_database).services
14
+
15
+ feature(:service).handle_services(spinner, 'start', :only => necessary_services)
16
+
17
+ spinner.update('Adding image metadata to pulp. You can continue using the ' \
18
+ 'system normally while the task runs in the background.')
19
+ execute!(pulpcore_manager('container-handle-image-data'))
20
+ spinner.update('Adding image metadata to katello. You can continue using the ' \
21
+ 'system normally while the task runs in the background.')
22
+ execute!('foreman-rake katello:import_container_manifest_labels')
23
+ end
24
+ end
25
+ end
26
+ end
@@ -14,18 +14,10 @@ module Procedures::Restore
14
14
  spinner.update('Restoring configs')
15
15
  clean_conflicting_data
16
16
  restore_configs(backup)
17
- reset_qpid_jrnls
18
17
  end
19
18
  end
20
19
 
21
20
  def restore_configs(backup)
22
- exclude = ForemanMaintain.available_features.each_with_object([]) do |feat, cfgs|
23
- if backup.online_backup?
24
- feat.config_files_exclude_for_online.each { |f| cfgs << f.gsub(%r{^/}, '') }
25
- end
26
- feat.config_files_to_exclude.each { |f| cfgs << f.gsub(%r{^/}, '') }
27
- end
28
-
29
21
  tar_options = {
30
22
  :overwrite => true,
31
23
  :listed_incremental => '/dev/null',
@@ -33,7 +25,6 @@ module Procedures::Restore
33
25
  :directory => '/',
34
26
  :archive => backup.file_map[:config_files][:path],
35
27
  :gzip => true,
36
- :exclude => exclude,
37
28
  }
38
29
 
39
30
  feature(:tar).run(tar_options)
@@ -45,15 +36,5 @@ module Procedures::Restore
45
36
  # tar is unable to --overwrite dir with symlink
46
37
  execute('rm -rf /usr/share/foreman-proxy/.ssh')
47
38
  end
48
-
49
- def reset_qpid_jrnls
50
- # on restore without pulp data qpid fails to start
51
- # https://access.redhat.com/solutions/4645231
52
- ['/var/lib/qpidd/.qpidd/', '/var/lib/qpidd/'].each do |qpidd_path|
53
- if Dir.exist?("#{qpidd_path}/qls/dat2/")
54
- execute("rm -rf #{qpidd_path}/qls/dat2/__db.00*")
55
- end
56
- end
57
- end
58
39
  end
59
40
  end
@@ -19,9 +19,7 @@ module Procedures::Restore
19
19
  feature(:service).handle_services(spinner, 'start', :only => ['postgresql'])
20
20
  drop_foreman(backup, spinner)
21
21
  drop_candlepin(backup, spinner)
22
- if feature(:pulpcore)
23
- drop_pulpcore(backup, spinner)
24
- end
22
+ drop_pulpcore(backup, spinner)
25
23
  end
26
24
  end
27
25
 
@@ -1,6 +1,7 @@
1
1
  module Procedures::Restore
2
2
  class ReindexDatabases < ForemanMaintain::Procedure
3
3
  include ForemanMaintain::Concerns::SystemService
4
+ include ForemanMaintain::Concerns::SystemHelpers
4
5
 
5
6
  metadata do
6
7
  description 'REINDEX databases'
@@ -16,6 +17,11 @@ module Procedures::Restore
16
17
 
17
18
  spinner.update('Reindexing the databases')
18
19
  execute!('runuser - postgres -c "reindexdb -a"')
20
+ if check_min_version('python3.11-pulp-ansible', '0.20.0')
21
+ execute!('runuser -c '\
22
+ '\'echo "ALTER COLLATION pulp_ansible_semver REFRESH VERSION;"'\
23
+ '| psql pulpcore\' postgres')
24
+ end
19
25
  end
20
26
  end
21
27
  end
@@ -12,7 +12,6 @@ module Procedures::Restore
12
12
  backup = ForemanMaintain::Utils::Backup.new(@backup_dir)
13
13
  required_packages = []
14
14
  required_packages << 'puppetserver' if backup.with_puppetserver?
15
- required_packages << 'qpid-cpp-server' if backup.with_qpidd?
16
15
  if required_packages.any?
17
16
  with_spinner('Installing required packages') do
18
17
  ForemanMaintain.package_manager.install(required_packages, assumeyes: true)
@@ -19,9 +19,9 @@ module ForemanMaintain::Scenarios
19
19
  def compose
20
20
  check_valid_strategy
21
21
  safety_confirmation
22
- accessibility_confirmation
23
- prepare_directory
24
- add_step_with_context(Procedures::Backup::Metadata, :online_backup => online_backup?)
22
+ add_step_with_context(Procedures::Backup::AccessibilityConfirmation) if strategy == :offline
23
+ add_step_with_context(Procedures::Backup::PrepareDirectory)
24
+ add_step_with_context(Procedures::Backup::Metadata, :online_backup => strategy == :online)
25
25
 
26
26
  case strategy
27
27
  when :online
@@ -29,6 +29,7 @@ module ForemanMaintain::Scenarios
29
29
  when :offline
30
30
  add_offline_backup_steps
31
31
  end
32
+
32
33
  add_step_with_context(Procedures::Backup::CompressData)
33
34
  end
34
35
 
@@ -64,18 +65,8 @@ module ForemanMaintain::Scenarios
64
65
 
65
66
  private
66
67
 
67
- def prepare_directory
68
- add_step_with_context(Procedures::Backup::PrepareDirectory)
69
- end
70
-
71
- def accessibility_confirmation
72
- if strategy == :offline
73
- add_step_with_context(Procedures::Backup::AccessibilityConfirmation)
74
- end
75
- end
76
-
77
68
  def safety_confirmation
78
- if online_backup? || include_db_dumps?
69
+ if strategy == :online || include_db_dumps?
79
70
  add_step_with_context(Procedures::Backup::Online::SafetyConfirmation)
80
71
  end
81
72
  end
@@ -132,10 +123,6 @@ module ForemanMaintain::Scenarios
132
123
  def include_db_dumps?
133
124
  !!context.get(:include_db_dumps)
134
125
  end
135
-
136
- def online_backup?
137
- strategy == :online
138
- end
139
126
  end
140
127
 
141
128
  class BackupRescueCleanup < ForemanMaintain::Scenario
@@ -149,8 +136,10 @@ module ForemanMaintain::Scenarios
149
136
  end
150
137
 
151
138
  def compose
152
- add_step_with_context(Procedures::Service::Start) if strategy != :online
153
- add_steps_with_context(find_procedures(:maintenance_mode_off)) if strategy != :online
139
+ if strategy == :offline
140
+ add_step_with_context(Procedures::Service::Start)
141
+ add_steps_with_context(find_procedures(:maintenance_mode_off))
142
+ end
154
143
  add_step_with_context(Procedures::Backup::Clean)
155
144
  end
156
145
 
@@ -134,7 +134,8 @@ module Scenarios::ForemanUpgrade
134
134
  Checks::ServerPing,
135
135
  Checks::ServicesUp,
136
136
  Checks::SystemRegistration,
137
- Procedures::Packages::CheckForReboot
137
+ Procedures::Packages::CheckForReboot,
138
+ Procedures::Pulpcore::ContainerHandleImageMetadata
138
139
  )
139
140
  end
140
141
  end
@@ -11,7 +11,6 @@ module ForemanMaintain::Scenarios
11
11
  end
12
12
 
13
13
  # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
14
- # rubocop:disable Metrics/CyclomaticComplexity
15
14
  def compose
16
15
  backup = ForemanMaintain::Utils::Backup.new(context.get(:backup_dir))
17
16
 
@@ -27,7 +26,6 @@ module ForemanMaintain::Scenarios
27
26
  end
28
27
 
29
28
  add_steps_with_context(Procedures::Restore::Confirmation,
30
- Procedures::Selinux::SetFileSecurity,
31
29
  Procedures::Restore::RequiredPackages,
32
30
  Procedures::Restore::Configs)
33
31
  add_step_with_context(Procedures::Crond::Stop) if feature(:cron)
@@ -36,13 +34,10 @@ module ForemanMaintain::Scenarios
36
34
  end
37
35
  add_step_with_context(Procedures::Service::Stop)
38
36
  add_steps_with_context(Procedures::Restore::ExtractFiles) if backup.tar_backups_exist?
39
- drop_dbs(backup)
40
- if backup.sql_dump_files_exist? && feature(:instance).postgresql_local?
41
- add_step(Procedures::Service::Start.new(:only => ['postgresql']))
42
- end
43
- restore_sql_dumps(backup)
44
- if backup.sql_dump_files_exist? && feature(:instance).postgresql_local?
45
- add_step(Procedures::Service::Stop.new(:only => ['postgresql']))
37
+
38
+ if backup.sql_dump_files_exist?
39
+ add_steps_with_context(Procedures::Restore::DropDatabases)
40
+ restore_sql_dumps(backup)
46
41
  end
47
42
 
48
43
  if feature(:instance).postgresql_local? &&
@@ -51,38 +46,28 @@ module ForemanMaintain::Scenarios
51
46
  add_step_with_context(Procedures::Restore::ReindexDatabases)
52
47
  end
53
48
 
54
- add_steps_with_context(
55
- Procedures::Pulpcore::Migrate,
56
- Procedures::Restore::CandlepinResetMigrations
57
- )
58
-
59
- add_steps_with_context(Procedures::Service::Start,
60
- Procedures::Service::DaemonReload)
61
49
  add_step(Procedures::Installer::Run.new(:assumeyes => true))
62
50
  add_step_with_context(Procedures::Installer::UpgradeRakeTask)
63
51
  add_step_with_context(Procedures::Crond::Start) if feature(:cron)
64
52
  end
65
53
  # rubocop:enable Metrics/MethodLength,Metrics/AbcSize
66
- # rubocop:enable Metrics/CyclomaticComplexity
67
-
68
- def drop_dbs(backup)
69
- if backup.file_map[:candlepin_dump][:present] ||
70
- backup.file_map[:foreman_dump][:present] ||
71
- (feature(:pulpcore) && backup.file_map[:pulpcore_dump][:present])
72
- add_steps_with_context(Procedures::Restore::DropDatabases)
73
- end
74
- end
75
54
 
76
55
  def restore_sql_dumps(backup)
56
+ if feature(:instance).postgresql_local?
57
+ add_step(Procedures::Service::Start.new(:only => ['postgresql']))
58
+ end
77
59
  if backup.file_map[:candlepin_dump][:present]
78
60
  add_steps_with_context(Procedures::Restore::CandlepinDump)
79
61
  end
80
62
  if backup.file_map[:foreman_dump][:present]
81
63
  add_steps_with_context(Procedures::Restore::ForemanDump)
82
64
  end
83
- if feature(:pulpcore) && backup.file_map[:pulpcore_dump][:present]
65
+ if backup.file_map[:pulpcore_dump][:present]
84
66
  add_steps_with_context(Procedures::Restore::PulpcoreDump)
85
67
  end
68
+ if feature(:instance).postgresql_local?
69
+ add_step(Procedures::Service::Stop.new(:only => ['postgresql']))
70
+ end
86
71
  end
87
72
 
88
73
  def set_context_mapping
@@ -98,9 +83,6 @@ module ForemanMaintain::Scenarios
98
83
  Procedures::Restore::ForemanDump => :backup_dir,
99
84
  Procedures::Restore::PulpcoreDump => :backup_dir,
100
85
  Procedures::Restore::ExtractFiles => :backup_dir)
101
-
102
- context.map(:incremental_backup,
103
- Procedures::Selinux::SetFileSecurity => :incremental_backup)
104
86
  end
105
87
  end
106
88
 
@@ -67,11 +67,8 @@ module ForemanMaintain::Scenarios
67
67
  def downstream_self_upgrade(pkgs_to_update)
68
68
  ForemanMaintain.enable_maintenance_module
69
69
 
70
- dnf_options = req_repos_to_update_pkgs.map do |id|
71
- "--enablerepo=#{id}"
72
- end
73
70
  add_step(Procedures::Packages::Update.new(packages: pkgs_to_update, assumeyes: true,
74
- dnf_options: dnf_options))
71
+ enabled_repos: req_repos_to_update_pkgs))
75
72
  end
76
73
 
77
74
  def upstream_self_upgrade(pkgs_to_update)
@@ -28,6 +28,7 @@ module Scenarios::Update
28
28
  Checks::SystemRegistration,
29
29
  Checks::CheckHotfixInstalled,
30
30
  Checks::CheckTmout,
31
+ Checks::CheckIpv6Disable,
31
32
  Checks::CheckUpstreamRepository,
32
33
  Checks::Disk::AvailableSpace,
33
34
  Checks::Disk::AvailableSpaceCandlepin, # if candlepin
@@ -27,6 +27,7 @@ module Scenarios::Capsule_6_16
27
27
  def compose
28
28
  add_steps(find_checks(:default))
29
29
  add_steps(find_checks(:pre_upgrade))
30
+ add_step(Checks::CheckIpv6Disable)
30
31
  add_step(Checks::Disk::AvailableSpacePostgresql13)
31
32
  add_step(Checks::Repositories::Validate.new(:version => '6.16'))
32
33
  end
@@ -95,6 +96,7 @@ module Scenarios::Capsule_6_16
95
96
  add_steps(find_checks(:default))
96
97
  add_steps(find_checks(:post_upgrade))
97
98
  add_step(Procedures::Packages::CheckForReboot)
99
+ add_step(Procedures::Pulpcore::ContainerHandleImageMetadata)
98
100
  end
99
101
  end
100
102
  end
@@ -27,6 +27,7 @@ module Scenarios::Satellite_6_16
27
27
  def compose
28
28
  add_steps(find_checks(:default))
29
29
  add_steps(find_checks(:pre_upgrade))
30
+ add_step(Checks::CheckIpv6Disable)
30
31
  add_step(Checks::Disk::AvailableSpacePostgresql13)
31
32
  add_step(Checks::Repositories::Validate.new(:version => '6.16'))
32
33
  add_step(Checks::CheckOrganizationContentAccessMode)
@@ -98,6 +99,7 @@ module Scenarios::Satellite_6_16
98
99
  add_steps(find_checks(:default))
99
100
  add_steps(find_checks(:post_upgrade))
100
101
  add_step(Procedures::Packages::CheckForReboot)
102
+ add_step(Procedures::Pulpcore::ContainerHandleImageMetadata)
101
103
  end
102
104
  end
103
105
  end
@@ -56,16 +56,6 @@ module ForemanMaintain
56
56
  !disable_self_upgrade?
57
57
  end
58
58
 
59
- subcommand 'list-versions', 'List versions this system is upgradable to' do
60
- disable_self_upgrade_option
61
-
62
- def execute
63
- ForemanMaintain.validate_downstream_packages
64
- ForemanMaintain.perform_self_upgrade if allow_self_upgrade?
65
- print_versions(UpgradeRunner.available_targets)
66
- end
67
- end
68
-
69
59
  subcommand 'check', 'Run pre-upgrade checks before upgrading to specified version' do
70
60
  target_version_option
71
61
  interactive_option
@@ -41,12 +41,6 @@ module ForemanMaintain
41
41
  raise NotImplementedError
42
42
  end
43
43
 
44
- def config_files
45
- [
46
- '/etc/systemd/system/postgresql.service',
47
- ]
48
- end
49
-
50
44
  def local?(config = configuration)
51
45
  ['localhost', '127.0.0.1', `hostname`.strip].include? config['host']
52
46
  end
@@ -100,7 +100,7 @@ module ForemanMaintain
100
100
  end
101
101
 
102
102
  def packages_action(action, packages, options = {})
103
- options.validate_options!(:assumeyes, :options, :download_only)
103
+ options.validate_options!(:assumeyes, :options, :download_only, :enabled_repos)
104
104
  case action
105
105
  when :install
106
106
  package_manager.install(packages, :assumeyes => options[:assumeyes])
@@ -108,7 +108,8 @@ module ForemanMaintain
108
108
  package_manager.update(
109
109
  packages,
110
110
  :assumeyes => options[:assumeyes],
111
- :download_only => options[:download_only]
111
+ :download_only => options[:download_only],
112
+ :enabled_repos => options[:enabled_repos]
112
113
  )
113
114
  when :remove
114
115
  package_manager.remove(packages, :assumeyes => options[:assumeyes])
@@ -19,10 +19,12 @@ module ForemanMaintain::PackageManager
19
19
  apt_action('remove', packages, :assumeyes => assumeyes)
20
20
  end
21
21
 
22
- def update(packages = [], assumeyes: false, download_only: false)
22
+ # rubocop:disable Lint/UnusedMethodArgument
23
+ def update(packages = [], assumeyes: false, download_only: false, enabled_repos: [])
23
24
  action = packages.any? ? '--only-upgrade install' : 'upgrade'
24
25
  apt_action(action, packages, :assumeyes => assumeyes, :download_only => download_only)
25
26
  end
27
+ # rubocop:enable Lint/UnusedMethodArgument
26
28
 
27
29
  def clean_cache(assumeyes: false)
28
30
  apt_action('clean', [], :assumeyes => assumeyes)
@@ -59,12 +59,13 @@ module ForemanMaintain::PackageManager
59
59
  dnf_action('remove', packages, assumeyes: assumeyes)
60
60
  end
61
61
 
62
- def update(packages = [], assumeyes: false, download_only: false)
62
+ def update(packages = [], assumeyes: false, download_only: false, enabled_repos: [])
63
63
  dnf_action(
64
64
  'update',
65
65
  packages,
66
66
  assumeyes: assumeyes,
67
- download_only: download_only
67
+ download_only: download_only,
68
+ enabled_repos: enabled_repos
68
69
  )
69
70
  end
70
71
 
@@ -132,14 +133,18 @@ module ForemanMaintain::PackageManager
132
133
 
133
134
  private
134
135
 
135
- # rubocop:disable Layout/LineLength, Metrics/ParameterLists
136
- def dnf_action(action, packages, with_status: false, assumeyes: false, dnf_options: [], valid_exit_statuses: [0], download_only: false)
136
+ # rubocop:disable Layout/LineLength, Metrics/ParameterLists, Metrics/MethodLength
137
+ def dnf_action(action, packages, with_status: false, assumeyes: false, dnf_options: [], valid_exit_statuses: [0], download_only: false, enabled_repos: [])
137
138
  packages = [packages].flatten(1)
138
139
 
139
140
  dnf_options << '-y' if assumeyes
140
141
  dnf_options << '--downloadonly' if download_only
141
142
  dnf_options << '--disableplugin=foreman-protector'
142
143
 
144
+ enabled_repos.map do |id|
145
+ dnf_options << "--enablerepo=#{id}"
146
+ end
147
+
143
148
  command = ['dnf', dnf_options.join(' '), action]
144
149
 
145
150
  command.push(packages.join(' ')) unless packages.empty?
@@ -158,7 +163,7 @@ module ForemanMaintain::PackageManager
158
163
  )
159
164
  end
160
165
  end
161
- # rubocop:enable Layout/LineLength, Metrics/ParameterLists
166
+ # rubocop:enable Layout/LineLength, Metrics/ParameterLists, Metrics/MethodLength
162
167
 
163
168
  def protector_config
164
169
  File.exist?(protector_config_file) ? File.read(protector_config_file) : ''
@@ -183,24 +183,7 @@ module ForemanMaintain
183
183
 
184
184
  def validate_hostname?
185
185
  # make sure that the system hostname is the same as the backup
186
- hostname_from_metadata = metadata.fetch('hostname', nil)
187
- if hostname_from_metadata
188
- hostname_from_metadata == hostname
189
- else
190
- config_tarball = file_map[:config_files][:path]
191
- tar_cmd = "tar zxf #{config_tarball} etc/httpd/conf/httpd.conf --to-stdout --occurrence=1"
192
- status, httpd_config = execute_with_status(tar_cmd)
193
-
194
- # Incremental backups sometimes don't include httpd.conf. Since a "base" backup
195
- # is restored before an incremental, we can assume that the hostname is checked
196
- # during the base backup restore
197
- if status == 0
198
- match = httpd_config.match(/\s*ServerName\s+"*([^ "]+)"*\s*$/)
199
- match ? match[1] == hostname : false
200
- else
201
- true
202
- end
203
- end
186
+ metadata.fetch('hostname', nil) == hostname
204
187
  end
205
188
 
206
189
  def validate_interfaces
@@ -243,7 +226,7 @@ module ForemanMaintain
243
226
  def sql_dump_files_exist?
244
227
  file_map[:foreman_dump][:present] ||
245
228
  file_map[:candlepin_dump][:present] ||
246
- (feature(:pulpcore_database) && file_map[:pulpcore_dump][:present])
229
+ file_map[:pulpcore_dump][:present]
247
230
  end
248
231
 
249
232
  def incremental?
@@ -262,10 +245,6 @@ module ForemanMaintain
262
245
  installed_rpms.any? { |rpm| rpm.start_with?('puppetserver-') }
263
246
  end
264
247
 
265
- def with_qpidd?
266
- installed_rpms.any? { |rpm| rpm.start_with?('qpid-cpp-server-') }
267
- end
268
-
269
248
  def source_os_version
270
249
  metadata.fetch('os_version', 'unknown')
271
250
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '1.6.7'.freeze
2
+ VERSION = '1.6.8'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_maintain
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.7
4
+ version: 1.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-06 00:00:00.000000000 Z
11
+ date: 2024-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp
@@ -160,6 +160,7 @@ files:
160
160
  - definitions/checks/backup/certs_tar_exist.rb
161
161
  - definitions/checks/candlepin/db_up.rb
162
162
  - definitions/checks/check_hotfix_installed.rb
163
+ - definitions/checks/check_ipv6_disable.rb
163
164
  - definitions/checks/check_tmout.rb
164
165
  - definitions/checks/disk/available_space.rb
165
166
  - definitions/checks/disk/available_space_candlepin.rb
@@ -211,7 +212,6 @@ files:
211
212
  - definitions/features/foreman_proxy.rb
212
213
  - definitions/features/foreman_server.rb
213
214
  - definitions/features/foreman_tasks.rb
214
- - definitions/features/gofer.rb
215
215
  - definitions/features/hammer.rb
216
216
  - definitions/features/installer.rb
217
217
  - definitions/features/instance.rb
@@ -274,7 +274,7 @@ files:
274
274
  - definitions/procedures/packages/unlock_versions.rb
275
275
  - definitions/procedures/packages/update.rb
276
276
  - definitions/procedures/packages/update_all_confirmation.rb
277
- - definitions/procedures/pulpcore/migrate.rb
277
+ - definitions/procedures/pulpcore/container_handle_image_metadata.rb
278
278
  - definitions/procedures/pulpcore/trim_rpm_changelogs.rb
279
279
  - definitions/procedures/puppet/delete_empty_ca_cert_request_files.rb
280
280
  - definitions/procedures/puppet/remove_puppet.rb
@@ -286,7 +286,6 @@ files:
286
286
  - definitions/procedures/repositories/enable.rb
287
287
  - definitions/procedures/repositories/setup.rb
288
288
  - definitions/procedures/restore/candlepin_dump.rb
289
- - definitions/procedures/restore/candlepin_reset_migrations.rb
290
289
  - definitions/procedures/restore/configs.rb
291
290
  - definitions/procedures/restore/confirmation.rb
292
291
  - definitions/procedures/restore/drop_databases.rb
@@ -297,7 +296,6 @@ files:
297
296
  - definitions/procedures/restore/pulpcore_dump.rb
298
297
  - definitions/procedures/restore/reindex_databases.rb
299
298
  - definitions/procedures/restore/required_packages.rb
300
- - definitions/procedures/selinux/set_file_security.rb
301
299
  - definitions/procedures/service/base.rb
302
300
  - definitions/procedures/service/daemon_reload.rb
303
301
  - definitions/procedures/service/disable.rb
@@ -319,9 +317,7 @@ files:
319
317
  - definitions/scenarios/services.rb
320
318
  - definitions/scenarios/update.rb
321
319
  - definitions/scenarios/upgrade_to_capsule_6_16.rb
322
- - definitions/scenarios/upgrade_to_capsule_6_16_z.rb
323
320
  - definitions/scenarios/upgrade_to_satellite_6_16.rb
324
- - definitions/scenarios/upgrade_to_satellite_6_16_z.rb
325
321
  - extras/foreman-maintain.sh
326
322
  - extras/foreman_protector/dnf/foreman-protector.py
327
323
  - extras/foreman_protector/foreman-protector.conf
@@ -1,16 +0,0 @@
1
- class Features::Gofer < ForemanMaintain::Feature
2
- metadata do
3
- label :gofer
4
-
5
- confine do
6
- find_package('gofer') &&
7
- ForemanMaintain::Utils::Service::Systemd.new('goferd', 0).enabled?
8
- end
9
- end
10
-
11
- def services
12
- [
13
- system_service('goferd', 30),
14
- ]
15
- end
16
- end
@@ -1,24 +0,0 @@
1
- module Procedures::Pulpcore
2
- class Migrate < ForemanMaintain::Procedure
3
- include ForemanMaintain::Concerns::SystemService
4
- include ForemanMaintain::Concerns::PulpCommon
5
-
6
- metadata do
7
- description 'Migrate pulpcore db'
8
- for_feature :pulpcore
9
- end
10
-
11
- def run
12
- with_spinner('Migrating pulpcore') do |spinner|
13
- necessary_services = feature(:pulpcore_database).services
14
- pulp_services = feature(:pulpcore).services
15
-
16
- feature(:service).handle_services(spinner, 'start', :only => necessary_services)
17
- feature(:service).handle_services(spinner, 'stop', :only => pulp_services)
18
-
19
- spinner.update('Migrating pulpcore database')
20
- execute!(pulpcore_manager('migrate --noinput'))
21
- end
22
- end
23
- end
24
- end
@@ -1,14 +0,0 @@
1
- module Procedures::Restore
2
- class CandlepinResetMigrations < ForemanMaintain::Procedure
3
- metadata do
4
- description 'Ensure Candlepin runs all migrations after restoring the database'
5
- confine do
6
- feature(:candlepin_database)
7
- end
8
- end
9
-
10
- def run
11
- FileUtils.rm_f('/var/lib/candlepin/.puppet-candlepin-rpm-version')
12
- end
13
- end
14
- end
@@ -1,25 +0,0 @@
1
- module Procedures::Selinux
2
- class SetFileSecurity < ForemanMaintain::Procedure
3
- metadata do
4
- description 'Setting file security'
5
-
6
- param :incremental_backup,
7
- 'Is the backup incremental?',
8
- :required => true
9
- manual_detection
10
- confine do
11
- File.directory?('/sys/fs/selinux')
12
- end
13
- end
14
-
15
- def run
16
- with_spinner('Restoring SELinux context') do |spinner|
17
- if @incremental_backup
18
- spinner.update('Skipping for incremental update')
19
- else
20
- execute!('restorecon -Rn /')
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,97 +0,0 @@
1
- module Scenarios::Capsule_6_16_z
2
- class Abstract < ForemanMaintain::Scenario
3
- def self.upgrade_metadata(&block)
4
- metadata do
5
- tags :upgrade_scenario
6
- confine do
7
- feature(:capsule) &&
8
- (feature(:capsule).current_minor_version == '6.16' || \
9
- ForemanMaintain.upgrade_in_progress == '6.16.z')
10
- end
11
- instance_eval(&block)
12
- end
13
- end
14
-
15
- def target_version
16
- '6.16.z'
17
- end
18
- end
19
-
20
- class PreUpgradeCheck < Abstract
21
- upgrade_metadata do
22
- description 'Checks before upgrading to Capsule 6.16.z'
23
- tags :pre_upgrade_checks
24
- run_strategy :fail_slow
25
- end
26
-
27
- def compose
28
- add_steps(find_checks(:default))
29
- add_steps(find_checks(:pre_upgrade))
30
- add_step(Checks::Repositories::Validate.new(:version => '6.16'))
31
- end
32
- end
33
-
34
- class PreMigrations < Abstract
35
- upgrade_metadata do
36
- description 'Procedures before migrating to Capsule 6.16.z'
37
- tags :pre_migrations
38
- end
39
-
40
- def compose
41
- add_step(Procedures::Repositories::Setup.new(:version => '6.16'))
42
- if el8?
43
- modules_to_enable = ["satellite-capsule:#{el_short_name}"]
44
- add_step(Procedures::Packages::EnableModules.new(:module_names => modules_to_enable))
45
- end
46
- add_step(Procedures::Packages::Update.new(
47
- :assumeyes => true,
48
- :download_only => true
49
- ))
50
- add_steps(find_procedures(:pre_migrations))
51
- end
52
- end
53
-
54
- class Migrations < Abstract
55
- upgrade_metadata do
56
- description 'Migration scripts to Capsule 6.16.z'
57
- tags :migrations
58
- end
59
-
60
- def set_context_mapping
61
- context.map(:assumeyes, Procedures::Installer::Run => :assumeyes)
62
- end
63
-
64
- def compose
65
- add_step(Procedures::Service::Stop.new)
66
- add_step(Procedures::Packages::Update.new(:assumeyes => true, :clean_cache => false))
67
- add_step_with_context(Procedures::Installer::Run)
68
- end
69
- end
70
-
71
- class PostMigrations < Abstract
72
- upgrade_metadata do
73
- description 'Procedures after migrating to Capsule 6.16.z'
74
- tags :post_migrations
75
- end
76
-
77
- def compose
78
- add_step(Procedures::RefreshFeatures)
79
- add_step(Procedures::Service::Start.new)
80
- add_steps(find_procedures(:post_migrations))
81
- end
82
- end
83
-
84
- class PostUpgradeChecks < Abstract
85
- upgrade_metadata do
86
- description 'Checks after upgrading to Capsule 6.16.z'
87
- tags :post_upgrade_checks
88
- run_strategy :fail_slow
89
- end
90
-
91
- def compose
92
- add_steps(find_checks(:default))
93
- add_steps(find_checks(:post_upgrade))
94
- add_step(Procedures::Packages::CheckForReboot)
95
- end
96
- end
97
- end
@@ -1,98 +0,0 @@
1
- module Scenarios::Satellite_6_16_z
2
- class Abstract < ForemanMaintain::Scenario
3
- def self.upgrade_metadata(&block)
4
- metadata do
5
- tags :upgrade_scenario
6
- confine do
7
- feature(:satellite) &&
8
- (feature(:satellite).current_minor_version == '6.16' || \
9
- ForemanMaintain.upgrade_in_progress == '6.16.z')
10
- end
11
- instance_eval(&block)
12
- end
13
- end
14
-
15
- def target_version
16
- '6.16.z'
17
- end
18
- end
19
-
20
- class PreUpgradeCheck < Abstract
21
- upgrade_metadata do
22
- description 'Checks before upgrading to Satellite 6.16.z'
23
- tags :pre_upgrade_checks
24
- run_strategy :fail_slow
25
- end
26
-
27
- def compose
28
- add_steps(find_checks(:default))
29
- add_steps(find_checks(:pre_upgrade))
30
- add_step(Checks::Repositories::Validate.new(:version => '6.16'))
31
- end
32
- end
33
-
34
- class PreMigrations < Abstract
35
- upgrade_metadata do
36
- description 'Procedures before migrating to Satellite 6.16.z'
37
- tags :pre_migrations
38
- end
39
-
40
- def compose
41
- add_step(Procedures::Repositories::Setup.new(:version => '6.16'))
42
- if el8?
43
- modules_to_enable = ["satellite:#{el_short_name}"]
44
- add_step(Procedures::Packages::EnableModules.new(:module_names => modules_to_enable))
45
- end
46
- add_step(Procedures::Packages::Update.new(
47
- :assumeyes => true,
48
- :download_only => true
49
- ))
50
- add_steps(find_procedures(:pre_migrations))
51
- end
52
- end
53
-
54
- class Migrations < Abstract
55
- upgrade_metadata do
56
- description 'Migration scripts to Satellite 6.16.z'
57
- tags :migrations
58
- end
59
-
60
- def set_context_mapping
61
- context.map(:assumeyes, Procedures::Installer::Run => :assumeyes)
62
- end
63
-
64
- def compose
65
- add_step(Procedures::Service::Stop.new)
66
- add_step(Procedures::Packages::Update.new(:assumeyes => true, :clean_cache => false))
67
- add_step_with_context(Procedures::Installer::Run)
68
- add_step(Procedures::Installer::UpgradeRakeTask)
69
- end
70
- end
71
-
72
- class PostMigrations < Abstract
73
- upgrade_metadata do
74
- description 'Procedures after migrating to Satellite 6.16.z'
75
- tags :post_migrations
76
- end
77
-
78
- def compose
79
- add_step(Procedures::RefreshFeatures)
80
- add_step(Procedures::Service::Start.new)
81
- add_steps(find_procedures(:post_migrations))
82
- end
83
- end
84
-
85
- class PostUpgradeChecks < Abstract
86
- upgrade_metadata do
87
- description 'Checks after upgrading to Satellite 6.16.z'
88
- tags :post_upgrade_checks
89
- run_strategy :fail_slow
90
- end
91
-
92
- def compose
93
- add_steps(find_checks(:default))
94
- add_steps(find_checks(:post_upgrade))
95
- add_step(Procedures::Packages::CheckForReboot)
96
- end
97
- end
98
- end