foreman_maintain 1.6.6 → 1.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -5
- data/definitions/checks/check_ipv6_disable.rb +23 -0
- data/definitions/features/capsule.rb +1 -2
- data/definitions/features/dynflow_sidekiq.rb +1 -6
- data/definitions/features/foreman_install.rb +1 -1
- data/definitions/features/foreman_server.rb +0 -1
- data/definitions/features/foreman_tasks.rb +0 -8
- data/definitions/features/instance.rb +0 -1
- data/definitions/features/katello.rb +0 -15
- data/definitions/procedures/hammer_setup.rb +3 -0
- data/definitions/procedures/packages/update.rb +2 -2
- data/definitions/procedures/pulpcore/container_handle_image_metadata.rb +26 -0
- data/definitions/procedures/repositories/setup.rb +1 -1
- data/definitions/procedures/restore/configs.rb +0 -19
- data/definitions/procedures/restore/drop_databases.rb +1 -3
- data/definitions/procedures/restore/reindex_databases.rb +6 -0
- data/definitions/procedures/restore/required_packages.rb +0 -1
- data/definitions/scenarios/backup.rb +9 -20
- data/definitions/scenarios/foreman_upgrade.rb +142 -0
- data/definitions/scenarios/restore.rb +11 -29
- data/definitions/scenarios/self_upgrade.rb +1 -4
- data/definitions/scenarios/update.rb +2 -1
- data/definitions/scenarios/upgrade_to_capsule_6_16.rb +2 -0
- data/definitions/scenarios/upgrade_to_satellite_6_16.rb +2 -0
- data/lib/foreman_maintain/cli/update_command.rb +7 -5
- data/lib/foreman_maintain/cli/upgrade_command.rb +0 -10
- data/lib/foreman_maintain/concerns/base_database.rb +0 -6
- data/lib/foreman_maintain/concerns/system_helpers.rb +3 -3
- data/lib/foreman_maintain/package_manager/apt.rb +1 -1
- data/lib/foreman_maintain/package_manager/dnf.rb +10 -6
- data/lib/foreman_maintain/utils/backup.rb +2 -23
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +5 -10
- data/definitions/features/gofer.rb +0 -16
- data/definitions/procedures/pulpcore/migrate.rb +0 -24
- data/definitions/procedures/restore/candlepin_reset_migrations.rb +0 -14
- data/definitions/procedures/selinux/set_file_security.rb +0 -25
- data/definitions/scenarios/upgrade_to_capsule_6_16_z.rb +0 -97
- data/definitions/scenarios/upgrade_to_foreman_nightly.rb +0 -91
- data/definitions/scenarios/upgrade_to_katello_nightly.rb +0 -96
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 693bf5fa41d37437188c4990278301d1965819e37fad7b0dc680e1fdff8f8631
|
4
|
+
data.tar.gz: d56694b7ed8093eeaa814fdf950f5c308d76eeffbf97a654ecbb20ef55611759
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
60
|
-
|
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
|
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
|
-
|
18
|
-
].flatten
|
13
|
+
]
|
19
14
|
end
|
20
15
|
|
21
16
|
def services
|
@@ -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
|
@@ -6,9 +6,9 @@ module Procedures::Packages
|
|
6
6
|
param :force, 'Do not skip if package is installed', :flag => true, :default => false
|
7
7
|
param :warn_on_errors, 'Do not interrupt scenario on failure',
|
8
8
|
:flag => true, :default => false
|
9
|
-
param :dnf_options, 'Extra dnf options if any', :array => true, :default => []
|
10
9
|
param :download_only, 'Download and cache packages only', :flag => true, :default => false
|
11
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
|
12
12
|
end
|
13
13
|
|
14
14
|
def run
|
@@ -16,8 +16,8 @@ module Procedures::Packages
|
|
16
16
|
package_manager.clean_cache(:assumeyes => assumeyes_val) if @clean_cache
|
17
17
|
opts = {
|
18
18
|
:assumeyes => assumeyes_val,
|
19
|
-
:options => @dnf_options,
|
20
19
|
:download_only => @download_only,
|
20
|
+
:enabled_repos => @enabled_repos,
|
21
21
|
}
|
22
22
|
packages_action(:update, @packages, opts)
|
23
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
|
@@ -3,7 +3,7 @@ module Procedures::Repositories
|
|
3
3
|
metadata do
|
4
4
|
description 'Setup repositories'
|
5
5
|
confine do
|
6
|
-
feature(:instance).downstream || feature(:
|
6
|
+
feature(:instance).downstream || feature(:instance).upstream_install
|
7
7
|
end
|
8
8
|
param :version,
|
9
9
|
'Version for which repositories needs to be setup',
|
@@ -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
|
-
|
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
|
-
|
23
|
-
|
24
|
-
add_step_with_context(Procedures::Backup::Metadata, :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
|
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
|
-
|
153
|
-
|
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
|
|
@@ -0,0 +1,142 @@
|
|
1
|
+
module Scenarios::ForemanUpgrade
|
2
|
+
class Abstract < ForemanMaintain::Scenario
|
3
|
+
def self.upgrade_metadata(&block)
|
4
|
+
metadata do
|
5
|
+
tags :upgrade_scenario
|
6
|
+
confine do
|
7
|
+
feature(:foreman_install)
|
8
|
+
end
|
9
|
+
instance_eval(&block)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def target_version
|
14
|
+
'nightly'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class PreUpgradeCheck < Abstract
|
19
|
+
upgrade_metadata do
|
20
|
+
description 'Checks before upgrading'
|
21
|
+
tags :pre_upgrade_checks
|
22
|
+
run_strategy :fail_slow
|
23
|
+
end
|
24
|
+
|
25
|
+
# rubocop:disable Metrics/MethodLength
|
26
|
+
def compose
|
27
|
+
add_steps(
|
28
|
+
Checks::Foreman::FactsNames, # if Foreman database present
|
29
|
+
Checks::ForemanProxy::CheckTftpStorage, # if Satellite with foreman-proxy+tftp
|
30
|
+
Checks::ForemanProxy::VerifyDhcpConfigSyntax, # if foreman-proxy+dhcp-isc
|
31
|
+
Checks::ForemanTasks::NotPaused, # if foreman-tasks present
|
32
|
+
Checks::Puppet::VerifyNoEmptyCacertRequests, # if puppetserver
|
33
|
+
Checks::ServerPing,
|
34
|
+
Checks::ServicesUp,
|
35
|
+
Checks::SystemRegistration,
|
36
|
+
Checks::CheckHotfixInstalled,
|
37
|
+
Checks::CheckTmout,
|
38
|
+
Checks::CheckUpstreamRepository,
|
39
|
+
Checks::Disk::AvailableSpace,
|
40
|
+
Checks::Disk::AvailableSpaceCandlepin, # if candlepin
|
41
|
+
Checks::Foreman::ValidateExternalDbVersion, # if external database
|
42
|
+
Checks::Foreman::CheckCorruptedRoles,
|
43
|
+
Checks::Foreman::CheckDuplicatePermissions,
|
44
|
+
Checks::Foreman::TuningRequirements, # if katello present
|
45
|
+
Checks::ForemanOpenscap::InvalidReportAssociations, # if foreman-openscap
|
46
|
+
Checks::ForemanTasks::Invalid::CheckOld, # if foreman-tasks
|
47
|
+
Checks::ForemanTasks::Invalid::CheckPendingState, # if foreman-tasks
|
48
|
+
Checks::ForemanTasks::Invalid::CheckPlanningState, # if foreman-tasks
|
49
|
+
Checks::ForemanTasks::NotRunning, # if foreman-tasks
|
50
|
+
Checks::NonRhPackages,
|
51
|
+
Checks::PackageManager::Dnf::ValidateDnfConfig,
|
52
|
+
Checks::Repositories::CheckNonRhRepository,
|
53
|
+
Checks::Repositories::Validate
|
54
|
+
)
|
55
|
+
end
|
56
|
+
# rubocop:enable Metrics/MethodLength
|
57
|
+
end
|
58
|
+
|
59
|
+
class PreMigrations < Abstract
|
60
|
+
upgrade_metadata do
|
61
|
+
description 'Procedures before upgrading'
|
62
|
+
tags :pre_migrations
|
63
|
+
end
|
64
|
+
|
65
|
+
def compose
|
66
|
+
add_steps(
|
67
|
+
Procedures::MaintenanceMode::EnableMaintenanceMode,
|
68
|
+
Procedures::Crond::Stop,
|
69
|
+
Procedures::SyncPlans::Disable
|
70
|
+
)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
class Migrations < Abstract
|
75
|
+
upgrade_metadata do
|
76
|
+
description 'Upgrade steps'
|
77
|
+
tags :migrations
|
78
|
+
run_strategy :fail_fast
|
79
|
+
end
|
80
|
+
|
81
|
+
def set_context_mapping
|
82
|
+
context.map(:assumeyes, Procedures::Installer::Run => :assumeyes)
|
83
|
+
end
|
84
|
+
|
85
|
+
def compose
|
86
|
+
add_step(Procedures::Repositories::Setup.new(:version => 'nightly'))
|
87
|
+
if el8?
|
88
|
+
modules_to_switch = ['postgresql:13']
|
89
|
+
add_step(Procedures::Packages::SwitchModules.new(:module_names => modules_to_switch))
|
90
|
+
end
|
91
|
+
|
92
|
+
add_step(Procedures::Packages::Update.new(
|
93
|
+
:assumeyes => true,
|
94
|
+
:download_only => true
|
95
|
+
))
|
96
|
+
add_step(Procedures::Service::Stop.new)
|
97
|
+
add_step(Procedures::Packages::Update.new(:assumeyes => true, :clean_cache => false))
|
98
|
+
|
99
|
+
add_step_with_context(Procedures::Installer::Run)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
class PostMigrations < Abstract
|
104
|
+
upgrade_metadata do
|
105
|
+
description 'Post upgrade procedures'
|
106
|
+
tags :post_migrations
|
107
|
+
end
|
108
|
+
|
109
|
+
def compose
|
110
|
+
add_steps(
|
111
|
+
Procedures::RefreshFeatures,
|
112
|
+
Procedures::Service::Start,
|
113
|
+
Procedures::Crond::Start,
|
114
|
+
Procedures::SyncPlans::Enable,
|
115
|
+
Procedures::MaintenanceMode::DisableMaintenanceMode
|
116
|
+
)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
class PostUpgradeChecks < Abstract
|
121
|
+
upgrade_metadata do
|
122
|
+
description 'Checks after upgrading'
|
123
|
+
tags :post_upgrade_checks
|
124
|
+
run_strategy :fail_slow
|
125
|
+
end
|
126
|
+
|
127
|
+
def compose
|
128
|
+
add_steps(
|
129
|
+
Checks::Foreman::FactsNames, # if Foreman database present
|
130
|
+
Checks::ForemanProxy::CheckTftpStorage, # if Satellite with foreman-proxy+tftp
|
131
|
+
Checks::ForemanProxy::VerifyDhcpConfigSyntax, # if foreman-proxy+dhcp-isc
|
132
|
+
Checks::ForemanTasks::NotPaused, # if foreman-tasks present
|
133
|
+
Checks::Puppet::VerifyNoEmptyCacertRequests, # if puppetserver
|
134
|
+
Checks::ServerPing,
|
135
|
+
Checks::ServicesUp,
|
136
|
+
Checks::SystemRegistration,
|
137
|
+
Procedures::Packages::CheckForReboot,
|
138
|
+
Procedures::Pulpcore::ContainerHandleImageMetadata
|
139
|
+
)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
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
|
-
|
40
|
-
if backup.sql_dump_files_exist?
|
41
|
-
|
42
|
-
|
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
|
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
|
-
|
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
|
@@ -59,7 +60,7 @@ module Scenarios::Update
|
|
59
60
|
add_steps(
|
60
61
|
Procedures::Packages::Update.new(
|
61
62
|
:assumeyes => true,
|
62
|
-
:
|
63
|
+
:download_only => true
|
63
64
|
),
|
64
65
|
Procedures::MaintenanceMode::EnableMaintenanceMode,
|
65
66
|
Procedures::Crond::Stop,
|
@@ -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
|