foreman_maintain 1.6.10 → 1.6.12
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/definitions/checks/backup/incremental_parent_type.rb +36 -0
- data/definitions/checks/foreman/check_tuning_requirements.rb +2 -2
- data/definitions/checks/system_registration.rb +1 -1
- data/definitions/features/capsule.rb +4 -0
- data/definitions/features/foreman_database.rb +6 -1
- data/definitions/features/satellite.rb +4 -0
- data/definitions/procedures/backup/prepare_directory.rb +17 -5
- data/definitions/procedures/foreman_tasks/ui_investigate.rb +1 -1
- data/definitions/procedures/knowledge_base_article.rb +1 -1
- data/definitions/procedures/packages/update_all_confirmation.rb +1 -1
- data/definitions/procedures/sync_plans/disable.rb +0 -1
- data/definitions/procedures/sync_plans/enable.rb +0 -2
- data/definitions/scenarios/backup.rb +6 -2
- data/definitions/scenarios/foreman_upgrade.rb +3 -1
- data/definitions/scenarios/restore.rb +1 -1
- data/definitions/scenarios/satellite_upgrade.rb +68 -23
- data/definitions/scenarios/services.rb +5 -5
- data/lib/foreman_maintain/cli/upgrade_command.rb +1 -1
- data/lib/foreman_maintain/concerns/base_database.rb +1 -1
- data/lib/foreman_maintain/concerns/finders.rb +0 -4
- data/lib/foreman_maintain/config.rb +5 -0
- data/lib/foreman_maintain/core_ext.rb +0 -12
- data/lib/foreman_maintain/detector.rb +1 -0
- data/lib/foreman_maintain/reporter/cli_reporter.rb +23 -23
- data/lib/foreman_maintain/reporter.rb +1 -1
- data/lib/foreman_maintain/update_runner.rb +4 -4
- data/lib/foreman_maintain/upgrade_runner.rb +7 -7
- data/lib/foreman_maintain/utils/backup.rb +7 -0
- data/lib/foreman_maintain/utils/service/systemd.rb +1 -5
- data/lib/foreman_maintain/version.rb +1 -1
- data/lib/foreman_maintain.rb +5 -4
- metadata +3 -4
- data/definitions/procedures/pulpcore/trim_rpm_changelogs.rb +0 -22
- data/definitions/procedures/restore/postgres_owner.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7357cec0fa22b76e7ae0c7d2da85e2cb20f52aeb2ded53e9a2ddf21c56b7a037
|
4
|
+
data.tar.gz: 2116a2048dc315a55bb7fb8789e9961f2a4fc91a4afa5b614dd237eb7825da37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a14594384dd60070ffde442e87423522ebde81e3f9580ac88c74028bb33a232bbe4bf57e7847d70768c82b375c5067509dfefed5ecc7c79023f66a2c904af11
|
7
|
+
data.tar.gz: 07fc2c9e32f3d16171a99839562dd01210190c00de03414859dfb84492401168d2127d84974ac750c7b5aaa47a927bd6ea42cc47237249c908ac56f96749e7d0
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Checks::Backup
|
2
|
+
class IncrementalParentType < ForemanMaintain::Check
|
3
|
+
metadata do
|
4
|
+
description 'Check if the incremental backup has the right type'
|
5
|
+
tags :backup
|
6
|
+
param :incremental_dir, 'Path to existing backup directory'
|
7
|
+
param :online_backup, 'Select for online backup', :flag => true, :default => false
|
8
|
+
param :sql_tar, 'Will backup include PostgreSQL tarball', :flag => true, :default => false
|
9
|
+
manual_detection
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
return unless @incremental_dir
|
14
|
+
|
15
|
+
backup = ForemanMaintain::Utils::Backup.new(@incremental_dir)
|
16
|
+
|
17
|
+
existing_type = backup.backup_type
|
18
|
+
new_type = if @online_backup
|
19
|
+
ForemanMaintain::Utils::Backup::ONLINE_BACKUP
|
20
|
+
else
|
21
|
+
ForemanMaintain::Utils::Backup::OFFLINE_BACKUP
|
22
|
+
end
|
23
|
+
msg = "The existing backup is an #{existing_type} backup, "\
|
24
|
+
"but an #{new_type} backup was requested."
|
25
|
+
assert(existing_type == new_type, msg)
|
26
|
+
|
27
|
+
unless @online_backup
|
28
|
+
existing_sql = backup.sql_tar_files_exist? ? 'tarball' : 'dump'
|
29
|
+
new_sql = @sql_tar ? 'tarball' : 'dump'
|
30
|
+
msg = "The existing backup has PostgreSQL as a #{existing_sql}, "\
|
31
|
+
"but the new one will have a #{new_sql}."
|
32
|
+
assert(existing_sql == new_sql, msg)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -70,8 +70,8 @@ module Checks
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def failure_message(tuning_profile)
|
73
|
-
|
74
|
-
|
73
|
+
<<~MESSAGE
|
74
|
+
\nERROR: The installer is configured to use the #{tuning_profile} tuning profile and does not meet the requirements.
|
75
75
|
MESSAGE
|
76
76
|
end
|
77
77
|
end
|
@@ -35,7 +35,12 @@ class Features::ForemanDatabase < ForemanMaintain::Feature
|
|
35
35
|
private
|
36
36
|
|
37
37
|
def load_configuration
|
38
|
-
config =
|
38
|
+
config = if File.exist?('/etc/foreman/database.yml')
|
39
|
+
YAML.load(File.read(FOREMAN_DB_CONFIG))
|
40
|
+
else
|
41
|
+
{ 'production' => {} }
|
42
|
+
end
|
43
|
+
|
39
44
|
@configuration = config['production']
|
40
45
|
@configuration['host'] ||= 'localhost'
|
41
46
|
@configuration
|
@@ -6,18 +6,29 @@ module Procedures::Backup
|
|
6
6
|
param :backup_dir, 'Directory where to backup to', :required => true
|
7
7
|
param :preserve_dir, 'Directory where to backup to', :flag => true
|
8
8
|
param :incremental_dir, 'Changes since specified backup only'
|
9
|
+
param :online_backup, 'Select for online backup', :flag => true, :default => false
|
9
10
|
end
|
10
11
|
|
12
|
+
# rubocop:disable Metrics/MethodLength
|
11
13
|
def run
|
12
|
-
puts "Creating backup folder #{@backup_dir}"
|
13
|
-
|
14
14
|
unless @preserve_dir
|
15
|
+
puts "Creating backup folder #{@backup_dir}"
|
16
|
+
|
15
17
|
FileUtils.mkdir_p @backup_dir
|
16
18
|
FileUtils.chmod_R 0o770, @backup_dir
|
17
|
-
end
|
18
19
|
|
19
|
-
|
20
|
-
|
20
|
+
if feature(:instance).postgresql_local? && @online_backup
|
21
|
+
begin
|
22
|
+
FileUtils.chown_R(nil, 'postgres', @backup_dir)
|
23
|
+
rescue Errno::EPERM
|
24
|
+
warn_msg = <<~MSG
|
25
|
+
#{@backup_dir} could not be made readable by the 'postgres' user.
|
26
|
+
This won't affect the backup procedure, but you have to ensure that
|
27
|
+
the 'postgres' user can read the data during restore.
|
28
|
+
MSG
|
29
|
+
set_status(:warning, warn_msg)
|
30
|
+
end
|
31
|
+
end
|
21
32
|
end
|
22
33
|
|
23
34
|
FileUtils.rm(Dir.glob(File.join(@backup_dir, '.*.snar'))) if @preserve_dir
|
@@ -30,5 +41,6 @@ module Procedures::Backup
|
|
30
41
|
end
|
31
42
|
end
|
32
43
|
end
|
44
|
+
# rubocop:enable Metrics/MethodLength
|
33
45
|
end
|
34
46
|
end
|
@@ -10,7 +10,7 @@ module Procedures::ForemanTasks
|
|
10
10
|
attr_reader :search_query
|
11
11
|
|
12
12
|
def run
|
13
|
-
ask(
|
13
|
+
ask(<<~MESSAGE)
|
14
14
|
Go to https://#{hostname}/foreman_tasks/tasks?search=#{CGI.escape(@search_query.to_s)}
|
15
15
|
press ENTER after the tasks are resolved.
|
16
16
|
MESSAGE
|
@@ -12,7 +12,7 @@ class Procedures::KnowledgeBaseArticle < ForemanMaintain::Procedure
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def run
|
15
|
-
ask(
|
15
|
+
ask(<<~MESSAGE)
|
16
16
|
Go to #{kcs_documents[@doc]}
|
17
17
|
please follow steps from above article to resolve this issue
|
18
18
|
press ENTER once done.
|
@@ -18,9 +18,13 @@ module ForemanMaintain::Scenarios
|
|
18
18
|
|
19
19
|
def compose
|
20
20
|
check_valid_strategy
|
21
|
+
add_step_with_context(Checks::Backup::IncrementalParentType,
|
22
|
+
:online_backup => strategy == :online,
|
23
|
+
:sql_tar => feature(:instance).postgresql_local?)
|
21
24
|
safety_confirmation
|
22
25
|
add_step_with_context(Procedures::Backup::AccessibilityConfirmation) if strategy == :offline
|
23
|
-
add_step_with_context(Procedures::Backup::PrepareDirectory
|
26
|
+
add_step_with_context(Procedures::Backup::PrepareDirectory,
|
27
|
+
:online_backup => strategy == :online)
|
24
28
|
add_step_with_context(Procedures::Backup::Metadata, :online_backup => strategy == :online)
|
25
29
|
|
26
30
|
case strategy
|
@@ -50,6 +54,7 @@ module ForemanMaintain::Scenarios
|
|
50
54
|
context.map(:preserve_dir,
|
51
55
|
Procedures::Backup::PrepareDirectory => :preserve_dir)
|
52
56
|
context.map(:incremental_dir,
|
57
|
+
Checks::Backup::IncrementalParentType => :incremental_dir,
|
53
58
|
Procedures::Backup::PrepareDirectory => :incremental_dir,
|
54
59
|
Procedures::Backup::Metadata => :incremental_dir)
|
55
60
|
context.map(:proxy_features,
|
@@ -136,7 +141,6 @@ module ForemanMaintain::Scenarios
|
|
136
141
|
def compose
|
137
142
|
if strategy == :offline
|
138
143
|
add_step_with_context(Procedures::Service::Start)
|
139
|
-
add_steps_with_context(find_procedures(:maintenance_mode_off))
|
140
144
|
end
|
141
145
|
add_step_with_context(Procedures::Backup::Clean)
|
142
146
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module Scenarios::
|
1
|
+
module Scenarios::Foreman
|
2
2
|
class Abstract < ForemanMaintain::Scenario
|
3
3
|
def self.upgrade_metadata(&block)
|
4
4
|
metadata do
|
@@ -38,6 +38,7 @@ module Scenarios::ForemanUpgrade
|
|
38
38
|
Checks::CheckUpstreamRepository,
|
39
39
|
Checks::Disk::AvailableSpace,
|
40
40
|
Checks::Disk::AvailableSpaceCandlepin, # if candlepin
|
41
|
+
Checks::Disk::AvailableSpacePostgresql13,
|
41
42
|
Checks::Foreman::ValidateExternalDbVersion, # if external database
|
42
43
|
Checks::Foreman::CheckCorruptedRoles,
|
43
44
|
Checks::Foreman::CheckDuplicatePermissions,
|
@@ -50,6 +51,7 @@ module Scenarios::ForemanUpgrade
|
|
50
51
|
Checks::NonRhPackages,
|
51
52
|
Checks::PackageManager::Dnf::ValidateDnfConfig,
|
52
53
|
Checks::Repositories::CheckNonRhRepository,
|
54
|
+
Checks::CheckOrganizationContentAccessMode,
|
53
55
|
Checks::Repositories::Validate
|
54
56
|
)
|
55
57
|
end
|
@@ -14,7 +14,7 @@ module ForemanMaintain::Scenarios
|
|
14
14
|
def compose
|
15
15
|
backup = ForemanMaintain::Utils::Backup.new(context.get(:backup_dir))
|
16
16
|
|
17
|
-
|
17
|
+
add_step(Checks::RootUser)
|
18
18
|
add_steps_with_context(Checks::Restore::ValidateBackup,
|
19
19
|
Checks::Restore::ValidateHostname,
|
20
20
|
Checks::Restore::ValidateInterfaces,
|
@@ -4,7 +4,7 @@ module Scenarios::Satellite
|
|
4
4
|
metadata do
|
5
5
|
tags :upgrade_scenario
|
6
6
|
confine do
|
7
|
-
(feature(:instance).downstream
|
7
|
+
(feature(:instance).downstream&.current_minor_version == '6.15' || \
|
8
8
|
ForemanMaintain.upgrade_in_progress == '6.16')
|
9
9
|
end
|
10
10
|
instance_eval(&block)
|
@@ -23,14 +23,41 @@ module Scenarios::Satellite
|
|
23
23
|
run_strategy :fail_slow
|
24
24
|
end
|
25
25
|
|
26
|
+
# rubocop:disable Metrics/MethodLength
|
26
27
|
def compose
|
27
|
-
add_steps(
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
add_steps(
|
29
|
+
Checks::Foreman::FactsNames, # if Foreman database present
|
30
|
+
Checks::ForemanProxy::CheckTftpStorage, # if Satellite with foreman-proxy+tftp
|
31
|
+
Checks::ForemanProxy::VerifyDhcpConfigSyntax, # if foreman-proxy+dhcp-isc
|
32
|
+
Checks::ForemanTasks::NotPaused, # if foreman-tasks present
|
33
|
+
Checks::Puppet::VerifyNoEmptyCacertRequests, # if puppetserver
|
34
|
+
Checks::ServerPing,
|
35
|
+
Checks::ServicesUp,
|
36
|
+
Checks::SystemRegistration,
|
37
|
+
Checks::CheckHotfixInstalled,
|
38
|
+
Checks::CheckTmout,
|
39
|
+
Checks::CheckUpstreamRepository,
|
40
|
+
Checks::Disk::AvailableSpace,
|
41
|
+
Checks::Disk::AvailableSpaceCandlepin, # if candlepin
|
42
|
+
Checks::Foreman::ValidateExternalDbVersion, # if external database
|
43
|
+
Checks::Foreman::CheckCorruptedRoles,
|
44
|
+
Checks::Foreman::CheckDuplicatePermissions,
|
45
|
+
Checks::Foreman::TuningRequirements, # if katello present
|
46
|
+
Checks::ForemanOpenscap::InvalidReportAssociations, # if foreman-openscap
|
47
|
+
Checks::ForemanTasks::Invalid::CheckOld, # if foreman-tasks
|
48
|
+
Checks::ForemanTasks::Invalid::CheckPendingState, # if foreman-tasks
|
49
|
+
Checks::ForemanTasks::Invalid::CheckPlanningState, # if foreman-tasks
|
50
|
+
Checks::ForemanTasks::NotRunning, # if foreman-tasks
|
51
|
+
Checks::NonRhPackages,
|
52
|
+
Checks::PackageManager::Dnf::ValidateDnfConfig,
|
53
|
+
Checks::Repositories::CheckNonRhRepository,
|
54
|
+
Checks::CheckIpv6Disable,
|
55
|
+
Checks::Disk::AvailableSpacePostgresql13,
|
56
|
+
Checks::CheckOrganizationContentAccessMode,
|
57
|
+
Checks::Repositories::Validate.new(:version => target_version),
|
58
|
+
)
|
33
59
|
end
|
60
|
+
# rubocop:enable Metrics/MethodLength
|
34
61
|
end
|
35
62
|
|
36
63
|
class PreMigrations < Abstract
|
@@ -40,7 +67,11 @@ module Scenarios::Satellite
|
|
40
67
|
end
|
41
68
|
|
42
69
|
def compose
|
43
|
-
add_steps(
|
70
|
+
add_steps(
|
71
|
+
Procedures::MaintenanceMode::EnableMaintenanceMode,
|
72
|
+
Procedures::Crond::Stop,
|
73
|
+
Procedures::SyncPlans::Disable,
|
74
|
+
)
|
44
75
|
end
|
45
76
|
end
|
46
77
|
|
@@ -60,15 +91,17 @@ module Scenarios::Satellite
|
|
60
91
|
if el8?
|
61
92
|
modules_to_switch = ['postgresql:13']
|
62
93
|
add_step(Procedures::Packages::SwitchModules.new(:module_names => modules_to_switch))
|
63
|
-
modules_to_enable = ["
|
94
|
+
modules_to_enable = ["#{feature(:instance).downstream.module_name}:#{el_short_name}"]
|
64
95
|
add_step(Procedures::Packages::EnableModules.new(:module_names => modules_to_enable))
|
65
96
|
end
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
97
|
+
add_steps(
|
98
|
+
Procedures::Packages::Update.new(
|
99
|
+
:assumeyes => true,
|
100
|
+
:download_only => true
|
101
|
+
),
|
102
|
+
Procedures::Service::Stop,
|
103
|
+
Procedures::Packages::Update.new(:assumeyes => true, :clean_cache => false),
|
104
|
+
)
|
72
105
|
add_step_with_context(Procedures::Installer::Run)
|
73
106
|
add_step(Procedures::Installer::UpgradeRakeTask)
|
74
107
|
end
|
@@ -81,9 +114,13 @@ module Scenarios::Satellite
|
|
81
114
|
end
|
82
115
|
|
83
116
|
def compose
|
84
|
-
|
85
|
-
|
86
|
-
|
117
|
+
add_steps(
|
118
|
+
Procedures::RefreshFeatures,
|
119
|
+
Procedures::Service::Start,
|
120
|
+
Procedures::Crond::Start,
|
121
|
+
Procedures::SyncPlans::Enable,
|
122
|
+
Procedures::MaintenanceMode::DisableMaintenanceMode,
|
123
|
+
)
|
87
124
|
end
|
88
125
|
end
|
89
126
|
|
@@ -95,11 +132,19 @@ module Scenarios::Satellite
|
|
95
132
|
end
|
96
133
|
|
97
134
|
def compose
|
98
|
-
add_steps(
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
135
|
+
add_steps(
|
136
|
+
Checks::Foreman::FactsNames, # if Foreman database present
|
137
|
+
Checks::ForemanProxy::CheckTftpStorage, # if Satellite with foreman-proxy+tftp
|
138
|
+
Checks::ForemanProxy::VerifyDhcpConfigSyntax, # if foreman-proxy+dhcp-isc
|
139
|
+
Checks::ForemanTasks::NotPaused, # if foreman-tasks present
|
140
|
+
Checks::Puppet::VerifyNoEmptyCacertRequests, # if puppetserver
|
141
|
+
Checks::ServerPing,
|
142
|
+
Checks::ServicesUp,
|
143
|
+
Checks::SystemRegistration,
|
144
|
+
Procedures::Packages::CheckForReboot,
|
145
|
+
Procedures::Pulpcore::ContainerHandleImageMetadata,
|
146
|
+
Procedures::Repositories::IndexKatelloRepositoriesContainerMetatdata,
|
147
|
+
)
|
103
148
|
end
|
104
149
|
end
|
105
150
|
end
|
@@ -8,7 +8,7 @@ module ForemanMaintain::Scenarios
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def compose
|
11
|
-
|
11
|
+
add_step(Checks::RootUser)
|
12
12
|
add_steps_with_context(Procedures::Service::Restart)
|
13
13
|
end
|
14
14
|
|
@@ -33,7 +33,7 @@ module ForemanMaintain::Scenarios
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def compose
|
36
|
-
|
36
|
+
add_step(Checks::RootUser)
|
37
37
|
add_steps_with_context(Procedures::Service::Stop)
|
38
38
|
end
|
39
39
|
|
@@ -55,7 +55,7 @@ module ForemanMaintain::Scenarios
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def compose
|
58
|
-
|
58
|
+
add_step(Checks::RootUser)
|
59
59
|
add_steps_with_context(Procedures::Service::Start)
|
60
60
|
end
|
61
61
|
|
@@ -98,7 +98,7 @@ module ForemanMaintain::Scenarios
|
|
98
98
|
end
|
99
99
|
|
100
100
|
def compose
|
101
|
-
|
101
|
+
add_step(Checks::RootUser)
|
102
102
|
add_steps_with_context(Procedures::Service::Enable)
|
103
103
|
end
|
104
104
|
|
@@ -120,7 +120,7 @@ module ForemanMaintain::Scenarios
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def compose
|
123
|
-
|
123
|
+
add_step(Checks::RootUser)
|
124
124
|
add_steps_with_context(Procedures::Service::Disable)
|
125
125
|
end
|
126
126
|
|
@@ -42,7 +42,7 @@ module ForemanMaintain
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def local?(config = configuration)
|
45
|
-
['localhost', '127.0.0.1', `hostname`.strip].include?
|
45
|
+
['localhost', '127.0.0.1', `hostname`.strip].include?(config['host'])
|
46
46
|
end
|
47
47
|
|
48
48
|
def query(sql, config = configuration)
|
@@ -25,6 +25,11 @@ module ForemanMaintain
|
|
25
25
|
@foreman_port = @options.fetch(:foreman_port, 443)
|
26
26
|
end
|
27
27
|
|
28
|
+
def use_color?
|
29
|
+
ENV['TERM'] && ENV.fetch('NO_COLOR', '') == '' && \
|
30
|
+
system('command -v tput', out: File.open('/dev/null')) && `tput colors`.to_i > 0
|
31
|
+
end
|
32
|
+
|
28
33
|
private
|
29
34
|
|
30
35
|
def load_log_configs
|
@@ -1,17 +1,5 @@
|
|
1
1
|
module ForemanMaintain
|
2
2
|
module CoreExt
|
3
|
-
module StripHeredoc
|
4
|
-
def strip_heredoc
|
5
|
-
indent = 0
|
6
|
-
indented_lines = scan(/^[ \t]+(?=\S)/)
|
7
|
-
unless indented_lines.empty?
|
8
|
-
indent = indented_lines.min.size
|
9
|
-
end
|
10
|
-
gsub(/^[ \t]{#{indent}}/, '')
|
11
|
-
end
|
12
|
-
end
|
13
|
-
String.include StripHeredoc
|
14
|
-
|
15
3
|
module ValidateOptions
|
16
4
|
def validate_options!(*valid_keys)
|
17
5
|
valid_keys.flatten!
|
@@ -301,17 +301,17 @@ module ForemanMaintain
|
|
301
301
|
return if scenario.passed? && !scenario.warning?
|
302
302
|
|
303
303
|
message = []
|
304
|
-
message <<
|
304
|
+
message << <<~MESSAGE
|
305
305
|
Scenario [#{scenario.description}] failed.
|
306
306
|
MESSAGE
|
307
307
|
recommend = []
|
308
308
|
|
309
309
|
steps_with_abort = scenario.steps_with_abort(:whitelisted => false)
|
310
310
|
unless steps_with_abort.empty?
|
311
|
-
message << format(
|
312
|
-
|
311
|
+
message << format(<<~MESSAGE, format_steps(steps_with_abort, "\n", 2))
|
312
|
+
The processing was aborted by user during the following steps:
|
313
313
|
|
314
|
-
|
314
|
+
%s
|
315
315
|
MESSAGE
|
316
316
|
end
|
317
317
|
|
@@ -323,28 +323,28 @@ module ForemanMaintain
|
|
323
323
|
|
324
324
|
steps_to_whitelist = steps_with_error + steps_with_skipped - not_skippable_steps
|
325
325
|
unless steps_with_error.empty?
|
326
|
-
message << format(
|
327
|
-
|
326
|
+
message << format(<<~MESSAGE, format_steps(steps_with_error, "\n", 2))
|
327
|
+
The following steps ended up in failing state:
|
328
328
|
|
329
|
-
|
329
|
+
%s
|
330
330
|
MESSAGE
|
331
331
|
whitelist_labels = steps_to_whitelist.map(&:label_dashed).join(',')
|
332
332
|
unless whitelist_labels.empty?
|
333
333
|
recommend << if scenario.detector.feature(:instance).downstream
|
334
|
-
format(
|
335
|
-
|
334
|
+
format(<<~MESSAGE)
|
335
|
+
Resolve the failed steps and rerun the command.
|
336
336
|
|
337
|
-
|
338
|
-
|
337
|
+
If the situation persists and, you are unclear what to do next,
|
338
|
+
contact #{scenario.detector.feature(:instance).project_support_entity}.
|
339
339
|
|
340
|
-
|
341
|
-
|
340
|
+
In case the failures are false positives, use
|
341
|
+
--whitelist="#{whitelist_labels}"
|
342
342
|
MESSAGE
|
343
343
|
else
|
344
|
-
format(
|
345
|
-
|
346
|
-
|
347
|
-
|
344
|
+
format(<<~MESSAGE)
|
345
|
+
Resolve the failed steps and rerun the command.
|
346
|
+
In case the failures are false positives, use
|
347
|
+
--whitelist="#{whitelist_labels}"
|
348
348
|
MESSAGE
|
349
349
|
end
|
350
350
|
end
|
@@ -352,15 +352,15 @@ module ForemanMaintain
|
|
352
352
|
|
353
353
|
steps_with_warning = scenario.steps_with_warning(:whitelisted => false)
|
354
354
|
unless steps_with_warning.empty?
|
355
|
-
message << format(
|
356
|
-
|
355
|
+
message << format(<<~MESSAGE, format_steps(steps_with_warning, "\n", 2))
|
356
|
+
The following steps ended up in warning state:
|
357
357
|
|
358
|
-
|
358
|
+
%s
|
359
359
|
MESSAGE
|
360
360
|
|
361
|
-
recommend <<
|
362
|
-
|
363
|
-
|
361
|
+
recommend << <<~MESSAGE
|
362
|
+
The steps in warning state itself might not mean there is an error,
|
363
|
+
but it should be reviewed to ensure the behavior is expected
|
364
364
|
MESSAGE
|
365
365
|
end
|
366
366
|
puts((message + recommend).join("\n"))
|
@@ -133,10 +133,10 @@ module ForemanMaintain
|
|
133
133
|
decision = super(scenario)
|
134
134
|
# we have not asked the user already about next steps
|
135
135
|
if decision.nil? && @ask_to_confirm_update
|
136
|
-
response = reporter.ask_decision(
|
137
|
-
|
138
|
-
|
139
|
-
|
136
|
+
response = reporter.ask_decision(<<~MESSAGE.strip)
|
137
|
+
The pre-update checks indicate that the system is ready for update.
|
138
|
+
It's recommended to perform a backup at this stage.
|
139
|
+
Confirm to continue with the modification part of the update
|
140
140
|
MESSAGE
|
141
141
|
if [:no, :quit].include?(response)
|
142
142
|
ask_to_quit
|
@@ -94,7 +94,7 @@ module ForemanMaintain
|
|
94
94
|
def finish_upgrade
|
95
95
|
@finished = true
|
96
96
|
@reporter.hline
|
97
|
-
@reporter.puts
|
97
|
+
@reporter.puts <<~MESSAGE
|
98
98
|
Upgrade finished.
|
99
99
|
MESSAGE
|
100
100
|
end
|
@@ -136,7 +136,7 @@ module ForemanMaintain
|
|
136
136
|
def skip_phase(skipped_phase)
|
137
137
|
with_non_empty_scenario(skipped_phase) do |scenario|
|
138
138
|
@reporter.before_scenario_starts(scenario)
|
139
|
-
@reporter.puts
|
139
|
+
@reporter.puts <<~MESSAGE
|
140
140
|
Skipping #{skipped_phase} phase as it was already run before.
|
141
141
|
To enforce to run the phase, use `upgrade run --phase #{skipped_phase}`
|
142
142
|
MESSAGE
|
@@ -164,7 +164,7 @@ module ForemanMaintain
|
|
164
164
|
end
|
165
165
|
end
|
166
166
|
self.phase = :pre_upgrade_checks # rollback finished
|
167
|
-
@reporter.puts
|
167
|
+
@reporter.puts <<~MESSAGE
|
168
168
|
The upgrade failed and system was restored to pre-upgrade state.
|
169
169
|
MESSAGE
|
170
170
|
end
|
@@ -199,10 +199,10 @@ module ForemanMaintain
|
|
199
199
|
decision = super(scenario)
|
200
200
|
# we have not asked the user already about next steps
|
201
201
|
if decision.nil? && @ask_to_confirm_upgrade
|
202
|
-
response = reporter.ask_decision(
|
203
|
-
|
204
|
-
|
205
|
-
|
202
|
+
response = reporter.ask_decision(<<~MESSAGE.strip)
|
203
|
+
The pre-upgrade checks indicate that the system is ready for upgrade.
|
204
|
+
It's recommended to perform a backup at this stage.
|
205
|
+
Confirm to continue with the modification part of the upgrade
|
206
206
|
MESSAGE
|
207
207
|
if [:no, :quit].include?(response)
|
208
208
|
ask_to_quit
|
@@ -11,6 +11,9 @@ module ForemanMaintain
|
|
11
11
|
:foreman_online_files, :foreman_offline_files, :fpc_offline_files,
|
12
12
|
:fpc_online_files
|
13
13
|
|
14
|
+
ONLINE_BACKUP = 'online'.freeze
|
15
|
+
OFFLINE_BACKUP = 'offline'.freeze
|
16
|
+
|
14
17
|
def initialize(backup_dir)
|
15
18
|
# fpc stands for foreman proxy w/ content
|
16
19
|
@backup_dir = backup_dir
|
@@ -260,6 +263,10 @@ module ForemanMaintain
|
|
260
263
|
def different_source_os?
|
261
264
|
source_os_version != "#{os_name} #{os_version}"
|
262
265
|
end
|
266
|
+
|
267
|
+
def backup_type
|
268
|
+
online_backup? ? ONLINE_BACKUP : OFFLINE_BACKUP
|
269
|
+
end
|
263
270
|
end
|
264
271
|
end
|
265
272
|
end
|
@@ -50,11 +50,7 @@ module ForemanMaintain::Utils
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def exist?
|
53
|
-
|
54
|
-
['enabled', 'disabled'].include?(service_enabled_status)
|
55
|
-
else
|
56
|
-
File.exist?("/etc/init.d/#{@name}")
|
57
|
-
end
|
53
|
+
['enabled', 'disabled'].include?(service_enabled_status)
|
58
54
|
end
|
59
55
|
|
60
56
|
def enabled?
|
data/lib/foreman_maintain.rb
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
if RUBY_VERSION <= '1.8.7'
|
2
|
-
require 'rubygems'
|
3
|
-
end
|
4
|
-
|
5
1
|
require 'forwardable'
|
6
2
|
require 'json'
|
7
3
|
require 'logger'
|
@@ -68,6 +64,7 @@ module ForemanMaintain
|
|
68
64
|
|
69
65
|
# using a queue, we can log the messages which are generated before initializing logger
|
70
66
|
self.config = Config.new(options)
|
67
|
+
configure_highline
|
71
68
|
load_definitions
|
72
69
|
init_logger
|
73
70
|
update_path
|
@@ -102,6 +99,10 @@ module ForemanMaintain
|
|
102
99
|
end
|
103
100
|
end
|
104
101
|
|
102
|
+
def configure_highline
|
103
|
+
HighLine.use_color = config.use_color?
|
104
|
+
end
|
105
|
+
|
105
106
|
def cache
|
106
107
|
ObjectCache.instance
|
107
108
|
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.
|
4
|
+
version: 1.6.12
|
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-
|
11
|
+
date: 2024-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -158,6 +158,7 @@ files:
|
|
158
158
|
- config/foreman_maintain.yml.packaging
|
159
159
|
- config/hammer.yml.example
|
160
160
|
- definitions/checks/backup/certs_tar_exist.rb
|
161
|
+
- definitions/checks/backup/incremental_parent_type.rb
|
161
162
|
- definitions/checks/candlepin/db_up.rb
|
162
163
|
- definitions/checks/check_hotfix_installed.rb
|
163
164
|
- definitions/checks/check_ipv6_disable.rb
|
@@ -275,7 +276,6 @@ files:
|
|
275
276
|
- definitions/procedures/packages/update.rb
|
276
277
|
- definitions/procedures/packages/update_all_confirmation.rb
|
277
278
|
- definitions/procedures/pulpcore/container_handle_image_metadata.rb
|
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
|
281
281
|
- definitions/procedures/puppet/remove_puppet_data.rb
|
@@ -293,7 +293,6 @@ files:
|
|
293
293
|
- definitions/procedures/restore/extract_files.rb
|
294
294
|
- definitions/procedures/restore/foreman_dump.rb
|
295
295
|
- definitions/procedures/restore/installer_reset.rb
|
296
|
-
- definitions/procedures/restore/postgres_owner.rb
|
297
296
|
- definitions/procedures/restore/pulpcore_dump.rb
|
298
297
|
- definitions/procedures/restore/reindex_databases.rb
|
299
298
|
- definitions/procedures/restore/required_packages.rb
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Procedures::Pulpcore
|
2
|
-
class TrimRpmChangelogs < ForemanMaintain::Procedure
|
3
|
-
include ForemanMaintain::Concerns::SystemService
|
4
|
-
include ForemanMaintain::Concerns::PulpCommon
|
5
|
-
|
6
|
-
metadata do
|
7
|
-
description 'Trim RPM changelogs in the pulpcore db'
|
8
|
-
for_feature :pulpcore
|
9
|
-
end
|
10
|
-
|
11
|
-
def run
|
12
|
-
with_spinner('Trimming RPM changelogs 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('Trimming RPM changelogs')
|
18
|
-
execute!(pulpcore_manager('rpm-trim-changelogs'))
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Procedures::Restore
|
2
|
-
class PostgresOwner < ForemanMaintain::Procedure
|
3
|
-
include ForemanMaintain::Concerns::SystemHelpers
|
4
|
-
metadata do
|
5
|
-
description 'Make postgres owner of backup directory'
|
6
|
-
|
7
|
-
param :backup_dir,
|
8
|
-
'Path to backup directory',
|
9
|
-
:required => true
|
10
|
-
end
|
11
|
-
|
12
|
-
def run
|
13
|
-
if feature(:instance).foreman_proxy_with_content?
|
14
|
-
FileUtils.chown(nil, 'postgres', @backup_dir)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|