foreman_maintain 0.6.14 → 0.7.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 +2 -2
- data/definitions/checks/package_manager/yum/validate_yum_config.rb +51 -0
- data/definitions/features/pulpcore.rb +23 -6
- data/definitions/procedures/backup/accessibility_confirmation.rb +1 -1
- data/definitions/procedures/backup/online/safety_confirmation.rb +1 -1
- data/definitions/procedures/backup/snapshot/logical_volume_confirmation.rb +1 -1
- data/definitions/procedures/content/migration_stats.rb +12 -0
- data/definitions/procedures/content/prepare.rb +0 -5
- data/definitions/procedures/content/prepare_abort.rb +12 -0
- data/definitions/procedures/content/switchover.rb +1 -1
- data/definitions/procedures/packages/installer_confirmation.rb +1 -1
- data/definitions/procedures/packages/update_all_confirmation.rb +1 -1
- data/definitions/procedures/prep_6_10_upgrade.rb +31 -0
- data/definitions/procedures/restore/confirmation.rb +1 -1
- data/definitions/procedures/restore/installer_reset.rb +10 -1
- data/definitions/scenarios/content.rb +50 -3
- data/definitions/scenarios/prep_6_10_upgrade.rb +13 -0
- data/definitions/scenarios/upgrade_to_capsule_6_9.rb +88 -0
- data/definitions/scenarios/upgrade_to_capsule_6_9_z.rb +88 -0
- data/definitions/scenarios/upgrade_to_satellite_6_9.rb +90 -0
- data/definitions/scenarios/upgrade_to_satellite_6_9_z.rb +89 -0
- data/lib/foreman_maintain.rb +1 -1
- data/lib/foreman_maintain/cli.rb +9 -0
- data/lib/foreman_maintain/cli/content_command.rb +17 -2
- data/lib/foreman_maintain/concerns/downstream.rb +4 -0
- data/lib/foreman_maintain/reporter.rb +18 -13
- data/lib/foreman_maintain/reporter/cli_reporter.rb +18 -9
- data/lib/foreman_maintain/runner.rb +6 -4
- data/lib/foreman_maintain/scenario.rb +4 -0
- data/lib/foreman_maintain/utils/service/systemd.rb +11 -1
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +12 -4
- data/definitions/checks/yum_exclude.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4151b9d6dbc810f7f85aa093bdcfc4f967530dbeddcf7e13e88ce998125211dc
|
4
|
+
data.tar.gz: e7db5a3881d9652bae19c61f95ff95076745f36212c6e36f4cf582d4b5f33c8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56165e03d708aa74d5b370cd7f2ca96a0121b2b97d14f326372181ef2c464eb9856dbafd1f60ad99aea89c9a610a1579a334a4a69c12abee38b70d2eb84a899a
|
7
|
+
data.tar.gz: e43c42dbbe5aab6752e16429dae6fd70367510be2df57f026aa5ad53bb1efb9ef9e4eb2efc4331aef3823b93729412b789bc8c3e8396e03b4563bc82cf42199b
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Foreman
|
1
|
+
# Foreman Maintain [](https://github.com/theforeman/foreman_maintain/workflows/Ruby%20Tests/badge.svg?event=pull_request) <a href="https://codeclimate.com/github/theforeman/foreman_maintain"><img src="https://codeclimate.com/github/theforeman/foreman_maintain/badges/gpa.svg" /></a>
|
2
2
|
|
3
3
|
The `foreman_maintain` aims to provide various features that helps keep the
|
4
4
|
Foreman/Satellite up and running. It supports multiple versions and subparts
|
@@ -52,7 +52,7 @@ Subcommands:
|
|
52
52
|
is-enabled Get maintenance-mode status code
|
53
53
|
|
54
54
|
content Content related commands
|
55
|
-
prepare Prepare content for Pulp 3
|
55
|
+
prepare Prepare content for Pulp 3
|
56
56
|
switchover Switch support for certain content from Pulp 2 to Pulp 3
|
57
57
|
```
|
58
58
|
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Checks::PackageManager
|
2
|
+
module Yum
|
3
|
+
class ValidateYumConfig < ForemanMaintain::Check
|
4
|
+
metadata do
|
5
|
+
label :validate_yum_config
|
6
|
+
description 'Check to validate yum configuration before upgrade'
|
7
|
+
tags :pre_upgrade
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
final_result = verify_config_options
|
12
|
+
assert(
|
13
|
+
final_result[:matched_keys].empty?,
|
14
|
+
failure_message(final_result)
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def failure_message(final_result)
|
21
|
+
verb_string = final_result[:matched_keys].length > 1 ? 'are' : 'is'
|
22
|
+
|
23
|
+
"#{final_result[:matched_keys].join(',')} #{verb_string} set in /etc/yum.conf as below:"\
|
24
|
+
"\n#{final_result[:grep_output]}"\
|
25
|
+
"\nUnset this configuration as it is risky while yum update or upgrade!"
|
26
|
+
end
|
27
|
+
|
28
|
+
def verify_config_options
|
29
|
+
result = {}
|
30
|
+
combined_regex = yum_config_options.values.join('|')
|
31
|
+
result[:grep_output] = execute_grep_cmd(combined_regex)
|
32
|
+
result[:matched_keys] = yum_config_options.keys.select do |key|
|
33
|
+
result[:grep_output].include?(key)
|
34
|
+
end
|
35
|
+
result
|
36
|
+
end
|
37
|
+
|
38
|
+
def execute_grep_cmd(regex_string)
|
39
|
+
execute_with_status("grep -iE '#{regex_string}' /etc/yum.conf")[1]
|
40
|
+
end
|
41
|
+
|
42
|
+
def yum_config_options
|
43
|
+
@yum_config_options ||= {
|
44
|
+
'exclude' => '^exclude\s*=\s*\S+.*$',
|
45
|
+
'clean_requirements_on_remove' =>
|
46
|
+
'^clean_requirements_on_remove\s*=\S*(1|yes|true)$'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -5,24 +5,41 @@ class Features::Pulpcore < ForemanMaintain::Feature
|
|
5
5
|
label :pulpcore
|
6
6
|
|
7
7
|
confine do
|
8
|
-
ForemanMaintain::Utils::Service::Systemd.new('pulpcore-api', 0).exist?
|
8
|
+
ForemanMaintain::Utils::Service::Systemd.new('pulpcore-api', 0).exist? &&
|
9
|
+
ForemanMaintain::Utils::Service::Systemd.new('pulpcore-api', 0).enabled?
|
9
10
|
end
|
10
11
|
end
|
11
12
|
|
12
13
|
def services
|
13
|
-
[
|
14
|
-
system_service('rh-redis5-redis', 5),
|
15
|
-
system_service('pulpcore-api', 10),
|
16
|
-
system_service('pulpcore-content', 10),
|
17
|
-
system_service('pulpcore-resource-manager', 10),
|
14
|
+
pulpcore_common_services + [
|
18
15
|
system_service('pulpcore-worker@*', 20, :all => true, :skip_enablement => true),
|
19
16
|
system_service('httpd', 30)
|
20
17
|
]
|
21
18
|
end
|
22
19
|
|
20
|
+
def pulpcore_migration_services
|
21
|
+
pulpcore_common_services + [
|
22
|
+
system_service('pulpcore-worker@1', 20),
|
23
|
+
system_service('pulpcore-worker@2', 20),
|
24
|
+
system_service('pulpcore-worker@3', 20),
|
25
|
+
system_service('pulpcore-worker@4', 20)
|
26
|
+
]
|
27
|
+
end
|
28
|
+
|
23
29
|
def config_files
|
24
30
|
[
|
25
31
|
'/etc/pulp/settings.py'
|
26
32
|
]
|
27
33
|
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def pulpcore_common_services
|
38
|
+
[
|
39
|
+
system_service('rh-redis5-redis', 5),
|
40
|
+
system_service('pulpcore-api', 10, :socket => 'pulpcore-api'),
|
41
|
+
system_service('pulpcore-content', 10, :socket => 'pulpcore-content'),
|
42
|
+
system_service('pulpcore-resource-manager', 10)
|
43
|
+
]
|
44
|
+
end
|
28
45
|
end
|
@@ -7,7 +7,7 @@ module Procedures::Backup
|
|
7
7
|
|
8
8
|
def run
|
9
9
|
answer = ask_decision("WARNING: This script will stop your services.\n\n" \
|
10
|
-
'Do you want to proceed?', 'y(yes), q(quit)')
|
10
|
+
'Do you want to proceed?', actions_msg: 'y(yes), q(quit)')
|
11
11
|
abort! unless answer == :yes
|
12
12
|
end
|
13
13
|
end
|
@@ -16,7 +16,7 @@ module Procedures::Backup
|
|
16
16
|
" If you wish to utilize the online backup\n" \
|
17
17
|
'*** for production use you need to ensure that there are' \
|
18
18
|
" no modifications occurring during\n" \
|
19
|
-
"*** your backup run.\n\nDo you want to proceed?", 'y(yes), q(quit)'
|
19
|
+
"*** your backup run.\n\nDo you want to proceed?", actions_msg: 'y(yes), q(quit)'
|
20
20
|
)
|
21
21
|
abort! unless answer == :yes
|
22
22
|
end
|
@@ -40,7 +40,7 @@ module Procedures::Backup
|
|
40
40
|
'*** If you would like to continue, the snapshot size will be required to be at least' \
|
41
41
|
" the size of the actual #{shared_lv.join(', ')} database.\n" \
|
42
42
|
"*** You can skip this confirmation with the '-y' flag.\n\n" \
|
43
|
-
'Do you want to proceed?', 'y(yes), q(quit)')
|
43
|
+
'Do you want to proceed?', actions_msg: 'y(yes), q(quit)')
|
44
44
|
abort! unless answer == :yes
|
45
45
|
end
|
46
46
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Procedures::Content
|
2
|
+
class MigrationStats < ForemanMaintain::Procedure
|
3
|
+
metadata do
|
4
|
+
description 'Retrieve Pulp 2 to Pulp 3 migration statistics'
|
5
|
+
for_feature :pulpcore
|
6
|
+
end
|
7
|
+
|
8
|
+
def run
|
9
|
+
puts execute!('foreman-rake katello:pulp3_migration_stats')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Procedures::Content
|
2
|
+
class PrepareAbort < ForemanMaintain::Procedure
|
3
|
+
metadata do
|
4
|
+
description 'Abort all running Pulp 2 to Pulp 3 migration tasks'
|
5
|
+
for_feature :pulpcore
|
6
|
+
end
|
7
|
+
|
8
|
+
def run
|
9
|
+
puts execute!('foreman-rake katello:pulp3_migration_abort')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -11,7 +11,7 @@ module Procedures::Packages
|
|
11
11
|
"is in a consistent state.\n" \
|
12
12
|
"As a result some of your services may be restarted. \n\n" \
|
13
13
|
'Do you want to proceed?'
|
14
|
-
answer = ask_decision(question, 'y(yes), q(quit)')
|
14
|
+
answer = ask_decision(question, actions_msg: 'y(yes), q(quit)')
|
15
15
|
abort! unless answer == :yes
|
16
16
|
end
|
17
17
|
end
|
@@ -16,7 +16,7 @@ module Procedures::Packages
|
|
16
16
|
"NOTE: --assumeyes is not applicable for this check\n\n" \
|
17
17
|
"Do you want to proceed with update of everything regardless\n" \
|
18
18
|
'of the recommendations?'
|
19
|
-
answer = ask_decision(question, 'y(yes), q(quit)', ignore_assumeyes: true)
|
19
|
+
answer = ask_decision(question, actions_msg: 'y(yes), q(quit)', ignore_assumeyes: true)
|
20
20
|
abort! unless answer == :yes
|
21
21
|
end
|
22
22
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class Procedures::Prep610Upgrade < ForemanMaintain::Procedure
|
2
|
+
metadata do
|
3
|
+
description 'Preparations for the Satellite 6.10 upgrade'
|
4
|
+
|
5
|
+
confine do
|
6
|
+
::Scenarios.const_defined?('Satellite_6_10') &&
|
7
|
+
feature(:satellite) &&
|
8
|
+
feature(:satellite).current_minor_version == '6.9'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
puts time_warning
|
14
|
+
with_spinner('Updating filesystem permissions for Pulp 3') do |spinner|
|
15
|
+
spinner.update('$ chmod -R g+rwX /var/lib/pulp/content')
|
16
|
+
FileUtils.chmod_R 'g=rwX', '/var/lib/pulp/content'
|
17
|
+
spinner.update("$ find /var/lib/pulp/content -type d -perm -g-s -exec chmod g+s {} \;")
|
18
|
+
execute!('find /var/lib/pulp/content -type d -perm -g-s -exec chmod g+s {} \;')
|
19
|
+
spinner.update('$ chown -R :pulp /var/lib/pulp/content')
|
20
|
+
FileUtils.chown_R nil, 'pulp', '/var/lib/pulp/content'
|
21
|
+
# TODO: Install Pulp 3 without starting services?
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def time_warning
|
28
|
+
"\e[33mprep-6.10-upgrade may take a while depending on the "\
|
29
|
+
"size of /var/lib/pulp/content\e[0m"
|
30
|
+
end
|
31
|
+
end
|
@@ -10,7 +10,7 @@ module Procedures::Restore
|
|
10
10
|
"Your existing installation will be replaced with the backup database.\n" \
|
11
11
|
"Once this operation is complete there is no going back.\n" \
|
12
12
|
'Do you want to proceed?'
|
13
|
-
answer = ask_decision(warning, 'y(yes), q(quit)')
|
13
|
+
answer = ask_decision(warning, actions_msg: 'y(yes), q(quit)')
|
14
14
|
abort! unless answer == :yes
|
15
15
|
end
|
16
16
|
end
|
@@ -12,7 +12,7 @@ module Procedures::Restore
|
|
12
12
|
|
13
13
|
def installer_cmd
|
14
14
|
installer = "yes | #{feature(:installer).installer_command} "
|
15
|
-
installer <<
|
15
|
+
installer << reset_option
|
16
16
|
if feature(:instance).foreman_proxy_with_content?
|
17
17
|
installer << '--foreman-proxy-register-in-foreman false '
|
18
18
|
end
|
@@ -27,5 +27,14 @@ module Procedures::Restore
|
|
27
27
|
end
|
28
28
|
installer
|
29
29
|
end
|
30
|
+
|
31
|
+
def reset_option
|
32
|
+
if check_min_version('foreman', '2.2') || \
|
33
|
+
check_min_version('foreman-proxy', '2.2')
|
34
|
+
return '-v --reset-data '
|
35
|
+
end
|
36
|
+
|
37
|
+
'-v --reset '
|
38
|
+
end
|
30
39
|
end
|
31
40
|
end
|
@@ -8,11 +8,29 @@ module ForemanMaintain::Scenarios
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def compose
|
11
|
-
|
12
|
-
|
11
|
+
if feature(:satellite) && feature(:satellite).at_least_version?('6.9')
|
12
|
+
enable_and_start_services
|
13
13
|
add_step(Procedures::Content::Prepare)
|
14
|
+
disable_and_stop_services
|
14
15
|
end
|
15
16
|
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def enable_and_start_services
|
21
|
+
add_step(Procedures::Service::Start)
|
22
|
+
add_step(Procedures::Service::Enable.
|
23
|
+
new(:only => feature(:pulpcore).pulpcore_migration_services))
|
24
|
+
add_step(Procedures::Service::Start.
|
25
|
+
new(:only => feature(:pulpcore).pulpcore_migration_services))
|
26
|
+
end
|
27
|
+
|
28
|
+
def disable_and_stop_services
|
29
|
+
add_step(Procedures::Service::Stop.
|
30
|
+
new(:only => feature(:pulpcore).pulpcore_migration_services))
|
31
|
+
add_step(Procedures::Service::Disable.
|
32
|
+
new(:only => feature(:pulpcore).pulpcore_migration_services))
|
33
|
+
end
|
16
34
|
end
|
17
35
|
|
18
36
|
class Switchover < ForemanMaintain::Scenario
|
@@ -23,9 +41,38 @@ module ForemanMaintain::Scenarios
|
|
23
41
|
end
|
24
42
|
|
25
43
|
def compose
|
26
|
-
# FIXME: remove this condition
|
44
|
+
# FIXME: remove this condition for the 6.10 upgrade scenario
|
27
45
|
if Procedures::Content::Switchover.present?
|
28
46
|
add_step(Procedures::Content::Switchover)
|
47
|
+
add_step(Procedures::Foreman::ApipieCache)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
class PrepareAbort < ForemanMaintain::Scenario
|
53
|
+
metadata do
|
54
|
+
label :content_prepare_abort
|
55
|
+
description 'Abort all running Pulp 2 to Pulp 3 migration tasks'
|
56
|
+
manual_detection
|
57
|
+
end
|
58
|
+
|
59
|
+
def compose
|
60
|
+
if feature(:satellite) && feature(:satellite).at_least_version?('6.9')
|
61
|
+
add_step(Procedures::Content::PrepareAbort)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
class MigrationStats < ForemanMaintain::Scenario
|
67
|
+
metadata do
|
68
|
+
label :content_migration_stats
|
69
|
+
description 'Retrieve Pulp 2 to Pulp 3 migration statistics'
|
70
|
+
manual_detection
|
71
|
+
end
|
72
|
+
|
73
|
+
def compose
|
74
|
+
if feature(:satellite) && feature(:satellite).at_least_version?('6.9')
|
75
|
+
add_step(Procedures::Content::MigrationStats)
|
29
76
|
end
|
30
77
|
end
|
31
78
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module ForemanMaintain::Scenarios
|
2
|
+
class Prep610Upgrade < ForemanMaintain::Scenario
|
3
|
+
metadata do
|
4
|
+
label :prep_6_10_upgrade
|
5
|
+
description 'Preparations for the Satellite 6.10 upgrade'
|
6
|
+
manual_detection
|
7
|
+
end
|
8
|
+
|
9
|
+
def compose
|
10
|
+
add_step(Procedures::Prep610Upgrade)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module Scenarios::Capsule_6_9
|
2
|
+
class Abstract < ForemanMaintain::Scenario
|
3
|
+
def self.upgrade_metadata(&block)
|
4
|
+
metadata do
|
5
|
+
tags :upgrade_scenario
|
6
|
+
confine do
|
7
|
+
feature(:capsule) &&
|
8
|
+
(feature(:capsule).current_minor_version == '6.8' || \
|
9
|
+
ForemanMaintain.upgrade_in_progress == '6.9')
|
10
|
+
end
|
11
|
+
instance_eval(&block)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def target_version
|
16
|
+
'6.9'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class PreUpgradeCheck < Abstract
|
21
|
+
upgrade_metadata do
|
22
|
+
description 'Checks before upgrading to Capsule 6.9'
|
23
|
+
tags :pre_upgrade_checks
|
24
|
+
run_strategy :fail_slow
|
25
|
+
end
|
26
|
+
|
27
|
+
def compose
|
28
|
+
add_steps(find_checks(:default))
|
29
|
+
add_steps(find_checks(:pre_upgrade))
|
30
|
+
add_step(Checks::Repositories::Validate.new(:version => '6.9'))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class PreMigrations < Abstract
|
35
|
+
upgrade_metadata do
|
36
|
+
description 'Procedures before migrating to Capsule 6.9'
|
37
|
+
tags :pre_migrations
|
38
|
+
end
|
39
|
+
|
40
|
+
def compose
|
41
|
+
add_steps(find_procedures(:pre_migrations))
|
42
|
+
add_step(Procedures::Service::Stop.new)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class Migrations < Abstract
|
47
|
+
upgrade_metadata do
|
48
|
+
description 'Migration scripts to Capsule 6.9'
|
49
|
+
tags :migrations
|
50
|
+
end
|
51
|
+
|
52
|
+
def set_context_mapping
|
53
|
+
context.map(:assumeyes, Procedures::Installer::Upgrade => :assumeyes)
|
54
|
+
end
|
55
|
+
|
56
|
+
def compose
|
57
|
+
add_step(Procedures::Repositories::Setup.new(:version => '6.9'))
|
58
|
+
add_step(Procedures::Packages::UnlockVersions.new)
|
59
|
+
add_step(Procedures::Packages::Update.new(:assumeyes => true))
|
60
|
+
add_step_with_context(Procedures::Installer::Upgrade)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class PostMigrations < Abstract
|
65
|
+
upgrade_metadata do
|
66
|
+
description 'Procedures after migrating to Capsule 6.9'
|
67
|
+
tags :post_migrations
|
68
|
+
end
|
69
|
+
|
70
|
+
def compose
|
71
|
+
add_step(Procedures::Service::Start.new)
|
72
|
+
add_steps(find_procedures(:post_migrations))
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
class PostUpgradeChecks < Abstract
|
77
|
+
upgrade_metadata do
|
78
|
+
description 'Checks after upgrading to Capsule 6.9'
|
79
|
+
tags :post_upgrade_checks
|
80
|
+
run_strategy :fail_slow
|
81
|
+
end
|
82
|
+
|
83
|
+
def compose
|
84
|
+
add_steps(find_checks(:default))
|
85
|
+
add_steps(find_checks(:post_upgrade))
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module Scenarios::Capsule_6_9_z
|
2
|
+
class Abstract < ForemanMaintain::Scenario
|
3
|
+
def self.upgrade_metadata(&block)
|
4
|
+
metadata do
|
5
|
+
tags :upgrade_scenario
|
6
|
+
confine do
|
7
|
+
feature(:capsule) &&
|
8
|
+
(feature(:capsule).current_minor_version == '6.9' || \
|
9
|
+
ForemanMaintain.upgrade_in_progress == '6.9.z')
|
10
|
+
end
|
11
|
+
instance_eval(&block)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def target_version
|
16
|
+
'6.9.z'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class PreUpgradeCheck < Abstract
|
21
|
+
upgrade_metadata do
|
22
|
+
description 'Checks before upgrading to Capsule 6.9.z'
|
23
|
+
tags :pre_upgrade_checks
|
24
|
+
run_strategy :fail_slow
|
25
|
+
end
|
26
|
+
|
27
|
+
def compose
|
28
|
+
add_steps(find_checks(:default))
|
29
|
+
add_steps(find_checks(:pre_upgrade))
|
30
|
+
add_step(Checks::Repositories::Validate.new(:version => '6.9'))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class PreMigrations < Abstract
|
35
|
+
upgrade_metadata do
|
36
|
+
description 'Procedures before migrating to Capsule 6.9.z'
|
37
|
+
tags :pre_migrations
|
38
|
+
end
|
39
|
+
|
40
|
+
def compose
|
41
|
+
add_steps(find_procedures(:pre_migrations))
|
42
|
+
add_step(Procedures::Service::Stop.new)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class Migrations < Abstract
|
47
|
+
upgrade_metadata do
|
48
|
+
description 'Migration scripts to Capsule 6.9.z'
|
49
|
+
tags :migrations
|
50
|
+
end
|
51
|
+
|
52
|
+
def set_context_mapping
|
53
|
+
context.map(:assumeyes, Procedures::Installer::Upgrade => :assumeyes)
|
54
|
+
end
|
55
|
+
|
56
|
+
def compose
|
57
|
+
add_step(Procedures::Repositories::Setup.new(:version => '6.9'))
|
58
|
+
add_step(Procedures::Packages::UnlockVersions.new)
|
59
|
+
add_step(Procedures::Packages::Update.new(:assumeyes => true))
|
60
|
+
add_step_with_context(Procedures::Installer::Upgrade)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class PostMigrations < Abstract
|
65
|
+
upgrade_metadata do
|
66
|
+
description 'Procedures after migrating to Capsule 6.9.z'
|
67
|
+
tags :post_migrations
|
68
|
+
end
|
69
|
+
|
70
|
+
def compose
|
71
|
+
add_step(Procedures::Service::Start.new)
|
72
|
+
add_steps(find_procedures(:post_migrations))
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
class PostUpgradeChecks < Abstract
|
77
|
+
upgrade_metadata do
|
78
|
+
description 'Checks after upgrading to Capsule 6.9.z'
|
79
|
+
tags :post_upgrade_checks
|
80
|
+
run_strategy :fail_slow
|
81
|
+
end
|
82
|
+
|
83
|
+
def compose
|
84
|
+
add_steps(find_checks(:default))
|
85
|
+
add_steps(find_checks(:post_upgrade))
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
module Scenarios::Satellite_6_9
|
2
|
+
class Abstract < ForemanMaintain::Scenario
|
3
|
+
def self.upgrade_metadata(&block)
|
4
|
+
metadata do
|
5
|
+
tags :upgrade_scenario
|
6
|
+
confine do
|
7
|
+
feature(:satellite) &&
|
8
|
+
(feature(:satellite).current_minor_version == '6.8' || \
|
9
|
+
ForemanMaintain.upgrade_in_progress == '6.9')
|
10
|
+
end
|
11
|
+
instance_eval(&block)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def target_version
|
16
|
+
'6.9'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class PreUpgradeCheck < Abstract
|
21
|
+
upgrade_metadata do
|
22
|
+
description 'Checks before upgrading to Satellite 6.9'
|
23
|
+
tags :pre_upgrade_checks
|
24
|
+
run_strategy :fail_slow
|
25
|
+
end
|
26
|
+
|
27
|
+
def compose
|
28
|
+
add_steps(find_checks(:default))
|
29
|
+
add_steps(find_checks(:pre_upgrade))
|
30
|
+
add_step(Checks::Foreman::CheckpointSegments)
|
31
|
+
add_step(Checks::Repositories::Validate.new(:version => '6.9'))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class PreMigrations < Abstract
|
36
|
+
upgrade_metadata do
|
37
|
+
description 'Procedures before migrating to Satellite 6.9'
|
38
|
+
tags :pre_migrations
|
39
|
+
end
|
40
|
+
|
41
|
+
def compose
|
42
|
+
add_steps(find_procedures(:pre_migrations))
|
43
|
+
add_step(Procedures::Service::Stop.new)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class Migrations < Abstract
|
48
|
+
upgrade_metadata do
|
49
|
+
description 'Migration scripts to Satellite 6.9'
|
50
|
+
tags :migrations
|
51
|
+
end
|
52
|
+
|
53
|
+
def set_context_mapping
|
54
|
+
context.map(:assumeyes, Procedures::Installer::Upgrade => :assumeyes)
|
55
|
+
end
|
56
|
+
|
57
|
+
def compose
|
58
|
+
add_step(Procedures::Repositories::Setup.new(:version => '6.9'))
|
59
|
+
add_step(Procedures::Packages::UnlockVersions.new)
|
60
|
+
add_step(Procedures::Packages::Update.new(:assumeyes => true))
|
61
|
+
add_step_with_context(Procedures::Installer::Upgrade)
|
62
|
+
add_step(Procedures::Installer::UpgradeRakeTask)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
class PostMigrations < Abstract
|
67
|
+
upgrade_metadata do
|
68
|
+
description 'Procedures after migrating to Satellite 6.9'
|
69
|
+
tags :post_migrations
|
70
|
+
end
|
71
|
+
|
72
|
+
def compose
|
73
|
+
add_step(Procedures::Service::Start.new)
|
74
|
+
add_steps(find_procedures(:post_migrations))
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
class PostUpgradeChecks < Abstract
|
79
|
+
upgrade_metadata do
|
80
|
+
description 'Checks after upgrading to Satellite 6.9'
|
81
|
+
tags :post_upgrade_checks
|
82
|
+
run_strategy :fail_slow
|
83
|
+
end
|
84
|
+
|
85
|
+
def compose
|
86
|
+
add_steps(find_checks(:default))
|
87
|
+
add_steps(find_checks(:post_upgrade))
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module Scenarios::Satellite_6_9_z
|
2
|
+
class Abstract < ForemanMaintain::Scenario
|
3
|
+
def self.upgrade_metadata(&block)
|
4
|
+
metadata do
|
5
|
+
tags :upgrade_scenario
|
6
|
+
confine do
|
7
|
+
feature(:satellite) &&
|
8
|
+
(feature(:satellite).current_minor_version == '6.9' || \
|
9
|
+
ForemanMaintain.upgrade_in_progress == '6.9.z')
|
10
|
+
end
|
11
|
+
instance_eval(&block)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def target_version
|
16
|
+
'6.9.z'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class PreUpgradeCheck < Abstract
|
21
|
+
upgrade_metadata do
|
22
|
+
description 'Checks before upgrading to Satellite 6.9.z'
|
23
|
+
tags :pre_upgrade_checks
|
24
|
+
run_strategy :fail_slow
|
25
|
+
end
|
26
|
+
|
27
|
+
def compose
|
28
|
+
add_steps(find_checks(:default))
|
29
|
+
add_steps(find_checks(:pre_upgrade))
|
30
|
+
add_step(Checks::Repositories::Validate.new(:version => '6.9'))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class PreMigrations < Abstract
|
35
|
+
upgrade_metadata do
|
36
|
+
description 'Procedures before migrating to Satellite 6.9.z'
|
37
|
+
tags :pre_migrations
|
38
|
+
end
|
39
|
+
|
40
|
+
def compose
|
41
|
+
add_steps(find_procedures(:pre_migrations))
|
42
|
+
add_step(Procedures::Service::Stop.new)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class Migrations < Abstract
|
47
|
+
upgrade_metadata do
|
48
|
+
description 'Migration scripts to Satellite 6.9.z'
|
49
|
+
tags :migrations
|
50
|
+
end
|
51
|
+
|
52
|
+
def set_context_mapping
|
53
|
+
context.map(:assumeyes, Procedures::Installer::Upgrade => :assumeyes)
|
54
|
+
end
|
55
|
+
|
56
|
+
def compose
|
57
|
+
add_step(Procedures::Repositories::Setup.new(:version => '6.9'))
|
58
|
+
add_step(Procedures::Packages::UnlockVersions.new)
|
59
|
+
add_step(Procedures::Packages::Update.new(:assumeyes => true))
|
60
|
+
add_step_with_context(Procedures::Installer::Upgrade)
|
61
|
+
add_step(Procedures::Installer::UpgradeRakeTask)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
class PostMigrations < Abstract
|
66
|
+
upgrade_metadata do
|
67
|
+
description 'Procedures after migrating to Satellite 6.9.z'
|
68
|
+
tags :post_migrations
|
69
|
+
end
|
70
|
+
|
71
|
+
def compose
|
72
|
+
add_step(Procedures::Service::Start.new)
|
73
|
+
add_steps(find_procedures(:post_migrations))
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
class PostUpgradeChecks < Abstract
|
78
|
+
upgrade_metadata do
|
79
|
+
description 'Checks after upgrading to Satellite 6.9.z'
|
80
|
+
tags :post_upgrade_checks
|
81
|
+
run_strategy :fail_slow
|
82
|
+
end
|
83
|
+
|
84
|
+
def compose
|
85
|
+
add_steps(find_checks(:default))
|
86
|
+
add_steps(find_checks(:post_upgrade))
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
data/lib/foreman_maintain.rb
CHANGED
@@ -153,7 +153,7 @@ module ForemanMaintain
|
|
153
153
|
def pkg_and_cmd_name
|
154
154
|
instance_feature = ForemanMaintain.available_features(:label => :instance).first
|
155
155
|
if instance_feature.downstream
|
156
|
-
return
|
156
|
+
return instance_feature.downstream.fm_pkg_and_cmd_name
|
157
157
|
end
|
158
158
|
|
159
159
|
[main_package_name, 'foreman-maintain']
|
data/lib/foreman_maintain/cli.rb
CHANGED
@@ -27,6 +27,15 @@ module ForemanMaintain
|
|
27
27
|
subcommand 'content', 'Content related commands', ContentCommand
|
28
28
|
subcommand 'maintenance-mode', 'Control maintenance-mode for application',
|
29
29
|
MaintenanceModeCommand
|
30
|
+
if ::Scenarios.const_defined?('Satellite_6_10') &&
|
31
|
+
ForemanMaintain.detector.feature('satellite') &&
|
32
|
+
ForemanMaintain.detector.feature('satellite').current_minor_version == '6.9'
|
33
|
+
subcommand 'prep-6.10-upgrade', 'Preparations for the Satellite 6.10 upgrade' do
|
34
|
+
def execute
|
35
|
+
run_scenarios_and_exit(Scenarios::Prep610Upgrade.new)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
30
39
|
|
31
40
|
def run(*arguments)
|
32
41
|
logger.info("Running foreman-maintain command with arguments #{arguments.inspect}")
|
@@ -7,9 +7,24 @@ module ForemanMaintain
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
|
10
|
+
unless ForemanMaintain.detector.feature(:satellite) ||
|
11
|
+
ForemanMaintain.detector.feature(:capsule)
|
12
|
+
subcommand 'switchover', 'Switch support for certain content from Pulp 2 to Pulp 3' do
|
13
|
+
def execute
|
14
|
+
run_scenarios_and_exit(Scenarios::Content::Switchover.new)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
subcommand 'prepare-abort', 'Abort all running Pulp 2 to Pulp 3 migration tasks' do
|
20
|
+
def execute
|
21
|
+
run_scenarios_and_exit(Scenarios::Content::PrepareAbort.new)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
subcommand 'migration-stats', 'Retrieve Pulp 2 to Pulp 3 migration statistics' do
|
11
26
|
def execute
|
12
|
-
run_scenarios_and_exit(Scenarios::Content::
|
27
|
+
run_scenarios_and_exit(Scenarios::Content::MigrationStats.new)
|
13
28
|
end
|
14
29
|
end
|
15
30
|
end
|
@@ -22,12 +22,13 @@ module ForemanMaintain
|
|
22
22
|
|
23
23
|
def after_scenario_finishes(_scenario); end
|
24
24
|
|
25
|
-
def on_next_steps(steps)
|
25
|
+
def on_next_steps(steps, run_strategy = :fail_fast)
|
26
26
|
return if steps.empty?
|
27
|
+
|
27
28
|
if steps.size > 1
|
28
|
-
multiple_steps_decision(steps)
|
29
|
+
multiple_steps_decision(steps, run_strategy)
|
29
30
|
else
|
30
|
-
single_step_decision(steps.first)
|
31
|
+
single_step_decision(steps.first, run_strategy)
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
@@ -46,17 +47,19 @@ module ForemanMaintain
|
|
46
47
|
end
|
47
48
|
|
48
49
|
# simple yes/no question, returns :yes, :no or :quit
|
49
|
-
|
50
|
-
|
51
|
-
|
50
|
+
# rubocop:disable Metrics/LineLength
|
51
|
+
def ask_decision(message, actions_msg: 'y(yes), n(no), q(quit)', assumeyes: assumeyes?, run_strategy: :fail_fast)
|
52
|
+
actions_msg = 'y(yes), n(no)' if run_strategy == :fail_slow
|
52
53
|
if assumeyes
|
53
54
|
print("#{message} (assuming yes)")
|
54
55
|
return :yes
|
55
56
|
end
|
57
|
+
|
56
58
|
until_valid_decision do
|
57
|
-
filter_decision(ask("#{message}, [
|
59
|
+
filter_decision(ask("#{message}, [#{actions_msg}]"))
|
58
60
|
end
|
59
61
|
end
|
62
|
+
# rubocop:enable Metrics/LineLength
|
60
63
|
|
61
64
|
def assumeyes=(assume)
|
62
65
|
@assumeyes = !!assume
|
@@ -64,8 +67,8 @@ module ForemanMaintain
|
|
64
67
|
|
65
68
|
private
|
66
69
|
|
67
|
-
def single_step_decision(step)
|
68
|
-
answer = ask_decision("Continue with step [#{step.description}]?")
|
70
|
+
def single_step_decision(step, run_strategy)
|
71
|
+
answer = ask_decision("Continue with step [#{step.description}]?", run_strategy: run_strategy)
|
69
72
|
if answer == :yes
|
70
73
|
step
|
71
74
|
else
|
@@ -73,12 +76,12 @@ module ForemanMaintain
|
|
73
76
|
end
|
74
77
|
end
|
75
78
|
|
76
|
-
def multiple_steps_decision(steps)
|
79
|
+
def multiple_steps_decision(steps, run_strategy)
|
77
80
|
puts 'There are multiple steps to proceed:'
|
78
81
|
steps.each_with_index do |step, index|
|
79
82
|
puts "#{index + 1}) #{step.description}"
|
80
83
|
end
|
81
|
-
ask_to_select('Select step to continue', steps,
|
84
|
+
ask_to_select('Select step to continue', steps, run_strategy)
|
82
85
|
end
|
83
86
|
|
84
87
|
def filter_decision(answer)
|
@@ -90,13 +93,15 @@ module ForemanMaintain
|
|
90
93
|
end
|
91
94
|
|
92
95
|
# rubocop:disable Metrics/MethodLength
|
93
|
-
def ask_to_select(message, steps)
|
96
|
+
def ask_to_select(message, steps, run_strategy)
|
94
97
|
if assumeyes?
|
95
98
|
puts('(assuming first option)')
|
96
99
|
return steps.first
|
97
100
|
end
|
98
101
|
until_valid_decision do
|
99
|
-
|
102
|
+
actions = run_strategy == :fail_slow ? 'n(next)' : 'n(next), q(quit)'
|
103
|
+
|
104
|
+
answer = ask("#{message}, [#{actions}]")
|
100
105
|
if answer =~ /^\d+$/ && (answer.to_i - 1) < steps.size
|
101
106
|
steps[answer.to_i - 1]
|
102
107
|
else
|
@@ -167,8 +167,9 @@ module ForemanMaintain
|
|
167
167
|
@assumeyes
|
168
168
|
end
|
169
169
|
|
170
|
-
def single_step_decision(step)
|
171
|
-
answer = ask_decision("Continue with step [#{step.runtime_message}]?"
|
170
|
+
def single_step_decision(step, run_strategy)
|
171
|
+
answer = ask_decision("Continue with step [#{step.runtime_message}]?",
|
172
|
+
run_strategy: run_strategy)
|
172
173
|
if answer == :yes
|
173
174
|
step
|
174
175
|
else
|
@@ -176,25 +177,28 @@ module ForemanMaintain
|
|
176
177
|
end
|
177
178
|
end
|
178
179
|
|
179
|
-
def multiple_steps_decision(steps)
|
180
|
+
def multiple_steps_decision(steps, run_strategy)
|
180
181
|
puts 'There are multiple steps to proceed:'
|
181
182
|
steps.each_with_index do |step, index|
|
182
183
|
puts "#{index + 1}) #{step.runtime_message}"
|
183
184
|
end
|
184
|
-
ask_to_select('Select step to continue', steps,
|
185
|
+
ask_to_select('Select step to continue', steps, run_strategy)
|
185
186
|
end
|
186
187
|
|
187
|
-
|
188
|
+
# rubocop:disable Metrics/LineLength
|
189
|
+
def ask_decision(message, actions_msg: 'y(yes), n(no), q(quit)', ignore_assumeyes: false, run_strategy: :fail_fast)
|
190
|
+
actions_msg = 'y(yes), n(no)' if run_strategy == :fail_slow
|
188
191
|
if !ignore_assumeyes && assumeyes?
|
189
192
|
print("#{message} (assuming yes)\n")
|
190
193
|
return :yes
|
191
194
|
end
|
192
195
|
until_valid_decision do
|
193
|
-
filter_decision(ask("#{message}, [#{
|
196
|
+
filter_decision(ask("#{message}, [#{actions_msg}]"))
|
194
197
|
end
|
195
198
|
ensure
|
196
199
|
clear_line
|
197
200
|
end
|
201
|
+
# rubocop:enable Metrics/LineLength
|
198
202
|
|
199
203
|
def filter_decision(answer)
|
200
204
|
decision = nil
|
@@ -206,13 +210,15 @@ module ForemanMaintain
|
|
206
210
|
end
|
207
211
|
|
208
212
|
# rubocop:disable Metrics/MethodLength
|
209
|
-
def ask_to_select(message, steps)
|
213
|
+
def ask_to_select(message, steps, run_strategy)
|
210
214
|
if assumeyes?
|
211
215
|
puts('(assuming first option)')
|
212
216
|
return steps.first
|
213
217
|
end
|
218
|
+
|
214
219
|
until_valid_decision do
|
215
|
-
|
220
|
+
actions = run_strategy == :fail_slow ? 'n(next)' : 'n(next), q(quit)'
|
221
|
+
answer = ask("#{message}, [#{actions}]")
|
216
222
|
if answer =~ /^\d+$/ && (answer.to_i - 1) < steps.size
|
217
223
|
steps[answer.to_i - 1]
|
218
224
|
else
|
@@ -277,6 +283,7 @@ module ForemanMaintain
|
|
277
283
|
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
278
284
|
def scenario_failure_message(scenario)
|
279
285
|
return if scenario.passed? && !scenario.warning?
|
286
|
+
|
280
287
|
message = []
|
281
288
|
message << <<-MESSAGE.strip_heredoc
|
282
289
|
Scenario [#{scenario.description}] failed.
|
@@ -293,13 +300,15 @@ module ForemanMaintain
|
|
293
300
|
end
|
294
301
|
|
295
302
|
steps_with_error = scenario.steps_with_error(:whitelisted => false)
|
303
|
+
steps_with_skipped = scenario.steps_with_skipped(:whitelisted => true)
|
304
|
+
steps_to_whitelist = steps_with_error + steps_with_skipped
|
296
305
|
unless steps_with_error.empty?
|
297
306
|
message << format(<<-MESSAGE.strip_heredoc, format_steps(steps_with_error, "\n", 2))
|
298
307
|
The following steps ended up in failing state:
|
299
308
|
|
300
309
|
%s
|
301
310
|
MESSAGE
|
302
|
-
whitelist_labels =
|
311
|
+
whitelist_labels = steps_to_whitelist.map(&:label_dashed).join(',')
|
303
312
|
recommend << format(<<-MESSAGE.strip_heredoc, whitelist_labels)
|
304
313
|
Resolve the failed steps and rerun
|
305
314
|
the command. In case the failures are false positives,
|
@@ -70,7 +70,8 @@ module ForemanMaintain
|
|
70
70
|
:quit
|
71
71
|
elsif @last_scenario.steps_with_warning(:whitelisted => false).any?
|
72
72
|
@last_scenario_continuation_confirmed = true
|
73
|
-
reporter.ask_decision("Continue with [#{scenario.description}]"
|
73
|
+
reporter.ask_decision("Continue with [#{scenario.description}]",
|
74
|
+
run_strategy: scenario.run_strategy)
|
74
75
|
end
|
75
76
|
|
76
77
|
ask_to_quit if [:quit, :no].include?(decision)
|
@@ -131,7 +132,7 @@ module ForemanMaintain
|
|
131
132
|
if execution.aborted?
|
132
133
|
ask_to_quit
|
133
134
|
else
|
134
|
-
next_steps_decision = ask_about_offered_steps(step)
|
135
|
+
next_steps_decision = ask_about_offered_steps(step, scenario)
|
135
136
|
if next_steps_decision != :yes &&
|
136
137
|
execution.fail? && !execution.whitelisted? &&
|
137
138
|
scenario.run_strategy == :fail_fast
|
@@ -141,7 +142,7 @@ module ForemanMaintain
|
|
141
142
|
end
|
142
143
|
|
143
144
|
# rubocop:disable Metrics/MethodLength
|
144
|
-
def ask_about_offered_steps(step)
|
145
|
+
def ask_about_offered_steps(step, scenario)
|
145
146
|
if assumeyes? && rerun_check?(step)
|
146
147
|
@reporter.puts 'Check still failing after attempt to fix. Skipping'
|
147
148
|
return :no
|
@@ -149,7 +150,8 @@ module ForemanMaintain
|
|
149
150
|
if step.next_steps && !step.next_steps.empty?
|
150
151
|
@last_decision_step = step
|
151
152
|
steps = step.next_steps.map(&:ensure_instance)
|
152
|
-
|
153
|
+
|
154
|
+
decision = @reporter.on_next_steps(steps, scenario.run_strategy)
|
153
155
|
case decision
|
154
156
|
when :quit
|
155
157
|
ask_to_quit
|
@@ -116,6 +116,10 @@ module ForemanMaintain
|
|
116
116
|
filter_whitelisted(executed_steps.find_all(&:warning?), options)
|
117
117
|
end
|
118
118
|
|
119
|
+
def steps_with_skipped(options = {})
|
120
|
+
filter_whitelisted(executed_steps.find_all(&:skipped?), options)
|
121
|
+
end
|
122
|
+
|
119
123
|
def filter_whitelisted(steps, options)
|
120
124
|
options.validate_options!(:whitelisted)
|
121
125
|
if options.key?(:whitelisted)
|
@@ -50,19 +50,29 @@ module ForemanMaintain::Utils
|
|
50
50
|
|
51
51
|
def exist?
|
52
52
|
if @sys.systemd_installed?
|
53
|
-
systemd =
|
53
|
+
systemd = service_enabled_status
|
54
54
|
systemd == 'enabled' || systemd == 'disabled'
|
55
55
|
else
|
56
56
|
File.exist?("/etc/init.d/#{@name}")
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
+
def enabled?
|
61
|
+
if @sys.systemd_installed?
|
62
|
+
service_enabled_status == 'enabled'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
60
66
|
private
|
61
67
|
|
62
68
|
def execute(action, options = {})
|
63
69
|
@sys.execute_with_status(command(action, options))
|
64
70
|
end
|
65
71
|
|
72
|
+
def service_enabled_status
|
73
|
+
@sys.execute("systemctl is-enabled #{@name} 2>&1 | tail -1").strip
|
74
|
+
end
|
75
|
+
|
66
76
|
def skip_enablement_message(action, name)
|
67
77
|
# Enable and disable does not work well with globs since they treat them literally.
|
68
78
|
# We are skipping the pulpcore-workers@* for these actions until they are configured in
|
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: 0.
|
4
|
+
version: 0.7.0
|
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: 2020-
|
11
|
+
date: 2020-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- definitions/checks/mongo/db_up.rb
|
148
148
|
- definitions/checks/mongo/tools_installed.rb
|
149
149
|
- definitions/checks/original_assets.rb
|
150
|
+
- definitions/checks/package_manager/yum/validate_yum_config.rb
|
150
151
|
- definitions/checks/pulpcore/db_up.rb
|
151
152
|
- definitions/checks/puppet/provide_upgrade_guide.rb
|
152
153
|
- definitions/checks/puppet/verify_no_empty_cacert_requests.rb
|
@@ -161,7 +162,6 @@ files:
|
|
161
162
|
- definitions/checks/services_up.rb
|
162
163
|
- definitions/checks/system_registration.rb
|
163
164
|
- definitions/checks/version_locking_enabled.rb
|
164
|
-
- definitions/checks/yum_exclude.rb
|
165
165
|
- definitions/features/apache.rb
|
166
166
|
- definitions/features/candlepin.rb
|
167
167
|
- definitions/features/candlepin_database.rb
|
@@ -220,7 +220,9 @@ files:
|
|
220
220
|
- definitions/procedures/backup/snapshot/mount_pulpcore_db.rb
|
221
221
|
- definitions/procedures/backup/snapshot/prepare_mount.rb
|
222
222
|
- definitions/procedures/candlepin/delete_orphaned_records_from_env_content.rb
|
223
|
+
- definitions/procedures/content/migration_stats.rb
|
223
224
|
- definitions/procedures/content/prepare.rb
|
225
|
+
- definitions/procedures/content/prepare_abort.rb
|
224
226
|
- definitions/procedures/content/switchover.rb
|
225
227
|
- definitions/procedures/crond/start.rb
|
226
228
|
- definitions/procedures/crond/stop.rb
|
@@ -253,6 +255,7 @@ files:
|
|
253
255
|
- definitions/procedures/packages/update.rb
|
254
256
|
- definitions/procedures/packages/update_all_confirmation.rb
|
255
257
|
- definitions/procedures/passenger_recycler.rb
|
258
|
+
- definitions/procedures/prep_6_10_upgrade.rb
|
256
259
|
- definitions/procedures/pulp/migrate.rb
|
257
260
|
- definitions/procedures/pulpcore/migrate.rb
|
258
261
|
- definitions/procedures/puppet/delete_empty_ca_cert_request_files.rb
|
@@ -288,10 +291,13 @@ files:
|
|
288
291
|
- definitions/scenarios/content.rb
|
289
292
|
- definitions/scenarios/maintenance_mode.rb
|
290
293
|
- definitions/scenarios/packages.rb
|
294
|
+
- definitions/scenarios/prep_6_10_upgrade.rb
|
291
295
|
- definitions/scenarios/restore.rb
|
292
296
|
- definitions/scenarios/services.rb
|
293
297
|
- definitions/scenarios/upgrade_to_capsule_6_8.rb
|
294
298
|
- definitions/scenarios/upgrade_to_capsule_6_8_z.rb
|
299
|
+
- definitions/scenarios/upgrade_to_capsule_6_9.rb
|
300
|
+
- definitions/scenarios/upgrade_to_capsule_6_9_z.rb
|
295
301
|
- definitions/scenarios/upgrade_to_satellite_6_2.rb
|
296
302
|
- definitions/scenarios/upgrade_to_satellite_6_2_z.rb
|
297
303
|
- definitions/scenarios/upgrade_to_satellite_6_3.rb
|
@@ -306,6 +312,8 @@ files:
|
|
306
312
|
- definitions/scenarios/upgrade_to_satellite_6_7_z.rb
|
307
313
|
- definitions/scenarios/upgrade_to_satellite_6_8.rb
|
308
314
|
- definitions/scenarios/upgrade_to_satellite_6_8_z.rb
|
315
|
+
- definitions/scenarios/upgrade_to_satellite_6_9.rb
|
316
|
+
- definitions/scenarios/upgrade_to_satellite_6_9_z.rb
|
309
317
|
- extras/foreman-maintain.sh
|
310
318
|
- extras/foreman_protector/foreman-protector.conf
|
311
319
|
- extras/foreman_protector/foreman-protector.py
|
@@ -405,7 +413,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
405
413
|
- !ruby/object:Gem::Version
|
406
414
|
version: '0'
|
407
415
|
requirements: []
|
408
|
-
rubygems_version: 3.0.
|
416
|
+
rubygems_version: 3.0.3
|
409
417
|
signing_key:
|
410
418
|
specification_version: 4
|
411
419
|
summary: Foreman maintenance tool belt
|
@@ -1,21 +0,0 @@
|
|
1
|
-
class Checks::YumExclude < ForemanMaintain::Check
|
2
|
-
metadata do
|
3
|
-
label :check_yum_exclude_list
|
4
|
-
description 'Check if yum exclude list is configured'
|
5
|
-
tags :pre_upgrade
|
6
|
-
end
|
7
|
-
|
8
|
-
EXCLUDE_SET_RE = /^exclude\s*=\s*\S+.*$/
|
9
|
-
|
10
|
-
def run
|
11
|
-
grep_result = grep_yum_exclude
|
12
|
-
assert(!grep_result.match(EXCLUDE_SET_RE),
|
13
|
-
'The /etc/yum.conf has exclude list configured as below,'\
|
14
|
-
"\n #{grep_result}"\
|
15
|
-
"\nUnset this as it can cause yum update or upgrade failures !")
|
16
|
-
end
|
17
|
-
|
18
|
-
def grep_yum_exclude
|
19
|
-
execute_with_status('grep -w exclude /etc/yum.conf')[1]
|
20
|
-
end
|
21
|
-
end
|