foreman_maintain 1.6.11 → 1.6.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/definitions/checks/backup/incremental_parent_type.rb +33 -0
- data/definitions/checks/foreman/check_tuning_requirements.rb +2 -2
- data/definitions/checks/restore/validate_postgresql_dump_permissions.rb +1 -1
- data/definitions/checks/system_registration.rb +1 -1
- data/definitions/features/foreman_database.rb +6 -1
- data/definitions/procedures/backup/online/candlepin_db.rb +1 -1
- data/definitions/procedures/backup/online/foreman_db.rb +1 -1
- data/definitions/procedures/backup/online/pulpcore_db.rb +1 -1
- data/definitions/procedures/backup/online/safety_confirmation.rb +4 -7
- data/definitions/procedures/backup/prepare_directory.rb +1 -2
- 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 +17 -30
- data/definitions/scenarios/foreman_upgrade.rb +3 -1
- data/definitions/scenarios/restore.rb +1 -1
- data/definitions/scenarios/satellite_upgrade.rb +66 -21
- data/definitions/scenarios/services.rb +5 -5
- data/lib/foreman_maintain/cli/backup_command.rb +1 -3
- 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 -6
- data/definitions/procedures/backup/offline/candlepin_db.rb +0 -53
- data/definitions/procedures/backup/offline/foreman_db.rb +0 -73
- data/definitions/procedures/backup/offline/pulpcore_db.rb +0 -53
- data/definitions/procedures/pulpcore/trim_rpm_changelogs.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75ad50dc1e0bbb3221aad7844236ac97467d5b12c07a17a0ae5f2bb09448d010
|
4
|
+
data.tar.gz: 310cbf63bbe5c3fc98efa58219bbcaee680c55580ca27415f9636bea85e637ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a5036c9138cf2b219366c33e535cdb917e2bfe8fee87d03351a73b2e515cf4b4278d0ab4b34d9f799bb31d5ae01f5903261ada5aa4f7acccac6294b29e63f3d
|
7
|
+
data.tar.gz: e965c5451c169bb386d4b3239c3a57cb78e279d49c327ae80de7ab878982783752054ca53032e5d2a67acb6759b7f969e68970a610686232399b95d2f08fc28d
|
@@ -0,0 +1,33 @@
|
|
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
|
+
manual_detection
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
return unless @incremental_dir
|
13
|
+
|
14
|
+
backup = ForemanMaintain::Utils::Backup.new(@incremental_dir)
|
15
|
+
|
16
|
+
existing_type = backup.backup_type
|
17
|
+
new_type = if @online_backup
|
18
|
+
ForemanMaintain::Utils::Backup::ONLINE_BACKUP
|
19
|
+
else
|
20
|
+
ForemanMaintain::Utils::Backup::OFFLINE_BACKUP
|
21
|
+
end
|
22
|
+
msg = "The existing backup is an #{existing_type} backup, "\
|
23
|
+
"but an #{new_type} backup was requested."
|
24
|
+
assert(existing_type == new_type, msg)
|
25
|
+
|
26
|
+
unless @online_backup
|
27
|
+
msg = "The existing backup has PostgreSQL as a tarball, "\
|
28
|
+
"but the new one will have a dump."
|
29
|
+
assert(!backup.sql_tar_files_exist?, msg)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
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
|
@@ -11,7 +11,7 @@ module Checks::Restore
|
|
11
11
|
|
12
12
|
def run
|
13
13
|
backup = ForemanMaintain::Utils::Backup.new(@backup_dir)
|
14
|
-
if feature(:instance).postgresql_local?
|
14
|
+
if feature(:instance).postgresql_local?
|
15
15
|
errors = []
|
16
16
|
[:candlepin_dump, :foreman_dump, :pulpcore_dump].each do |dump|
|
17
17
|
next unless backup.file_map[dump][:present]
|
@@ -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
|
@@ -2,7 +2,7 @@ module Procedures::Backup
|
|
2
2
|
module Online
|
3
3
|
class CandlepinDB < ForemanMaintain::Procedure
|
4
4
|
metadata do
|
5
|
-
description 'Backup Candlepin database
|
5
|
+
description 'Backup Candlepin database'
|
6
6
|
tags :backup
|
7
7
|
label :backup_online_candlepin_db
|
8
8
|
for_feature :candlepin_database
|
@@ -2,7 +2,7 @@ module Procedures::Backup
|
|
2
2
|
module Online
|
3
3
|
class ForemanDB < ForemanMaintain::Procedure
|
4
4
|
metadata do
|
5
|
-
description 'Backup Foreman database
|
5
|
+
description 'Backup Foreman database'
|
6
6
|
tags :backup
|
7
7
|
label :backup_online_foreman_db
|
8
8
|
for_feature :foreman_database
|
@@ -2,7 +2,7 @@ module Procedures::Backup
|
|
2
2
|
module Online
|
3
3
|
class PulpcoreDB < ForemanMaintain::Procedure
|
4
4
|
metadata do
|
5
|
-
description 'Backup Pulpcore database
|
5
|
+
description 'Backup Pulpcore database'
|
6
6
|
tags :backup
|
7
7
|
label :backup_online_pulpcore_db
|
8
8
|
for_feature :pulpcore_database
|
@@ -4,23 +4,20 @@ module Procedures::Backup
|
|
4
4
|
metadata do
|
5
5
|
description 'Data consistency warning'
|
6
6
|
tags :backup
|
7
|
-
param :include_db_dumps, 'Are database dumps included in backup', :flag => true,
|
8
|
-
:default => false
|
9
7
|
end
|
10
8
|
|
11
9
|
def run
|
12
|
-
answer = ask_decision(warning_message
|
10
|
+
answer = ask_decision(warning_message, actions_msg: 'y(yes), q(quit)')
|
13
11
|
abort! unless answer == :yes
|
14
12
|
end
|
15
13
|
|
16
|
-
def warning_message
|
17
|
-
|
18
|
-
"*** WARNING: The #{substr} is intended for making a copy of the data\n" \
|
14
|
+
def warning_message
|
15
|
+
"*** WARNING: The online backup is intended for making a copy of the data\n" \
|
19
16
|
'*** for debugging purposes only.' \
|
20
17
|
" The backup routine can not ensure 100% consistency while the\n" \
|
21
18
|
"*** backup is taking place as there is a chance there may be data mismatch between\n" \
|
22
19
|
'*** the databases while the services are live.' \
|
23
|
-
" If you wish to utilize the
|
20
|
+
" If you wish to utilize the online backup\n" \
|
24
21
|
'*** for production use you need to ensure that there are' \
|
25
22
|
" no modifications occurring during\n" \
|
26
23
|
"*** your backup run.\n\nDo you want to proceed?"
|
@@ -6,7 +6,6 @@ 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
|
10
9
|
end
|
11
10
|
|
12
11
|
# rubocop:disable Metrics/MethodLength
|
@@ -17,7 +16,7 @@ module Procedures::Backup
|
|
17
16
|
FileUtils.mkdir_p @backup_dir
|
18
17
|
FileUtils.chmod_R 0o770, @backup_dir
|
19
18
|
|
20
|
-
if feature(:instance).postgresql_local?
|
19
|
+
if feature(:instance).postgresql_local?
|
21
20
|
begin
|
22
21
|
FileUtils.chown_R(nil, 'postgres', @backup_dir)
|
23
22
|
rescue Errno::EPERM
|
@@ -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.
|
@@ -8,7 +8,6 @@ module ForemanMaintain::Scenarios
|
|
8
8
|
param :strategy, 'Backup strategy. One of [:online, :offline]',
|
9
9
|
:required => true
|
10
10
|
param :backup_dir, 'Directory where to backup to', :required => true
|
11
|
-
param :include_db_dumps, 'Include dumps of local dbs as part of offline'
|
12
11
|
param :preserve_dir, 'Directory where to backup to'
|
13
12
|
param :incremental_dir, 'Changes since specified backup only'
|
14
13
|
param :proxy_features, 'List of proxy features to backup (default: all)', :array => true
|
@@ -18,10 +17,11 @@ module ForemanMaintain::Scenarios
|
|
18
17
|
|
19
18
|
def compose
|
20
19
|
check_valid_strategy
|
20
|
+
add_step_with_context(Checks::Backup::IncrementalParentType,
|
21
|
+
:online_backup => strategy == :online)
|
21
22
|
safety_confirmation
|
22
23
|
add_step_with_context(Procedures::Backup::AccessibilityConfirmation) if strategy == :offline
|
23
|
-
add_step_with_context(Procedures::Backup::PrepareDirectory
|
24
|
-
:online_backup => strategy == :online)
|
24
|
+
add_step_with_context(Procedures::Backup::PrepareDirectory)
|
25
25
|
add_step_with_context(Procedures::Backup::Metadata, :online_backup => strategy == :online)
|
26
26
|
|
27
27
|
case strategy
|
@@ -44,13 +44,11 @@ module ForemanMaintain::Scenarios
|
|
44
44
|
Procedures::Backup::Pulp => :backup_dir,
|
45
45
|
Procedures::Backup::Online::CandlepinDB => :backup_dir,
|
46
46
|
Procedures::Backup::Online::ForemanDB => :backup_dir,
|
47
|
-
Procedures::Backup::Online::PulpcoreDB => :backup_dir
|
48
|
-
Procedures::Backup::Offline::CandlepinDB => :backup_dir,
|
49
|
-
Procedures::Backup::Offline::ForemanDB => :backup_dir,
|
50
|
-
Procedures::Backup::Offline::PulpcoreDB => :backup_dir)
|
47
|
+
Procedures::Backup::Online::PulpcoreDB => :backup_dir)
|
51
48
|
context.map(:preserve_dir,
|
52
49
|
Procedures::Backup::PrepareDirectory => :preserve_dir)
|
53
50
|
context.map(:incremental_dir,
|
51
|
+
Checks::Backup::IncrementalParentType => :incremental_dir,
|
54
52
|
Procedures::Backup::PrepareDirectory => :incremental_dir,
|
55
53
|
Procedures::Backup::Metadata => :incremental_dir)
|
56
54
|
context.map(:proxy_features,
|
@@ -59,15 +57,13 @@ module ForemanMaintain::Scenarios
|
|
59
57
|
Procedures::Backup::Pulp => :skip)
|
60
58
|
context.map(:tar_volume_size,
|
61
59
|
Procedures::Backup::Pulp => :tar_volume_size)
|
62
|
-
context.map(:include_db_dumps,
|
63
|
-
Procedures::Backup::Online::SafetyConfirmation => :include_db_dumps)
|
64
60
|
end
|
65
61
|
# rubocop:enable Metrics/MethodLength
|
66
62
|
|
67
63
|
private
|
68
64
|
|
69
65
|
def safety_confirmation
|
70
|
-
if strategy == :online
|
66
|
+
if strategy == :online
|
71
67
|
add_step_with_context(Procedures::Backup::Online::SafetyConfirmation)
|
72
68
|
end
|
73
69
|
end
|
@@ -79,35 +75,30 @@ module ForemanMaintain::Scenarios
|
|
79
75
|
end
|
80
76
|
|
81
77
|
def add_offline_backup_steps
|
82
|
-
include_dumps if include_db_dumps?
|
83
78
|
add_step_with_context(Procedures::ForemanProxy::Features, :load_only => true)
|
84
79
|
add_steps_with_context(
|
85
80
|
Procedures::Service::Stop,
|
86
81
|
Procedures::Backup::ConfigFiles,
|
87
|
-
Procedures::Backup::Pulp
|
88
|
-
Procedures::Backup::Offline::CandlepinDB,
|
89
|
-
Procedures::Backup::Offline::ForemanDB,
|
90
|
-
Procedures::Backup::Offline::PulpcoreDB,
|
91
|
-
Procedures::Service::Start
|
82
|
+
Procedures::Backup::Pulp
|
92
83
|
)
|
93
|
-
end
|
94
84
|
|
95
|
-
|
96
|
-
|
97
|
-
add_step_with_context(Procedures::Backup::Online::CandlepinDB)
|
98
|
-
end
|
99
|
-
if feature(:instance).database_local?(:foreman_database)
|
100
|
-
add_step_with_context(Procedures::Backup::Online::ForemanDB)
|
101
|
-
end
|
102
|
-
if feature(:instance).database_local?(:pulpcore_database)
|
103
|
-
add_step_with_context(Procedures::Backup::Online::PulpcoreDB)
|
85
|
+
if feature(:instance).postgresql_local?
|
86
|
+
add_step(Procedures::Service::Start.new(:only => ['postgresql']))
|
104
87
|
end
|
88
|
+
|
89
|
+
add_database_backup_steps
|
90
|
+
|
91
|
+
add_steps_with_context(Procedures::Service::Start)
|
105
92
|
end
|
106
93
|
|
107
94
|
def add_online_backup_steps
|
108
95
|
add_step_with_context(Procedures::Backup::ConfigFiles, :ignore_changed_files => true,
|
109
96
|
:online_backup => true)
|
110
97
|
add_step_with_context(Procedures::Backup::Pulp, :ensure_unchanged => true)
|
98
|
+
add_database_backup_steps
|
99
|
+
end
|
100
|
+
|
101
|
+
def add_database_backup_steps
|
111
102
|
add_steps_with_context(
|
112
103
|
Procedures::Backup::Online::CandlepinDB,
|
113
104
|
Procedures::Backup::Online::ForemanDB,
|
@@ -118,10 +109,6 @@ module ForemanMaintain::Scenarios
|
|
118
109
|
def strategy
|
119
110
|
context.get(:strategy)
|
120
111
|
end
|
121
|
-
|
122
|
-
def include_db_dumps?
|
123
|
-
!!context.get(:include_db_dumps)
|
124
|
-
end
|
125
112
|
end
|
126
113
|
|
127
114
|
class BackupRescueCleanup < ForemanMaintain::Scenario
|
@@ -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,
|
@@ -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
|
|
@@ -63,12 +94,14 @@ module Scenarios::Satellite
|
|
63
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
|
|
@@ -119,11 +119,9 @@ module ForemanMaintain
|
|
119
119
|
include BackupCommon
|
120
120
|
interactive_option
|
121
121
|
common_backup_options
|
122
|
-
option '--include-db-dumps', :flag, 'Also dump full database schema before offline backup'
|
123
122
|
|
124
123
|
def execute
|
125
|
-
perform_backup(:offline
|
126
|
-
:include_db_dumps => include_db_dumps?)
|
124
|
+
perform_backup(:offline)
|
127
125
|
end
|
128
126
|
end
|
129
127
|
|
@@ -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.13
|
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-22 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
|
@@ -234,9 +235,6 @@ files:
|
|
234
235
|
- definitions/procedures/backup/compress_data.rb
|
235
236
|
- definitions/procedures/backup/config_files.rb
|
236
237
|
- definitions/procedures/backup/metadata.rb
|
237
|
-
- definitions/procedures/backup/offline/candlepin_db.rb
|
238
|
-
- definitions/procedures/backup/offline/foreman_db.rb
|
239
|
-
- definitions/procedures/backup/offline/pulpcore_db.rb
|
240
238
|
- definitions/procedures/backup/online/candlepin_db.rb
|
241
239
|
- definitions/procedures/backup/online/foreman_db.rb
|
242
240
|
- definitions/procedures/backup/online/pulpcore_db.rb
|
@@ -275,7 +273,6 @@ files:
|
|
275
273
|
- definitions/procedures/packages/update.rb
|
276
274
|
- definitions/procedures/packages/update_all_confirmation.rb
|
277
275
|
- definitions/procedures/pulpcore/container_handle_image_metadata.rb
|
278
|
-
- definitions/procedures/pulpcore/trim_rpm_changelogs.rb
|
279
276
|
- definitions/procedures/puppet/delete_empty_ca_cert_request_files.rb
|
280
277
|
- definitions/procedures/puppet/remove_puppet.rb
|
281
278
|
- definitions/procedures/puppet/remove_puppet_data.rb
|
@@ -1,53 +0,0 @@
|
|
1
|
-
module Procedures::Backup
|
2
|
-
module Offline
|
3
|
-
class CandlepinDB < ForemanMaintain::Procedure
|
4
|
-
metadata do
|
5
|
-
description 'Backup Candlepin DB offline'
|
6
|
-
tags :backup
|
7
|
-
label :backup_offline_candlepin_db
|
8
|
-
for_feature :candlepin_database
|
9
|
-
preparation_steps { Checks::Candlepin::DBUp.new unless feature(:candlepin_database).local? }
|
10
|
-
param :backup_dir, 'Directory where to backup to', :required => true
|
11
|
-
param :tar_volume_size, 'Size of tar volume (indicates splitting)'
|
12
|
-
end
|
13
|
-
|
14
|
-
def run
|
15
|
-
if feature(:candlepin_database).local?
|
16
|
-
if File.exist?(pg_backup_file)
|
17
|
-
puts 'Already done'
|
18
|
-
else
|
19
|
-
local_backup
|
20
|
-
end
|
21
|
-
else
|
22
|
-
puts "Backup of #{pg_data_dir} is not supported for remote databases." \
|
23
|
-
' Doing postgres dump instead...'
|
24
|
-
with_spinner('Getting Candlepin DB dump') do
|
25
|
-
feature(:candlepin_database).dump_db(File.join(@backup_dir, 'candlepin.dump'))
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def local_backup
|
33
|
-
with_spinner("Collecting data from #{pg_data_dir}") do
|
34
|
-
feature(:candlepin_database).backup_local(
|
35
|
-
pg_backup_file,
|
36
|
-
:listed_incremental => File.join(@backup_dir, '.postgres.snar'),
|
37
|
-
:volume_size => @tar_volume_size,
|
38
|
-
:data_dir => pg_data_dir,
|
39
|
-
:restore_dir => feature(:candlepin_database).data_dir
|
40
|
-
)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def pg_backup_file
|
45
|
-
File.join(@backup_dir, 'pgsql_data.tar')
|
46
|
-
end
|
47
|
-
|
48
|
-
def pg_data_dir
|
49
|
-
feature(:candlepin_database).data_dir
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,73 +0,0 @@
|
|
1
|
-
module Procedures::Backup
|
2
|
-
module Offline
|
3
|
-
class ForemanDB < ForemanMaintain::Procedure
|
4
|
-
metadata do
|
5
|
-
description 'Backup Foreman DB offline'
|
6
|
-
tags :backup
|
7
|
-
label :backup_offline_foreman_db
|
8
|
-
for_feature :foreman_database
|
9
|
-
preparation_steps { Checks::Foreman::DBUp.new unless feature(:foreman_database).local? }
|
10
|
-
param :backup_dir, 'Directory where to backup to', :required => true
|
11
|
-
param :tar_volume_size, 'Size of tar volume (indicates splitting)'
|
12
|
-
end
|
13
|
-
|
14
|
-
def run
|
15
|
-
if feature(:foreman_database).local?
|
16
|
-
if File.exist?(pg_backup_file)
|
17
|
-
puts 'Already done'
|
18
|
-
else
|
19
|
-
local_backup
|
20
|
-
end
|
21
|
-
else
|
22
|
-
puts "Backup of #{pg_data_dirs.join(',')} is not supported for remote databases." \
|
23
|
-
' Doing postgres dump instead...'
|
24
|
-
with_spinner('Getting Foreman DB dump') do
|
25
|
-
feature(:foreman_database).dump_db(File.join(@backup_dir, 'foreman.dump'))
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def local_backup
|
33
|
-
with_spinner("Collecting data from #{pg_data_dirs.join(',')}") do
|
34
|
-
pg_data_dirs.each_with_index do |pg_dir, index|
|
35
|
-
do_backup(pg_dir, (index == 0) ? 'create' : 'append')
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def do_backup(pg_dir, cmd)
|
41
|
-
restore_dir = el? ? feature(:foreman_database).data_dir : pg_dir
|
42
|
-
feature(:foreman_database).backup_local(
|
43
|
-
pg_backup_file,
|
44
|
-
:listed_incremental => File.join(@backup_dir, '.postgres.snar'),
|
45
|
-
:volume_size => @tar_volume_size,
|
46
|
-
:data_dir => pg_dir,
|
47
|
-
:restore_dir => restore_dir,
|
48
|
-
:command => cmd
|
49
|
-
)
|
50
|
-
end
|
51
|
-
|
52
|
-
def pg_backup_file
|
53
|
-
File.join(@backup_dir, 'pgsql_data.tar')
|
54
|
-
end
|
55
|
-
|
56
|
-
def pg_data_dirs
|
57
|
-
el? ? [pg_data_dir_el] : pg_data_dirs_deb
|
58
|
-
end
|
59
|
-
|
60
|
-
def pg_data_dirs_deb
|
61
|
-
# The Debian based OSes support multiple installations of Postgresql
|
62
|
-
# There could be situations where Foreman db is either of these versions
|
63
|
-
# To be sure we backup the system correctly without missing anything
|
64
|
-
# we backup all of the Postgresql dirs
|
65
|
-
feature(:foreman_database).data_dir
|
66
|
-
end
|
67
|
-
|
68
|
-
def pg_data_dir_el
|
69
|
-
feature(:foreman_database).data_dir
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
module Procedures::Backup
|
2
|
-
module Offline
|
3
|
-
class PulpcoreDB < ForemanMaintain::Procedure
|
4
|
-
metadata do
|
5
|
-
description 'Backup Pulpcore DB offline'
|
6
|
-
tags :backup
|
7
|
-
label :backup_offline_pulpcore_db
|
8
|
-
for_feature :pulpcore_database
|
9
|
-
preparation_steps { Checks::Pulpcore::DBUp.new unless feature(:pulpcore_database).local? }
|
10
|
-
param :backup_dir, 'Directory where to backup to', :required => true
|
11
|
-
param :tar_volume_size, 'Size of tar volume (indicates splitting)'
|
12
|
-
end
|
13
|
-
|
14
|
-
def run
|
15
|
-
if feature(:pulpcore_database).local?
|
16
|
-
if File.exist?(pg_backup_file)
|
17
|
-
puts 'Already done'
|
18
|
-
else
|
19
|
-
local_backup
|
20
|
-
end
|
21
|
-
else
|
22
|
-
puts "Backup of #{pg_data_dir} is not supported for remote databases." \
|
23
|
-
' Doing postgres dump instead...'
|
24
|
-
with_spinner('Getting Pulpcore DB dump') do
|
25
|
-
feature(:pulpcore_database).dump_db(File.join(@backup_dir, 'pulpcore.dump'))
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def local_backup
|
33
|
-
with_spinner("Collecting data from #{pg_data_dir}") do
|
34
|
-
feature(:pulpcore_database).backup_local(
|
35
|
-
pg_backup_file,
|
36
|
-
:listed_incremental => File.join(@backup_dir, '.postgres.snar'),
|
37
|
-
:volume_size => @tar_volume_size,
|
38
|
-
:data_dir => pg_data_dir,
|
39
|
-
:restore_dir => feature(:pulpcore_database).data_dir
|
40
|
-
)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def pg_backup_file
|
45
|
-
File.join(@backup_dir, 'pgsql_data.tar')
|
46
|
-
end
|
47
|
-
|
48
|
-
def pg_data_dir
|
49
|
-
feature(:pulpcore_database).data_dir
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -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
|