foreman_maintain 1.5.0 → 1.6.0
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 +0 -20
- data/definitions/checks/disk/available_space_candlepin.rb +1 -1
- data/definitions/checks/disk/available_space_postgresql13.rb +42 -0
- data/definitions/checks/foreman/check_corrupted_roles.rb +0 -3
- data/definitions/checks/foreman/validate_external_db_version.rb +1 -2
- data/definitions/features/foreman_proxy.rb +2 -10
- data/definitions/features/foreman_tasks.rb +2 -6
- data/definitions/features/installer.rb +0 -4
- data/definitions/features/pulpcore_database.rb +1 -1
- data/definitions/procedures/backup/offline/candlepin_db.rb +1 -6
- data/definitions/procedures/backup/offline/foreman_db.rb +1 -8
- data/definitions/procedures/backup/offline/pulpcore_db.rb +1 -6
- data/definitions/procedures/backup/pulp.rb +1 -10
- data/definitions/procedures/foreman/fix_corrupted_roles.rb +0 -3
- data/definitions/procedures/packages/update.rb +7 -2
- data/definitions/procedures/puppet/remove_puppet.rb +1 -2
- data/definitions/procedures/restore/installer_reset.rb +1 -17
- data/definitions/scenarios/backup.rb +5 -88
- data/definitions/scenarios/packages.rb +2 -2
- data/definitions/scenarios/puppet.rb +4 -6
- data/definitions/scenarios/restore.rb +1 -1
- data/definitions/scenarios/upgrade_to_capsule_6_16.rb +14 -8
- data/definitions/scenarios/upgrade_to_capsule_6_16_z.rb +12 -8
- data/definitions/scenarios/upgrade_to_foreman_nightly.rb +3 -3
- data/definitions/scenarios/upgrade_to_katello_nightly.rb +11 -7
- data/definitions/scenarios/upgrade_to_satellite_6_16.rb +13 -8
- data/definitions/scenarios/upgrade_to_satellite_6_16_z.rb +12 -8
- data/lib/foreman_maintain/cli/backup_command.rb +0 -27
- data/lib/foreman_maintain/cli.rb +2 -0
- data/lib/foreman_maintain/concerns/base_database.rb +0 -4
- data/lib/foreman_maintain/concerns/downstream.rb +0 -4
- data/lib/foreman_maintain/concerns/os_facts.rb +4 -0
- data/lib/foreman_maintain/concerns/system_helpers.rb +0 -12
- data/lib/foreman_maintain/package_manager/dnf.rb +1 -1
- data/lib/foreman_maintain/version.rb +1 -1
- data/lib/foreman_maintain.rb +1 -1
- metadata +3 -15
- data/definitions/checks/disk/available_space_postgresql12.rb +0 -46
- data/definitions/procedures/backup/snapshot/clean_mount.rb +0 -24
- data/definitions/procedures/backup/snapshot/logical_volume_confirmation.rb +0 -56
- data/definitions/procedures/backup/snapshot/mount_base.rb +0 -27
- data/definitions/procedures/backup/snapshot/mount_candlepin_db.rb +0 -48
- data/definitions/procedures/backup/snapshot/mount_foreman_db.rb +0 -48
- data/definitions/procedures/backup/snapshot/mount_pulp.rb +0 -32
- data/definitions/procedures/backup/snapshot/mount_pulpcore_db.rb +0 -48
- data/definitions/procedures/backup/snapshot/prepare_mount.rb +0 -16
- data/definitions/procedures/backup/snapshot/snapshot_deprecation_message.rb +0 -14
- data/definitions/procedures/foreman/remove_duplicate_obsolete_roles.rb +0 -64
- data/definitions/procedures/installer/run_for_6_11.rb +0 -52
- data/definitions/procedures/installer/upgrade.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86d36d447cf87e6f991443352eb5fb9cfdc2b43b634b382c7564f5b86f7e70d1
|
4
|
+
data.tar.gz: 3811b68a80511a95cb5a67b9c8176f623f840ab500e1986b31cd8eac488378ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df3b536d2f6b89e478fb0355f4f5fbf7049f4d9195dd11c15c46133d341e1d5bd4fd14aabebd35f2b5dd92d341159e5fd8a15a7ddf7ab1f7f9241b3498fe1fe1
|
7
|
+
data.tar.gz: 0c6f8a11f9955900d30c771866ffbeb49ed6bb6c5432fe3575ecef0069d7b76db0099b6a2e37b01adc600013996a46e12d1ffd72986f882cd09b8d9b4cbc5bae
|
data/README.md
CHANGED
@@ -41,7 +41,6 @@ Subcommands:
|
|
41
41
|
backup Backup server
|
42
42
|
online Keep services online during backup
|
43
43
|
offline Shut down services to preserve consistent backup
|
44
|
-
snapshot Use snapshots of the databases to create backup
|
45
44
|
|
46
45
|
restore Restore a backup
|
47
46
|
|
@@ -114,8 +113,6 @@ state of the system.
|
|
114
113
|
|
115
114
|
#### Self-upgrade for rubygem-foreman_maintain package
|
116
115
|
|
117
|
-
**Note:** This feature is available from `rubygem-foreman_maintain` version 0.6.4 and newer.
|
118
|
-
|
119
116
|
When a user runs any `foreman-maintain upgrade` sub commands (e.g. `foreman-maintain upgrade check` or `foreman-maintain upgrade run`) then,
|
120
117
|
|
121
118
|
* If update available for `rubygem-foreman_maintain` package, the sub command tries to update this package. After successful package update, it returns the exit code 75 and requests user to re-run with the updated source code.
|
@@ -156,12 +153,6 @@ export EXTERNAL_SAT_ORG='Sat6-CI'
|
|
156
153
|
export EXTERNAL_SAT_ACTIVATION_KEY='Satellite QA RHEL7'
|
157
154
|
```
|
158
155
|
|
159
|
-
To use beta repositories during upgrade, set the following environment variable
|
160
|
-
|
161
|
-
```
|
162
|
-
export FOREMAN_MAINTAIN_USE_BETA='1'
|
163
|
-
```
|
164
|
-
|
165
156
|
## Implementation
|
166
157
|
|
167
158
|
The `foreman_maintain` maps the CLI commands into definitions. This allows to keep the set
|
@@ -427,17 +418,6 @@ There are multiple kind of tests `foreman_maintain`:
|
|
427
418
|
|
428
419
|
Execute `rake` to run the tests.
|
429
420
|
|
430
|
-
## Planned commands:
|
431
|
-
|
432
|
-
```
|
433
|
-
foreman-maintain health [check|fix]
|
434
|
-
foreman-maintain upgrade [check|run|abort] [foreman_1_14, satellite_6_1, satellite_6_2]
|
435
|
-
foreman-maintain monitor [display|upload]
|
436
|
-
foreman-maintain debug [save|upload|tail]
|
437
|
-
foreman-maintain console
|
438
|
-
foreman-maintain config
|
439
|
-
```
|
440
|
-
|
441
421
|
## Bash completion
|
442
422
|
|
443
423
|
The completion offers suggestion of possible command-line subcommands and their options
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Checks
|
2
|
+
module Disk
|
3
|
+
class AvailableSpacePostgresql13 < ForemanMaintain::Check
|
4
|
+
metadata do
|
5
|
+
label :available_space_for_postgresql13
|
6
|
+
description 'Check to make sure PostgreSQL 13 work directory has enough space for upgrade'
|
7
|
+
confine do
|
8
|
+
feature(:instance).postgresql_local?
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
assert(psql_13_available_space >= psql_12_consumed_space, warning_message)
|
14
|
+
end
|
15
|
+
|
16
|
+
def pgsql_dir(version)
|
17
|
+
case version
|
18
|
+
when 12
|
19
|
+
'/var/lib/pgsql/data'
|
20
|
+
when 13
|
21
|
+
'/var/lib/pgsql'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def psql_12_consumed_space
|
26
|
+
io_obj = ForemanMaintain::Utils::Disk::IODevice.new(pgsql_dir(12))
|
27
|
+
io_obj.space_used
|
28
|
+
end
|
29
|
+
|
30
|
+
def psql_13_available_space
|
31
|
+
io_obj = ForemanMaintain::Utils::Disk::IODevice.new(pgsql_dir(13))
|
32
|
+
io_obj.available_space
|
33
|
+
end
|
34
|
+
|
35
|
+
def warning_message
|
36
|
+
"PostgreSQL will be upgraded from 12 to 13. \n" \
|
37
|
+
"During the upgrade a backup is created in /var/lib/pgsql/data-old and requires " \
|
38
|
+
"at least #{psql_12_consumed_space} MiB free space."
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -6,8 +6,7 @@ module Checks
|
|
6
6
|
tags :pre_upgrade
|
7
7
|
label :validate_external_db_version
|
8
8
|
confine do
|
9
|
-
feature(:foreman_database) && !feature(:foreman_database).local?
|
10
|
-
!check_min_version('foreman', '2.0')
|
9
|
+
feature(:foreman_database) && !feature(:foreman_database).local?
|
11
10
|
end
|
12
11
|
end
|
13
12
|
|
@@ -28,11 +28,7 @@ class Features::ForemanProxy < ForemanMaintain::Feature
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def services
|
31
|
-
|
32
|
-
if check_max_version('foreman-proxy', '2.4')
|
33
|
-
services << system_service('smart_proxy_dynflow_core', 20)
|
34
|
-
end
|
35
|
-
services
|
31
|
+
[system_service('foreman-proxy', 40)]
|
36
32
|
end
|
37
33
|
|
38
34
|
def features
|
@@ -94,11 +90,7 @@ class Features::ForemanProxy < ForemanMaintain::Feature
|
|
94
90
|
end
|
95
91
|
|
96
92
|
def certs_param_name
|
97
|
-
|
98
|
-
return { :param_section => 'certs', :param_key => 'tar_file' }
|
99
|
-
end
|
100
|
-
|
101
|
-
{ :param_section => 'foreman_proxy_content', :param_key => 'certs_tar' }
|
93
|
+
{ :param_section => 'certs', :param_key => 'tar_file' }
|
102
94
|
end
|
103
95
|
|
104
96
|
def certs_tar
|
@@ -91,13 +91,9 @@ class Features::ForemanTasks < ForemanMaintain::Feature
|
|
91
91
|
DELETE FROM foreman_tasks_tasks WHERE #{tasks_condition};
|
92
92
|
-- Delete locks and links which may now be orphaned
|
93
93
|
DELETE FROM foreman_tasks_locks as ftl where ftl.task_id NOT IN (SELECT id FROM foreman_tasks_tasks);
|
94
|
+
DELETE FROM foreman_tasks_links as ftl where ftl.task_id NOT IN (SELECT id FROM foreman_tasks_tasks);
|
94
95
|
SQL
|
95
96
|
|
96
|
-
if check_min_version(foreman_plugin_name('foreman-tasks'), '4.0.0')
|
97
|
-
sql += 'DELETE FROM foreman_tasks_links as ftl ' \
|
98
|
-
'where ftl.task_id NOT IN (SELECT id FROM foreman_tasks_tasks);'
|
99
|
-
end
|
100
|
-
|
101
97
|
feature(:foreman_database).psql("BEGIN; #{sql}; COMMIT;")
|
102
98
|
|
103
99
|
count(state)
|
@@ -134,7 +130,7 @@ class Features::ForemanTasks < ForemanMaintain::Feature
|
|
134
130
|
end
|
135
131
|
|
136
132
|
def service_name
|
137
|
-
|
133
|
+
'dynflowd'
|
138
134
|
end
|
139
135
|
|
140
136
|
private
|
@@ -60,10 +60,6 @@ class Features::Installer < ForemanMaintain::Feature
|
|
60
60
|
[cmd_status, out]
|
61
61
|
end
|
62
62
|
|
63
|
-
def upgrade(exec_options = {})
|
64
|
-
run('', exec_options)
|
65
|
-
end
|
66
|
-
|
67
63
|
def initial_admin_username
|
68
64
|
feature(:installer).answers['foreman']['initial_admin_username'] ||
|
69
65
|
feature(:installer).answers['foreman']['admin_username']
|
@@ -9,7 +9,6 @@ module Procedures::Backup
|
|
9
9
|
preparation_steps { Checks::Candlepin::DBUp.new unless feature(:candlepin_database).local? }
|
10
10
|
param :backup_dir, 'Directory where to backup to', :required => true
|
11
11
|
param :tar_volume_size, 'Size of tar volume (indicates splitting)'
|
12
|
-
param :mount_dir, 'Snapshot mount directory'
|
13
12
|
end
|
14
13
|
|
15
14
|
def run
|
@@ -47,11 +46,7 @@ module Procedures::Backup
|
|
47
46
|
end
|
48
47
|
|
49
48
|
def pg_data_dir
|
50
|
-
|
51
|
-
mount_point = File.join(@mount_dir, 'pgsql')
|
52
|
-
dir = feature(:candlepin_database).find_base_directory(mount_point)
|
53
|
-
fail!("Snapshot of Candlepin DB was not found mounted in #{mount_point}") if dir.nil?
|
54
|
-
dir
|
49
|
+
feature(:candlepin_database).data_dir
|
55
50
|
end
|
56
51
|
end
|
57
52
|
end
|
@@ -9,7 +9,6 @@ module Procedures::Backup
|
|
9
9
|
preparation_steps { Checks::Foreman::DBUp.new unless feature(:foreman_database).local? }
|
10
10
|
param :backup_dir, 'Directory where to backup to', :required => true
|
11
11
|
param :tar_volume_size, 'Size of tar volume (indicates splitting)'
|
12
|
-
param :mount_dir, 'Snapshot mount directory'
|
13
12
|
end
|
14
13
|
|
15
14
|
def run
|
@@ -63,17 +62,11 @@ module Procedures::Backup
|
|
63
62
|
# There could be situations where Foreman db is either of these versions
|
64
63
|
# To be sure we backup the system correctly without missing anything
|
65
64
|
# we backup all of the Postgresql dirs
|
66
|
-
# Yet to implement the snapshot backup!
|
67
65
|
feature(:foreman_database).data_dir
|
68
66
|
end
|
69
67
|
|
70
68
|
def pg_data_dir_el
|
71
|
-
|
72
|
-
|
73
|
-
mount_point = File.join(@mount_dir, 'pgsql')
|
74
|
-
dir = feature(:foreman_database).find_base_directory(mount_point)
|
75
|
-
fail!("Snapshot of Foreman DB was not found mounted in #{mount_point}") if dir.nil?
|
76
|
-
dir
|
69
|
+
feature(:foreman_database).data_dir
|
77
70
|
end
|
78
71
|
end
|
79
72
|
end
|
@@ -9,7 +9,6 @@ module Procedures::Backup
|
|
9
9
|
preparation_steps { Checks::Pulpcore::DBUp.new unless feature(:pulpcore_database).local? }
|
10
10
|
param :backup_dir, 'Directory where to backup to', :required => true
|
11
11
|
param :tar_volume_size, 'Size of tar volume (indicates splitting)'
|
12
|
-
param :mount_dir, 'Snapshot mount directory'
|
13
12
|
end
|
14
13
|
|
15
14
|
def run
|
@@ -47,11 +46,7 @@ module Procedures::Backup
|
|
47
46
|
end
|
48
47
|
|
49
48
|
def pg_data_dir
|
50
|
-
|
51
|
-
mount_point = File.join(@mount_dir, 'pgsql')
|
52
|
-
dir = feature(:pulpcore_database).find_base_directory(mount_point)
|
53
|
-
fail!("Snapshot of Pulpcore DB was not found mounted in #{mount_point}") if dir.nil?
|
54
|
-
dir
|
49
|
+
feature(:pulpcore_database).data_dir
|
55
50
|
end
|
56
51
|
end
|
57
52
|
end
|
@@ -7,7 +7,6 @@ module Procedures::Backup
|
|
7
7
|
param :tar_volume_size, 'Size of tar volume (indicates splitting)'
|
8
8
|
param :ensure_unchanged, 'Ensure the data did not change during backup'
|
9
9
|
param :skip, 'Skip Pulp content during backup'
|
10
|
-
param :mount_dir, 'Snapshot mount directory'
|
11
10
|
|
12
11
|
confine do
|
13
12
|
feature(:pulpcore_database)
|
@@ -46,15 +45,7 @@ module Procedures::Backup
|
|
46
45
|
end
|
47
46
|
|
48
47
|
def pulp_dir
|
49
|
-
|
50
|
-
|
51
|
-
mount_point = File.join(@mount_dir, 'pulp')
|
52
|
-
dir = any_pulp_feature.find_marked_directory(mount_point)
|
53
|
-
unless dir
|
54
|
-
raise ForemanMaintain::Error::Fail,
|
55
|
-
"Pulp base directory not found in the mount point (#{mount_point})"
|
56
|
-
end
|
57
|
-
dir
|
48
|
+
any_pulp_feature.pulp_data_dir
|
58
49
|
end
|
59
50
|
|
60
51
|
def ensure_dir_unchanged
|
@@ -7,11 +7,12 @@ module Procedures::Packages
|
|
7
7
|
param :warn_on_errors, 'Do not interrupt scenario on failure',
|
8
8
|
:flag => true, :default => false
|
9
9
|
param :dnf_options, 'Extra dnf options if any', :array => true, :default => []
|
10
|
+
param :clean_cache, 'If true will cause a DNF cache clean', :flag => true, :default => true
|
10
11
|
end
|
11
12
|
|
12
13
|
def run
|
13
14
|
assumeyes_val = @assumeyes.nil? ? assumeyes? : @assumeyes
|
14
|
-
package_manager.clean_cache(:assumeyes => assumeyes_val)
|
15
|
+
package_manager.clean_cache(:assumeyes => assumeyes_val) if @clean_cache
|
15
16
|
opts = { :assumeyes => assumeyes_val, :dnf_options => @dnf_options }
|
16
17
|
packages_action(:update, @packages, opts)
|
17
18
|
rescue ForemanMaintain::Error::ExecutionError => e
|
@@ -27,11 +28,15 @@ module Procedures::Packages
|
|
27
28
|
end
|
28
29
|
|
29
30
|
def description
|
30
|
-
if
|
31
|
+
if download_only?
|
31
32
|
"Download package(s) #{@packages.join(', ')}"
|
32
33
|
else
|
33
34
|
"Update package(s) #{@packages.join(', ')}"
|
34
35
|
end
|
35
36
|
end
|
37
|
+
|
38
|
+
def download_only?
|
39
|
+
@dnf_options.include?('--downloadonly')
|
40
|
+
end
|
36
41
|
end
|
37
42
|
end
|
@@ -12,28 +12,12 @@ module Procedures::Restore
|
|
12
12
|
|
13
13
|
def installer_cmd
|
14
14
|
installer = "yes | #{feature(:installer).installer_command} "
|
15
|
-
installer <<
|
15
|
+
installer << '-v --reset-data '
|
16
16
|
if feature(:instance).foreman_proxy_with_content?
|
17
17
|
installer << '--foreman-proxy-register-in-foreman false '
|
18
18
|
end
|
19
19
|
|
20
|
-
# We always disable system checks to avoid unnecessary errors. The installer should have
|
21
|
-
# already ran since this is to be run on an existing system, which means installer checks
|
22
|
-
# has already been skipped
|
23
|
-
if feature(:foreman_proxy)&.with_content? &&
|
24
|
-
check_max_version('foreman-installer', '3.4')
|
25
|
-
installer << '--disable-system-checks '
|
26
|
-
end
|
27
20
|
installer
|
28
21
|
end
|
29
|
-
|
30
|
-
def reset_option
|
31
|
-
if check_min_version('foreman', '2.2') || \
|
32
|
-
check_min_version('foreman-proxy', '2.2')
|
33
|
-
return '-v --reset-data '
|
34
|
-
end
|
35
|
-
|
36
|
-
'-v --reset '
|
37
|
-
end
|
38
22
|
end
|
39
23
|
end
|
@@ -5,27 +5,22 @@ module ForemanMaintain::Scenarios
|
|
5
5
|
manual_detection
|
6
6
|
tags :backup
|
7
7
|
run_strategy :fail_fast
|
8
|
-
param :strategy, 'Backup strategy. One of [:online, :offline
|
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 :mount_dir, 'Snapshot mount directory'
|
12
11
|
param :include_db_dumps, 'Include dumps of local dbs as part of offline'
|
13
12
|
param :preserve_dir, 'Directory where to backup to'
|
14
13
|
param :incremental_dir, 'Changes since specified backup only'
|
15
14
|
param :proxy_features, 'List of proxy features to backup (default: all)', :array => true
|
16
|
-
param :snapshot_mount_dir, 'Snapshot mount directory'
|
17
|
-
param :snapshot_block_size, 'Snapshot block size'
|
18
15
|
param :skip_pulp_content, 'Skip Pulp content during backup'
|
19
16
|
param :tar_volume_size, 'Size of tar volume (indicates splitting)'
|
20
17
|
end
|
21
18
|
|
22
19
|
def compose
|
23
20
|
check_valid_strategy
|
24
|
-
snapshot_deprecation_warning
|
25
21
|
safety_confirmation
|
26
22
|
accessibility_confirmation
|
27
23
|
prepare_directory
|
28
|
-
logical_volume_confirmation
|
29
24
|
add_step_with_context(Procedures::Backup::Metadata, :online_backup => online_backup?)
|
30
25
|
|
31
26
|
case strategy
|
@@ -33,20 +28,10 @@ module ForemanMaintain::Scenarios
|
|
33
28
|
add_online_backup_steps
|
34
29
|
when :offline
|
35
30
|
add_offline_backup_steps
|
36
|
-
when :snapshot
|
37
|
-
deb_snapshot_msg
|
38
|
-
add_snapshot_backup_steps
|
39
31
|
end
|
40
32
|
add_step_with_context(Procedures::Backup::CompressData)
|
41
33
|
end
|
42
34
|
|
43
|
-
def deb_snapshot_msg
|
44
|
-
if debian_or_ubuntu?
|
45
|
-
puts 'The snapshot backup is not yet available for Debian based OSes!'
|
46
|
-
exit 0
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
35
|
# rubocop:disable Metrics/MethodLength
|
51
36
|
def set_context_mapping
|
52
37
|
context.map(:backup_dir,
|
@@ -60,11 +45,7 @@ module ForemanMaintain::Scenarios
|
|
60
45
|
Procedures::Backup::Online::PulpcoreDB => :backup_dir,
|
61
46
|
Procedures::Backup::Offline::CandlepinDB => :backup_dir,
|
62
47
|
Procedures::Backup::Offline::ForemanDB => :backup_dir,
|
63
|
-
Procedures::Backup::Offline::PulpcoreDB => :backup_dir
|
64
|
-
Procedures::Backup::Snapshot::LogicalVolumeConfirmation => :backup_dir,
|
65
|
-
Procedures::Backup::Snapshot::MountCandlepinDB => :backup_dir,
|
66
|
-
Procedures::Backup::Snapshot::MountForemanDB => :backup_dir,
|
67
|
-
Procedures::Backup::Snapshot::MountPulpcoreDB => :backup_dir)
|
48
|
+
Procedures::Backup::Offline::PulpcoreDB => :backup_dir)
|
68
49
|
context.map(:preserve_dir,
|
69
50
|
Procedures::Backup::PrepareDirectory => :preserve_dir)
|
70
51
|
context.map(:incremental_dir,
|
@@ -72,26 +53,8 @@ module ForemanMaintain::Scenarios
|
|
72
53
|
Procedures::Backup::Metadata => :incremental_dir)
|
73
54
|
context.map(:proxy_features,
|
74
55
|
Procedures::Backup::ConfigFiles => :proxy_features)
|
75
|
-
context.map(:snapshot_mount_dir,
|
76
|
-
Procedures::Backup::Snapshot::PrepareMount => :mount_dir,
|
77
|
-
Procedures::Backup::Snapshot::MountPulp => :mount_dir,
|
78
|
-
Procedures::Backup::Snapshot::CleanMount => :mount_dir,
|
79
|
-
Procedures::Backup::Snapshot::MountCandlepinDB => :mount_dir,
|
80
|
-
Procedures::Backup::Snapshot::MountForemanDB => :mount_dir,
|
81
|
-
Procedures::Backup::Snapshot::MountPulpcoreDB => :mount_dir,
|
82
|
-
Procedures::Backup::Pulp => :mount_dir,
|
83
|
-
Procedures::Backup::Offline::CandlepinDB => :mount_dir,
|
84
|
-
Procedures::Backup::Offline::ForemanDB => :mount_dir,
|
85
|
-
Procedures::Backup::Offline::PulpcoreDB => :mount_dir)
|
86
|
-
context.map(:snapshot_block_size,
|
87
|
-
Procedures::Backup::Snapshot::MountPulp => :block_size,
|
88
|
-
Procedures::Backup::Snapshot::MountForemanDB => :block_size,
|
89
|
-
Procedures::Backup::Snapshot::MountCandlepinDB => :block_size,
|
90
|
-
Procedures::Backup::Snapshot::MountPulpcoreDB => :block_size)
|
91
56
|
context.map(:skip_pulp_content,
|
92
|
-
Procedures::Backup::Pulp => :skip
|
93
|
-
Procedures::Backup::Snapshot::LogicalVolumeConfirmation => :skip_pulp,
|
94
|
-
Procedures::Backup::Snapshot::MountPulp => :skip)
|
57
|
+
Procedures::Backup::Pulp => :skip)
|
95
58
|
context.map(:tar_volume_size,
|
96
59
|
Procedures::Backup::Pulp => :tar_volume_size)
|
97
60
|
context.map(:include_db_dumps,
|
@@ -105,20 +68,8 @@ module ForemanMaintain::Scenarios
|
|
105
68
|
add_step_with_context(Procedures::Backup::PrepareDirectory)
|
106
69
|
end
|
107
70
|
|
108
|
-
def logical_volume_confirmation
|
109
|
-
if strategy == :snapshot
|
110
|
-
add_step_with_context(Procedures::Backup::Snapshot::LogicalVolumeConfirmation)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
def snapshot_deprecation_warning
|
115
|
-
if strategy == :snapshot
|
116
|
-
add_step_with_context(Procedures::Backup::Snapshot::SnapshotDeprecationMessage)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
71
|
def accessibility_confirmation
|
121
|
-
if
|
72
|
+
if strategy == :offline
|
122
73
|
add_step_with_context(Procedures::Backup::AccessibilityConfirmation)
|
123
74
|
end
|
124
75
|
end
|
@@ -130,7 +81,7 @@ module ForemanMaintain::Scenarios
|
|
130
81
|
end
|
131
82
|
|
132
83
|
def check_valid_strategy
|
133
|
-
unless [:online, :offline
|
84
|
+
unless [:online, :offline].include? strategy
|
134
85
|
raise ArgumentError, "Unsupported strategy '#{strategy}'"
|
135
86
|
end
|
136
87
|
end
|
@@ -163,36 +114,6 @@ module ForemanMaintain::Scenarios
|
|
163
114
|
end
|
164
115
|
end
|
165
116
|
|
166
|
-
# rubocop:disable Metrics/MethodLength
|
167
|
-
def add_snapshot_backup_steps
|
168
|
-
include_dumps if include_db_dumps?
|
169
|
-
add_step_with_context(Procedures::ForemanProxy::Features, :load_only => true)
|
170
|
-
add_steps_with_context(
|
171
|
-
Procedures::Backup::Snapshot::PrepareMount,
|
172
|
-
find_procedures(:maintenance_mode_on),
|
173
|
-
Procedures::Service::Stop,
|
174
|
-
Procedures::Backup::ConfigFiles,
|
175
|
-
Procedures::Backup::Snapshot::MountPulp,
|
176
|
-
Procedures::Backup::Snapshot::MountCandlepinDB,
|
177
|
-
Procedures::Backup::Snapshot::MountForemanDB,
|
178
|
-
Procedures::Backup::Snapshot::MountPulpcoreDB,
|
179
|
-
Procedures::Service::Start,
|
180
|
-
find_procedures(:maintenance_mode_off),
|
181
|
-
Procedures::Backup::Pulp
|
182
|
-
)
|
183
|
-
if feature(:instance).database_local?(:candlepin_database)
|
184
|
-
add_step_with_context(Procedures::Backup::Offline::CandlepinDB)
|
185
|
-
end
|
186
|
-
if feature(:instance).database_local?(:foreman_database)
|
187
|
-
add_step_with_context(Procedures::Backup::Offline::ForemanDB)
|
188
|
-
end
|
189
|
-
if feature(:instance).database_local?(:pulpcore_database)
|
190
|
-
add_step_with_context(Procedures::Backup::Offline::PulpcoreDB)
|
191
|
-
end
|
192
|
-
add_step_with_context(Procedures::Backup::Snapshot::CleanMount)
|
193
|
-
end
|
194
|
-
# rubocop:enable Metrics/MethodLength
|
195
|
-
|
196
117
|
def add_online_backup_steps
|
197
118
|
add_step_with_context(Procedures::Backup::ConfigFiles, :ignore_changed_files => true,
|
198
119
|
:online_backup => true)
|
@@ -224,20 +145,16 @@ module ForemanMaintain::Scenarios
|
|
224
145
|
run_strategy :fail_slow
|
225
146
|
tags :backup
|
226
147
|
param :backup_dir, 'Directory where to backup to', :required => true
|
227
|
-
param :mount_dir, 'Snapshot mount directory'
|
228
148
|
param :preserve_dir, 'Directory where to backup to'
|
229
149
|
end
|
230
150
|
|
231
151
|
def compose
|
232
152
|
add_step_with_context(Procedures::Service::Start) if strategy != :online
|
233
153
|
add_steps_with_context(find_procedures(:maintenance_mode_off)) if strategy != :online
|
234
|
-
add_step_with_context(Procedures::Backup::Snapshot::CleanMount) if strategy == :snapshot
|
235
154
|
add_step_with_context(Procedures::Backup::Clean)
|
236
155
|
end
|
237
156
|
|
238
157
|
def set_context_mapping
|
239
|
-
context.map(:snapshot_mount_dir,
|
240
|
-
Procedures::Backup::Snapshot::CleanMount => :mount_dir)
|
241
158
|
context.map(:backup_dir,
|
242
159
|
Procedures::Backup::Clean => :backup_dir)
|
243
160
|
context.map(:preserve_dir,
|
@@ -79,7 +79,7 @@ module ForemanMaintain::Scenarios
|
|
79
79
|
add_step_with_context(Procedures::Packages::UnlockVersions)
|
80
80
|
add_step_with_context(Procedures::Packages::Install,
|
81
81
|
:force => true, :warn_on_errors => true)
|
82
|
-
add_step_with_context(Procedures::Installer::
|
82
|
+
add_step_with_context(Procedures::Installer::Run)
|
83
83
|
add_step(Procedures::Packages::LockingStatus)
|
84
84
|
end
|
85
85
|
end
|
@@ -112,7 +112,7 @@ module ForemanMaintain::Scenarios
|
|
112
112
|
add_step_with_context(Procedures::Packages::UnlockVersions)
|
113
113
|
add_step_with_context(Procedures::Packages::Update,
|
114
114
|
:force => true, :warn_on_errors => true)
|
115
|
-
add_step_with_context(Procedures::Installer::
|
115
|
+
add_step_with_context(Procedures::Installer::Run)
|
116
116
|
add_step(Procedures::Packages::LockingStatus)
|
117
117
|
end
|
118
118
|
end
|
@@ -10,12 +10,10 @@ module ForemanMaintain::Scenarios
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def compose
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
add_step(Procedures::Service::Restart)
|
18
|
-
end
|
13
|
+
add_step(Checks::CheckPuppetCapsules) if server?
|
14
|
+
add_step(Procedures::Puppet::RemovePuppet)
|
15
|
+
add_step(Procedures::Puppet::RemovePuppetData) if context.get(:remove_data)
|
16
|
+
add_step(Procedures::Service::Restart)
|
19
17
|
end
|
20
18
|
end
|
21
19
|
end
|
@@ -58,7 +58,7 @@ module ForemanMaintain::Scenarios
|
|
58
58
|
|
59
59
|
add_steps_with_context(Procedures::Service::Start,
|
60
60
|
Procedures::Service::DaemonReload)
|
61
|
-
add_step(Procedures::Installer::
|
61
|
+
add_step(Procedures::Installer::Run.new(:assumeyes => true))
|
62
62
|
add_step_with_context(Procedures::Installer::UpgradeRakeTask)
|
63
63
|
add_step_with_context(Procedures::Crond::Start) if feature(:cron)
|
64
64
|
end
|
@@ -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::Disk::AvailableSpacePostgresql13)
|
30
31
|
add_step(Checks::Repositories::Validate.new(:version => '6.16'))
|
31
32
|
end
|
32
33
|
end
|
@@ -38,6 +39,16 @@ module Scenarios::Capsule_6_16
|
|
38
39
|
end
|
39
40
|
|
40
41
|
def compose
|
42
|
+
add_step(Procedures::Repositories::Setup.new(:version => '6.16'))
|
43
|
+
if el8?
|
44
|
+
modules_to_enable = ["satellite-capsule:#{el_short_name}"]
|
45
|
+
add_step(Procedures::Packages::EnableModules.new(:module_names => modules_to_enable))
|
46
|
+
end
|
47
|
+
add_step(Procedures::Packages::Update.new(
|
48
|
+
:assumeyes => true,
|
49
|
+
:dnf_options => ['--downloadonly']
|
50
|
+
))
|
51
|
+
|
41
52
|
add_steps(find_procedures(:pre_migrations))
|
42
53
|
end
|
43
54
|
end
|
@@ -49,18 +60,13 @@ module Scenarios::Capsule_6_16
|
|
49
60
|
end
|
50
61
|
|
51
62
|
def set_context_mapping
|
52
|
-
context.map(:assumeyes, Procedures::Installer::
|
63
|
+
context.map(:assumeyes, Procedures::Installer::Run => :assumeyes)
|
53
64
|
end
|
54
65
|
|
55
66
|
def compose
|
56
|
-
add_step(Procedures::Repositories::Setup.new(:version => '6.16'))
|
57
|
-
modules_to_enable = ["satellite-capsule:#{el_short_name}"]
|
58
|
-
add_step(Procedures::Packages::EnableModules.new(:module_names => modules_to_enable))
|
59
|
-
add_step(Procedures::Packages::Update.new(:assumeyes => true,
|
60
|
-
:dnf_options => ['--downloadonly']))
|
61
67
|
add_step(Procedures::Service::Stop.new)
|
62
|
-
add_step(Procedures::Packages::Update.new(:assumeyes => true))
|
63
|
-
add_step_with_context(Procedures::Installer::
|
68
|
+
add_step(Procedures::Packages::Update.new(:assumeyes => true, :clean_cache => false))
|
69
|
+
add_step_with_context(Procedures::Installer::Run)
|
64
70
|
end
|
65
71
|
end
|
66
72
|
|