foreman_maintain 0.7.6 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/definitions/checks/non_rh_packages.rb +29 -0
- data/definitions/features/dynflow_sidekiq.rb +1 -1
- data/definitions/features/katello.rb +8 -3
- data/definitions/features/mongo.rb +3 -3
- data/definitions/features/pulp2.rb +7 -1
- data/definitions/features/service.rb +32 -31
- data/definitions/procedures/backup/pulp.rb +1 -1
- data/definitions/procedures/content/switchover.rb +3 -0
- data/definitions/procedures/prep_6_10_upgrade.rb +4 -4
- data/definitions/procedures/restore/regenerate_queues.rb +2 -2
- data/definitions/procedures/service/base.rb +1 -1
- data/definitions/scenarios/content.rb +23 -23
- data/definitions/scenarios/upgrade_to_capsule_6_10.rb +88 -0
- data/definitions/scenarios/upgrade_to_capsule_6_10_z.rb +88 -0
- data/definitions/scenarios/upgrade_to_satellite_6_10.rb +90 -0
- data/definitions/scenarios/upgrade_to_satellite_6_10_z.rb +89 -0
- data/lib/foreman_maintain/package_manager/yum.rb +8 -0
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4894231356aabd2a87f57c49952e1860f762908b98770e96d1b60118808927a1
|
4
|
+
data.tar.gz: 92dc7d469e6ac81bf6e7278225077c189d302157ee0d7c9e930ed53a2a5ad029
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3b440096f343c3ce67b2ee8a94a265eb53141d4c57f6bd9fb49562ba9f3bb8ba8a8886875917c88df7324e1993902b51a125ba02760ab9cfa1820e1d1d9b323
|
7
|
+
data.tar.gz: 17eb800a81f97ff503aa8fbe87c55918dcb99946928079eeab9288c93972a7f287e5acc4d699e8c5294c196bdabb2da978b363d79015ed6b796688c7c063a7a9
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class Checks::NonRhPackages < ForemanMaintain::Check
|
2
|
+
metadata do
|
3
|
+
label :non_rh_packages
|
4
|
+
description 'Check if system has any non Red Hat RPMs installed (e.g.: Fedora)'
|
5
|
+
tags :pre_upgrade
|
6
|
+
confine do
|
7
|
+
feature(:instance).downstream
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
rpm_query_format = '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH} : %{VENDOR}\n'
|
13
|
+
all_packages = package_manager.list_installed_packages(rpm_query_format)
|
14
|
+
non_rh_packages = all_packages - all_packages.grep(Regexp.union(rh_regexp_list))
|
15
|
+
assert(non_rh_packages.empty?, error_msg(non_rh_packages), :warn => true)
|
16
|
+
end
|
17
|
+
|
18
|
+
def error_msg(packages)
|
19
|
+
"Found #{packages.count} unexpected non Red Hat Package(s) installed!\
|
20
|
+
\nPackage : Vendor\n#{packages.join("\n")}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def rh_regexp_list
|
24
|
+
[/Red Hat, Inc\./, /Red Hat Inc./, /-apache/, /-foreman-proxy/, /-foreman-client/,
|
25
|
+
/-puppet-client/, /-qpid-broker/, /-qpid-client-cert/, /-qpid-router-client/,
|
26
|
+
/-qpid-router-server/, /java-client/, /pulp-client/, /katello-default-ca/, /katello-server-ca/,
|
27
|
+
/katello-ca-consumer/, /gpg-pubkey/, /-tomcat/]
|
28
|
+
end
|
29
|
+
end
|
@@ -37,6 +37,6 @@ class Features::DynflowSidekiq < ForemanMaintain::Feature
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def configured_instances
|
40
|
-
Dir['/etc/foreman/dynflow
|
40
|
+
Dir['/etc/foreman/dynflow/*.yml'].map { |config| File.basename(config, '.yml') }
|
41
41
|
end
|
42
42
|
end
|
@@ -16,9 +16,14 @@ class Features::Katello < ForemanMaintain::Feature
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def services
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
if feature(:pulp2)
|
20
|
+
[]
|
21
|
+
else
|
22
|
+
[
|
23
|
+
system_service('qpidd', 10),
|
24
|
+
system_service('qdrouterd', 10)
|
25
|
+
]
|
26
|
+
end
|
22
27
|
end
|
23
28
|
|
24
29
|
# rubocop:disable Metrics/MethodLength
|
@@ -141,13 +141,13 @@ class Features::Mongo < ForemanMaintain::Feature
|
|
141
141
|
end
|
142
142
|
|
143
143
|
def mongo_cmd_available?
|
144
|
-
exit_status, _output = execute_with_status(
|
144
|
+
exit_status, _output = execute_with_status('which mongo')
|
145
145
|
exit_status == 0
|
146
146
|
end
|
147
147
|
|
148
148
|
def raise_mongo_client_missing_error
|
149
|
-
raise ForemanMaintain::Error::Fail,
|
150
|
-
|
149
|
+
raise ForemanMaintain::Error::Fail, 'The mongo command not found.'\
|
150
|
+
' Make sure system has mongo utility installed.'
|
151
151
|
end
|
152
152
|
|
153
153
|
private
|
@@ -5,7 +5,7 @@ class Features::Pulp < ForemanMaintain::Feature
|
|
5
5
|
label :pulp2
|
6
6
|
|
7
7
|
confine do
|
8
|
-
find_package('pulp-server')
|
8
|
+
find_package('pulp-server') && !check_min_version('katello-common', '4.0')
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -34,4 +34,10 @@ class Features::Pulp < ForemanMaintain::Feature
|
|
34
34
|
'/etc/default/pulp_workers'
|
35
35
|
]
|
36
36
|
end
|
37
|
+
|
38
|
+
def exclude_from_backup
|
39
|
+
# Exclude /var/lib/pulp/katello-export and /var/lib/pulp/cache
|
40
|
+
# since the tar is run from /var/lib/pulp, list subdir paths only
|
41
|
+
['katello-export', 'cache']
|
42
|
+
end
|
37
43
|
end
|
@@ -25,9 +25,10 @@ class Features::Service < ForemanMaintain::Feature
|
|
25
25
|
select(&:exist?)
|
26
26
|
end
|
27
27
|
|
28
|
-
def filtered_services(options)
|
28
|
+
def filtered_services(options, action = '')
|
29
29
|
services = include_unregistered_services(existing_services, options[:include])
|
30
|
-
services = filter_services(services, options)
|
30
|
+
services = filter_services(services, options, action)
|
31
|
+
|
31
32
|
raise 'No services found matching your parameters' unless services.any?
|
32
33
|
return services unless options[:reverse]
|
33
34
|
|
@@ -61,59 +62,49 @@ class Features::Service < ForemanMaintain::Feature
|
|
61
62
|
def run_action_on_services(action, options, spinner)
|
62
63
|
status = 0
|
63
64
|
failed_services = []
|
64
|
-
filtered_services(options).each_value do |group|
|
65
|
-
|
66
|
-
"#{action} #{
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
65
|
+
filtered_services(options, action).each_value do |group|
|
66
|
+
fork_threads_for_services(action, group, spinner).each do |service, status_and_output|
|
67
|
+
spinner.update("#{action_noun(action)} #{service}") if action == 'status'
|
68
|
+
item_status, output = status_and_output
|
69
|
+
formatted = format_status(output, item_status, options)
|
70
|
+
puts formatted unless formatted.empty?
|
71
|
+
|
72
|
+
if item_status > 0
|
73
|
+
status = item_status
|
74
|
+
failed_services << service
|
75
|
+
end
|
71
76
|
end
|
72
77
|
end
|
73
78
|
[status, failed_services]
|
74
79
|
end
|
75
80
|
|
76
|
-
def
|
81
|
+
def fork_threads_for_services(action, services, spinner)
|
82
|
+
services_and_statuses = []
|
77
83
|
services.each do |service|
|
78
|
-
spinner.update("#{action_noun(action)} #{service}")
|
79
|
-
|
80
|
-
puts formatted unless formatted.empty?
|
84
|
+
spinner.update("#{action_noun(action)} #{service}") if action != 'status'
|
85
|
+
services_and_statuses << [service, Thread.new { service.send(action.to_sym) }]
|
81
86
|
end
|
87
|
+
services_and_statuses.map! { |service, status| [service, status.value] }
|
82
88
|
end
|
83
89
|
|
84
|
-
def format_status(
|
85
|
-
exit_code, output = service_status
|
90
|
+
def format_status(output, exit_code, options)
|
86
91
|
status = ''
|
87
92
|
if !options[:failing] || exit_code > 0
|
88
93
|
if options[:brief]
|
89
94
|
status += format_brief_status(exit_code)
|
90
|
-
elsif
|
95
|
+
elsif !(output.nil? || output.empty?)
|
91
96
|
status += "\n" + output
|
92
97
|
end
|
93
98
|
end
|
94
99
|
status
|
95
100
|
end
|
96
101
|
|
97
|
-
def include_output?(action, status)
|
98
|
-
(action == 'start' && status > 0) ||
|
99
|
-
action == 'status'
|
100
|
-
end
|
101
|
-
|
102
102
|
def format_brief_status(exit_code)
|
103
103
|
result = exit_code == 0 ? reporter.status_label(:success) : reporter.status_label(:fail)
|
104
104
|
padding = reporter.max_length - reporter.last_line.to_s.length - 30
|
105
105
|
"#{' ' * padding} #{result}"
|
106
106
|
end
|
107
107
|
|
108
|
-
def failed_services_by_status(action, services, spinner)
|
109
|
-
failed_services = []
|
110
|
-
services.each do |service|
|
111
|
-
spinner.update("#{action_noun(action)} #{service}")
|
112
|
-
failed_services << service unless service.running?
|
113
|
-
end
|
114
|
-
failed_services
|
115
|
-
end
|
116
|
-
|
117
108
|
def allowed_action?(action)
|
118
109
|
%w[start stop restart status enable disable].include?(action)
|
119
110
|
end
|
@@ -125,7 +116,8 @@ class Features::Service < ForemanMaintain::Feature
|
|
125
116
|
service_list + socket_list
|
126
117
|
end
|
127
118
|
|
128
|
-
|
119
|
+
# rubocop:disable Metrics/AbcSize
|
120
|
+
def filter_services(service_list, options, action)
|
129
121
|
if options[:only] && options[:only].any?
|
130
122
|
service_list = service_list.select do |service|
|
131
123
|
options[:only].any? { |opt| service.matches?(opt) }
|
@@ -138,8 +130,17 @@ class Features::Service < ForemanMaintain::Feature
|
|
138
130
|
end
|
139
131
|
|
140
132
|
service_list = extend_service_list_with_sockets(service_list, options)
|
133
|
+
service_list = filter_disabled_services!(action, service_list)
|
141
134
|
service_list.group_by(&:priority).to_h
|
142
135
|
end
|
136
|
+
# rubocop:enable Metrics/AbcSize
|
137
|
+
|
138
|
+
def filter_disabled_services!(action, service_list)
|
139
|
+
if %w[start stop restart status].include?(action)
|
140
|
+
service_list.select!(&:enabled?)
|
141
|
+
end
|
142
|
+
service_list
|
143
|
+
end
|
143
144
|
|
144
145
|
def include_unregistered_services(service_list, services_filter)
|
145
146
|
return service_list unless services_filter
|
@@ -30,7 +30,7 @@ module Procedures::Backup
|
|
30
30
|
feature(:tar).run(
|
31
31
|
:archive => File.join(@backup_dir, 'pulp_data.tar'),
|
32
32
|
:command => 'create',
|
33
|
-
:exclude =>
|
33
|
+
:exclude => feature(:pulp2).exclude_from_backup,
|
34
34
|
:listed_incremental => File.join(@backup_dir, '.pulp.snar'),
|
35
35
|
:transform => 's,^,var/lib/pulp/,S',
|
36
36
|
:volume_size => @tar_volume_size,
|
@@ -19,8 +19,11 @@ module Procedures::Content
|
|
19
19
|
puts execute!('foreman-rake katello:pulp3_content_switchover')
|
20
20
|
puts 'Re-running the installer to switch specified content over to pulp3'
|
21
21
|
args = ['--foreman-proxy-content-proxy-pulp-isos-to-pulpcore=true',
|
22
|
+
'--foreman-proxy-content-proxy-pulp-yum-to-pulpcore=true',
|
23
|
+
'--foreman-proxy-content-proxy-pulp-deb-to-pulpcore=true',
|
22
24
|
'--katello-use-pulp-2-for-file=false',
|
23
25
|
'--katello-use-pulp-2-for-docker=false',
|
26
|
+
'--katello-use-pulp-2-for-deb=false',
|
24
27
|
'--katello-use-pulp-2-for-yum=false']
|
25
28
|
feature(:installer).run(args.join(' '))
|
26
29
|
end
|
@@ -11,11 +11,11 @@ class Procedures::Prep610Upgrade < ForemanMaintain::Procedure
|
|
11
11
|
def run
|
12
12
|
puts time_warning
|
13
13
|
with_spinner('Updating filesystem permissions for Pulp 3') do |spinner|
|
14
|
-
spinner.update('
|
14
|
+
spinner.update('# chmod -R g=rwX /var/lib/pulp/content')
|
15
15
|
FileUtils.chmod_R 'g=rwX', '/var/lib/pulp/content'
|
16
|
-
spinner.update("
|
17
|
-
execute!('find /var/lib/pulp/content -type d -perm -g
|
18
|
-
spinner.update('
|
16
|
+
spinner.update("# find /var/lib/pulp/content -type d \! -perm -g+s -exec chmod g+s {} +")
|
17
|
+
execute!('find /var/lib/pulp/content -type d \! -perm -g+s -exec chmod g+s {} +')
|
18
|
+
spinner.update('# chgrp -R pulp /var/lib/pulp/content')
|
19
19
|
FileUtils.chown_R nil, 'pulp', '/var/lib/pulp/content'
|
20
20
|
end
|
21
21
|
end
|
@@ -2,7 +2,7 @@ module Procedures::Restore
|
|
2
2
|
class RegenerateQueues < ForemanMaintain::Procedure
|
3
3
|
metadata do
|
4
4
|
advanced_run false
|
5
|
-
description 'Regenerate required activemq and qpidd queues while restoring online backup'
|
5
|
+
description 'Regenerate required activemq and/or qpidd queues while restoring online backup'
|
6
6
|
confine do
|
7
7
|
feature(:pulp2)
|
8
8
|
end
|
@@ -31,7 +31,7 @@ module Procedures::Restore
|
|
31
31
|
|
32
32
|
def run
|
33
33
|
with_spinner('Resetting the queues') do |spinner|
|
34
|
-
regenerate_activemq_queues(spinner)
|
34
|
+
regenerate_activemq_queues(spinner) if feature(:candlepin)
|
35
35
|
regenerate_qpidd_queues(spinner)
|
36
36
|
spinner.update('Queues created successfully')
|
37
37
|
end
|
@@ -16,7 +16,7 @@ module Procedures
|
|
16
16
|
def run_service_action(action, options)
|
17
17
|
action_noun = feature(:service).action_noun(action).capitalize
|
18
18
|
puts "\n#{action_noun} the following service(s):"
|
19
|
-
services = feature(:service).filtered_services(options)
|
19
|
+
services = feature(:service).filtered_services(options, action)
|
20
20
|
print_services(services)
|
21
21
|
with_spinner('') do |spinner|
|
22
22
|
feature(:service).handle_services(spinner, action, options)
|
@@ -1,6 +1,23 @@
|
|
1
1
|
module ForemanMaintain::Scenarios
|
2
2
|
module Content
|
3
|
-
class
|
3
|
+
class ContentBase < ForemanMaintain::Scenario
|
4
|
+
def enable_and_start_services
|
5
|
+
add_step(Procedures::Service::Start)
|
6
|
+
add_step(Procedures::Service::Enable.
|
7
|
+
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
8
|
+
add_step(Procedures::Service::Start.
|
9
|
+
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
10
|
+
end
|
11
|
+
|
12
|
+
def disable_and_stop_services
|
13
|
+
add_step(Procedures::Service::Stop.
|
14
|
+
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
15
|
+
add_step(Procedures::Service::Disable.
|
16
|
+
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class Prepare < ContentBase
|
4
21
|
metadata do
|
5
22
|
label :content_prepare
|
6
23
|
description 'Prepare content for Pulp 3'
|
@@ -16,26 +33,9 @@ module ForemanMaintain::Scenarios
|
|
16
33
|
add_step(Procedures::Content::Prepare)
|
17
34
|
end
|
18
35
|
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def enable_and_start_services
|
23
|
-
add_step(Procedures::Service::Start)
|
24
|
-
add_step(Procedures::Service::Enable.
|
25
|
-
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
26
|
-
add_step(Procedures::Service::Start.
|
27
|
-
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
28
|
-
end
|
29
|
-
|
30
|
-
def disable_and_stop_services
|
31
|
-
add_step(Procedures::Service::Stop.
|
32
|
-
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
33
|
-
add_step(Procedures::Service::Disable.
|
34
|
-
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
35
|
-
end
|
36
36
|
end
|
37
37
|
|
38
|
-
class Switchover <
|
38
|
+
class Switchover < ContentBase
|
39
39
|
metadata do
|
40
40
|
label :content_switchover
|
41
41
|
description 'Switch support for certain content from Pulp 2 to Pulp 3'
|
@@ -51,7 +51,7 @@ module ForemanMaintain::Scenarios
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
class PrepareAbort <
|
54
|
+
class PrepareAbort < ContentBase
|
55
55
|
metadata do
|
56
56
|
label :content_prepare_abort
|
57
57
|
description 'Abort all running Pulp 2 to Pulp 3 migration tasks'
|
@@ -65,7 +65,7 @@ module ForemanMaintain::Scenarios
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
class MigrationStats <
|
68
|
+
class MigrationStats < ContentBase
|
69
69
|
metadata do
|
70
70
|
label :content_migration_stats
|
71
71
|
description 'Retrieve Pulp 2 to Pulp 3 migration statistics'
|
@@ -79,7 +79,7 @@ module ForemanMaintain::Scenarios
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
class MigrationReset <
|
82
|
+
class MigrationReset < ContentBase
|
83
83
|
metadata do
|
84
84
|
label :content_migration_reset
|
85
85
|
description 'Reset the Pulp 2 to Pulp 3 migration data (pre-switchover)'
|
@@ -97,7 +97,7 @@ module ForemanMaintain::Scenarios
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
class RemovePulp2 <
|
100
|
+
class RemovePulp2 < ContentBase
|
101
101
|
metadata do
|
102
102
|
label :content_remove_pulp2
|
103
103
|
description 'Remove Pulp2 and mongodb packages and data'
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module Scenarios::Capsule_6_10
|
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.10')
|
10
|
+
end
|
11
|
+
instance_eval(&block)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def target_version
|
16
|
+
'6.10'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class PreUpgradeCheck < Abstract
|
21
|
+
upgrade_metadata do
|
22
|
+
description 'Checks before upgrading to Capsule 6.10'
|
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.10'))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class PreMigrations < Abstract
|
35
|
+
upgrade_metadata do
|
36
|
+
description 'Procedures before migrating to Capsule 6.10'
|
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.10'
|
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.10'))
|
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.10'
|
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.10'
|
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_10_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.10' || \
|
9
|
+
ForemanMaintain.upgrade_in_progress == '6.10.z')
|
10
|
+
end
|
11
|
+
instance_eval(&block)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def target_version
|
16
|
+
'6.10.z'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class PreUpgradeCheck < Abstract
|
21
|
+
upgrade_metadata do
|
22
|
+
description 'Checks before upgrading to Capsule 6.10.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.10'))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class PreMigrations < Abstract
|
35
|
+
upgrade_metadata do
|
36
|
+
description 'Procedures before migrating to Capsule 6.10.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.10.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.10'))
|
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.10.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.10.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_10
|
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.10')
|
10
|
+
end
|
11
|
+
instance_eval(&block)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def target_version
|
16
|
+
'6.10'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class PreUpgradeCheck < Abstract
|
21
|
+
upgrade_metadata do
|
22
|
+
description 'Checks before upgrading to Satellite 6.10'
|
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.10'))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class PreMigrations < Abstract
|
36
|
+
upgrade_metadata do
|
37
|
+
description 'Procedures before migrating to Satellite 6.10'
|
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.10'
|
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.10'))
|
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.10'
|
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.10'
|
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_10_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.10' || \
|
9
|
+
ForemanMaintain.upgrade_in_progress == '6.10.z')
|
10
|
+
end
|
11
|
+
instance_eval(&block)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def target_version
|
16
|
+
'6.10.z'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class PreUpgradeCheck < Abstract
|
21
|
+
upgrade_metadata do
|
22
|
+
description 'Checks before upgrading to Satellite 6.10.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.10'))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class PreMigrations < Abstract
|
35
|
+
upgrade_metadata do
|
36
|
+
description 'Procedures before migrating to Satellite 6.10.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.10.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.10'))
|
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.10.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.10.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
|
@@ -71,6 +71,14 @@ module ForemanMaintain::PackageManager
|
|
71
71
|
sys.execute(find_cmd).split("\n")
|
72
72
|
end
|
73
73
|
|
74
|
+
def list_installed_packages(queryfm = '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n')
|
75
|
+
# The queryfm should only include valid tag(s) as per `rpm --querytag` list.
|
76
|
+
# If any special formatting is required with querytag then it should be provided with tag i.e,
|
77
|
+
# querytag = "--%{VENDOR}"
|
78
|
+
# The queryfm string must end with '\n'
|
79
|
+
sys.execute!("rpm -qa --qf '#{queryfm}'").split("\n")
|
80
|
+
end
|
81
|
+
|
74
82
|
private
|
75
83
|
|
76
84
|
def protector_config
|
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.8.1
|
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: 2021-
|
11
|
+
date: 2021-05-10 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/maintenance_mode/check_consistency.rb
|
148
148
|
- definitions/checks/mongo/db_up.rb
|
149
149
|
- definitions/checks/mongo/tools_installed.rb
|
150
|
+
- definitions/checks/non_rh_packages.rb
|
150
151
|
- definitions/checks/original_assets.rb
|
151
152
|
- definitions/checks/package_manager/yum/validate_yum_config.rb
|
152
153
|
- definitions/checks/pulpcore/db_up.rb
|
@@ -298,10 +299,14 @@ files:
|
|
298
299
|
- definitions/scenarios/prep_6_10_upgrade.rb
|
299
300
|
- definitions/scenarios/restore.rb
|
300
301
|
- definitions/scenarios/services.rb
|
302
|
+
- definitions/scenarios/upgrade_to_capsule_6_10.rb
|
303
|
+
- definitions/scenarios/upgrade_to_capsule_6_10_z.rb
|
301
304
|
- definitions/scenarios/upgrade_to_capsule_6_8.rb
|
302
305
|
- definitions/scenarios/upgrade_to_capsule_6_8_z.rb
|
303
306
|
- definitions/scenarios/upgrade_to_capsule_6_9.rb
|
304
307
|
- definitions/scenarios/upgrade_to_capsule_6_9_z.rb
|
308
|
+
- definitions/scenarios/upgrade_to_satellite_6_10.rb
|
309
|
+
- definitions/scenarios/upgrade_to_satellite_6_10_z.rb
|
305
310
|
- definitions/scenarios/upgrade_to_satellite_6_2.rb
|
306
311
|
- definitions/scenarios/upgrade_to_satellite_6_2_z.rb
|
307
312
|
- definitions/scenarios/upgrade_to_satellite_6_3.rb
|
@@ -418,7 +423,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
418
423
|
- !ruby/object:Gem::Version
|
419
424
|
version: '0'
|
420
425
|
requirements: []
|
421
|
-
rubygems_version: 3.0.
|
426
|
+
rubygems_version: 3.0.9
|
422
427
|
signing_key:
|
423
428
|
specification_version: 4
|
424
429
|
summary: Foreman maintenance tool belt
|