foreman_maintain 0.5.4 → 0.6.4
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 +4 -0
- data/definitions/checks/check_hotfix_installed.rb +2 -1
- data/definitions/checks/disk/performance.rb +25 -10
- data/definitions/checks/foreman/validate_external_db_version.rb +28 -0
- data/definitions/checks/original_assets.rb +1 -0
- data/definitions/checks/pulpcore/db_up.rb +29 -0
- data/definitions/checks/repositories/check_non_rh_repository.rb +23 -0
- data/definitions/checks/repositories/check_upstream_repository.rb +2 -1
- data/definitions/checks/repositories/validate.rb +2 -1
- data/definitions/features/apache.rb +19 -0
- data/definitions/features/dynflow_sidekiq.rb +39 -0
- data/definitions/features/foreman_database.rb +5 -3
- data/definitions/features/foreman_proxy.rb +15 -4
- data/definitions/features/foreman_server.rb +9 -3
- data/definitions/features/foreman_tasks.rb +1 -1
- data/definitions/features/installer.rb +9 -2
- data/definitions/features/instance.rb +10 -3
- data/definitions/features/mongo.rb +1 -1
- data/definitions/features/{pulp.rb → pulp2.rb} +1 -1
- data/definitions/features/pulpcore.rb +28 -0
- data/definitions/features/pulpcore_database.rb +39 -0
- data/definitions/features/redis.rb +34 -0
- data/definitions/features/service.rb +10 -3
- data/definitions/features/tar.rb +18 -13
- data/definitions/procedures/backup/config_files.rb +43 -10
- data/definitions/procedures/backup/offline/pulpcore_db.rb +57 -0
- data/definitions/procedures/backup/online/pulpcore_db.rb +20 -0
- data/definitions/procedures/backup/pulp.rb +3 -3
- data/definitions/procedures/backup/snapshot/logical_volume_confirmation.rb +2 -1
- data/definitions/procedures/backup/snapshot/mount_pulp.rb +3 -3
- data/definitions/procedures/backup/snapshot/mount_pulpcore_db.rb +48 -0
- data/definitions/procedures/content/prepare.rb +12 -0
- data/definitions/procedures/content/switchover.rb +22 -0
- data/definitions/procedures/hammer_setup.rb +1 -1
- data/definitions/procedures/installer/run.rb +3 -1
- data/definitions/procedures/installer/upgrade.rb +6 -1
- data/definitions/procedures/packages/update.rb +1 -1
- data/definitions/procedures/pulp/migrate.rb +1 -1
- data/definitions/procedures/pulpcore/migrate.rb +25 -0
- data/definitions/procedures/restore/configs.rb +7 -0
- data/definitions/procedures/restore/drop_databases.rb +11 -1
- data/definitions/procedures/restore/mongo_dump.rb +2 -2
- data/definitions/procedures/restore/pulpcore_dump.rb +30 -0
- data/definitions/procedures/service/base.rb +1 -1
- data/definitions/procedures/service/stop.rb +1 -1
- data/definitions/scenarios/backup.rb +18 -3
- data/definitions/scenarios/content.rb +27 -0
- data/definitions/scenarios/packages.rb +36 -16
- data/definitions/scenarios/restore.rb +7 -1
- data/definitions/scenarios/upgrade_to_capsule_6_7.rb +88 -0
- data/definitions/scenarios/upgrade_to_capsule_6_7_z.rb +88 -0
- data/definitions/scenarios/upgrade_to_capsule_6_8.rb +88 -0
- data/definitions/scenarios/upgrade_to_capsule_6_8_z.rb +88 -0
- data/definitions/scenarios/upgrade_to_satellite_6_2.rb +13 -5
- data/definitions/scenarios/upgrade_to_satellite_6_2_z.rb +13 -5
- data/definitions/scenarios/upgrade_to_satellite_6_3.rb +13 -5
- data/definitions/scenarios/upgrade_to_satellite_6_3_z.rb +13 -5
- data/definitions/scenarios/upgrade_to_satellite_6_4.rb +13 -5
- data/definitions/scenarios/upgrade_to_satellite_6_4_z.rb +13 -5
- data/definitions/scenarios/upgrade_to_satellite_6_5.rb +13 -5
- data/definitions/scenarios/upgrade_to_satellite_6_5_z.rb +13 -5
- data/definitions/scenarios/upgrade_to_satellite_6_6.rb +13 -5
- data/definitions/scenarios/upgrade_to_satellite_6_6_z.rb +13 -5
- data/definitions/scenarios/upgrade_to_satellite_6_7.rb +13 -5
- data/definitions/scenarios/upgrade_to_satellite_6_7_z.rb +13 -5
- data/definitions/scenarios/upgrade_to_satellite_6_8.rb +88 -0
- data/definitions/scenarios/upgrade_to_satellite_6_8_z.rb +88 -0
- data/lib/foreman_maintain.rb +31 -0
- data/lib/foreman_maintain/cli.rb +2 -0
- data/lib/foreman_maintain/cli/content_command.rb +17 -0
- data/lib/foreman_maintain/cli/upgrade_command.rb +10 -0
- data/lib/foreman_maintain/concerns/base_database.rb +16 -1
- data/lib/foreman_maintain/concerns/downstream.rb +13 -8
- data/lib/foreman_maintain/concerns/system_helpers.rb +9 -7
- data/lib/foreman_maintain/package_manager/dnf.rb +11 -5
- data/lib/foreman_maintain/package_manager/yum.rb +15 -5
- data/lib/foreman_maintain/reporter/cli_reporter.rb +3 -3
- data/lib/foreman_maintain/upgrade_runner.rb +20 -26
- data/lib/foreman_maintain/utils/backup.rb +58 -62
- data/lib/foreman_maintain/utils/service/abstract.rb +8 -1
- data/lib/foreman_maintain/utils/service/systemd.rb +26 -2
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +26 -4
- data/definitions/checks/check_epel_repository.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: e51a96d2df37cf98881bc81a1b67f33dca283ea34b226f2f434273984e6baa59
|
4
|
+
data.tar.gz: ad6c47b27ba7e5c2869354c0a60885e8da2158cc3b6feb04df614ccc78c395d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddd22571061620757eaa7d814c34c7c4d06801361ebba1296b5089a345ed61ac91c41fbaa97f643bb8535bf5644d5e96065dccbd66681d6b3516963462f1d940
|
7
|
+
data.tar.gz: 9f0023b28042b0f5145a7c2b60b91a8194216eeaa5936987cb91504c49a502a9dfd03c21d3d527cc7487a14a7abe2d8513dcc66a7f47454fa9f3bdc61debdb85
|
data/README.md
CHANGED
@@ -48,6 +48,10 @@ Subcommands:
|
|
48
48
|
stop Stop maintenance-mode
|
49
49
|
status Get maintenance-mode status
|
50
50
|
is-enabled Get maintenance-mode status code
|
51
|
+
|
52
|
+
content Content related commands
|
53
|
+
prepare Prepare content for Pulp 3
|
54
|
+
switchover Switch support for certain content from Pulp 2 to Pulp 3
|
51
55
|
```
|
52
56
|
|
53
57
|
### Upgrades
|
@@ -4,7 +4,8 @@ class Checks::CheckHotfixInstalled < ForemanMaintain::Check
|
|
4
4
|
description 'Check to verify if any hotfix installed on system'
|
5
5
|
tags :pre_upgrade
|
6
6
|
preparation_steps do
|
7
|
-
|
7
|
+
[Checks::Repositories::CheckNonRhRepository.new,
|
8
|
+
Procedures::Packages::Install.new(:packages => %w[yum-utils])]
|
8
9
|
end
|
9
10
|
|
10
11
|
confine do
|
@@ -3,20 +3,22 @@ module Checks
|
|
3
3
|
class Performance < ForemanMaintain::Check
|
4
4
|
metadata do
|
5
5
|
label :disk_performance
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
preparation_steps do
|
7
|
+
if feature(:instance).downstream
|
8
|
+
[Checks::Repositories::CheckNonRhRepository.new,
|
9
|
+
Procedures::Packages::Install.new(:packages => %w[fio])]
|
10
|
+
else
|
11
|
+
[Procedures::Packages::Install.new(:packages => %w[fio])]
|
12
|
+
end
|
13
|
+
end
|
9
14
|
|
10
15
|
confine do
|
11
|
-
feature(:pulp
|
16
|
+
feature(:instance).pulp
|
12
17
|
end
|
13
18
|
end
|
14
19
|
|
15
20
|
EXPECTED_IO = 60
|
16
21
|
DEFAULT_UNIT = 'MB/sec'.freeze
|
17
|
-
DEFAULT_DIRS = [
|
18
|
-
'/var/lib/pulp', '/var/lib/mongodb', '/var/lib/pgsql'
|
19
|
-
].select { |file_path| File.directory?(file_path) }.freeze
|
20
22
|
|
21
23
|
attr_reader :stats
|
22
24
|
|
@@ -37,16 +39,29 @@ module Checks
|
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
42
|
+
def default_dirs
|
43
|
+
@default_dirs ||= %i[pulp2 pulpcore_database mongo foreman_database].inject({}) do |dirs, f|
|
44
|
+
if feature(f) && File.directory?(feature(f).data_dir)
|
45
|
+
dirs[feature(f).label_dashed] = feature(f).data_dir
|
46
|
+
end
|
47
|
+
dirs
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def description
|
52
|
+
"Check recommended disk speed for #{default_dirs.keys.join(', ')} directories."
|
53
|
+
end
|
54
|
+
|
40
55
|
def check_only_single_device?
|
41
|
-
|
56
|
+
default_dirs.values do |dir|
|
42
57
|
ForemanMaintain::Utils::Disk::Device.new(dir).name
|
43
58
|
end.uniq.length <= 1
|
44
59
|
end
|
45
60
|
|
46
61
|
def dirs_to_check
|
47
|
-
return
|
62
|
+
return default_dirs.values.first(1) if check_only_single_device?
|
48
63
|
|
49
|
-
|
64
|
+
default_dirs.values
|
50
65
|
end
|
51
66
|
|
52
67
|
private
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Checks
|
2
|
+
module Foreman
|
3
|
+
class ValidateExternalDbVersion < ForemanMaintain::Check
|
4
|
+
metadata do
|
5
|
+
description 'Make sure server is running on required database version'
|
6
|
+
tags :pre_upgrade
|
7
|
+
label :validate_external_db_version
|
8
|
+
confine do
|
9
|
+
feature(:foreman_database) && !feature(:foreman_database).local? &&
|
10
|
+
!check_min_version('foreman', '2.0')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def run
|
15
|
+
current_db_version = feature(:foreman_database).db_version
|
16
|
+
fail!(db_upgrade_message(current_db_version)) if current_db_version.major < 12
|
17
|
+
end
|
18
|
+
|
19
|
+
def db_upgrade_message(db_version)
|
20
|
+
product_name = feature(:instance).product_name
|
21
|
+
|
22
|
+
"\n\n*** ERROR: Server is running on PostgreSQL #{db_version} database.\n"\
|
23
|
+
"*** Newer version of #{product_name} supports only PostgreSQL version 12.\n"\
|
24
|
+
"*** Before proceeding further, you must upgrade database to PostgreSQL 12.\n"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Checks
|
2
|
+
module Pulpcore
|
3
|
+
class DBUp < ForemanMaintain::Check
|
4
|
+
metadata do
|
5
|
+
description 'Make sure Pulpcore DB is up'
|
6
|
+
label :pulpcore_db_up
|
7
|
+
for_feature :pulpcore_database
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
status = false
|
12
|
+
with_spinner('Checking connection to the Pulpcore DB') do
|
13
|
+
status = feature(:pulpcore_database).ping
|
14
|
+
end
|
15
|
+
assert(status, 'Pulpcore DB is not responding. ' \
|
16
|
+
'It needs to be up and running to perform the following steps',
|
17
|
+
:next_steps => next_steps)
|
18
|
+
end
|
19
|
+
|
20
|
+
def next_steps
|
21
|
+
if feature(:pulpcore_database).local?
|
22
|
+
[Procedures::Service::Start.new(:only => 'postgresql')]
|
23
|
+
else
|
24
|
+
[] # there is nothing we can do for remote db
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Checks::Repositories
|
2
|
+
class CheckNonRhRepository < ForemanMaintain::Check
|
3
|
+
metadata do
|
4
|
+
label :check_non_redhat_repository
|
5
|
+
description "Check whether system don't have any non Red Hat repositories(Eg: EPEL) enabled"
|
6
|
+
tags :pre_upgrade
|
7
|
+
confine do
|
8
|
+
feature(:instance).downstream
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
with_spinner('Checking repositories enabled on the system') do
|
14
|
+
assert(!epel_enabled?, 'System is subscribed to non Red Hat repositories(Eg: EPEL)')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def epel_enabled?
|
19
|
+
system_repos = execute("yum repolist enabled -d 6 -e 0| grep -E 'Repo-baseurl|Repo-id'")
|
20
|
+
system_repos.to_s.match(/\bepel\b/i)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -4,7 +4,8 @@ class Checks::CheckUpstreamRepository < ForemanMaintain::Check
|
|
4
4
|
description 'Check if any upstream repositories are enabled on system'
|
5
5
|
tags :pre_upgrade
|
6
6
|
preparation_steps do
|
7
|
-
|
7
|
+
[Checks::Repositories::CheckNonRhRepository.new,
|
8
|
+
Procedures::Packages::Install.new(:packages => %w[yum-utils])]
|
8
9
|
end
|
9
10
|
confine do
|
10
11
|
feature(:instance).downstream
|
@@ -3,7 +3,8 @@ module Checks::Repositories
|
|
3
3
|
metadata do
|
4
4
|
description 'Validate availability of repositories'
|
5
5
|
preparation_steps do
|
6
|
-
|
6
|
+
[Checks::Repositories::CheckNonRhRepository.new,
|
7
|
+
Procedures::Packages::Install.new(:packages => [ForemanMaintain::Utils::Facter.package])]
|
7
8
|
end
|
8
9
|
|
9
10
|
confine do
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Features::Apache < ForemanMaintain::Feature
|
2
|
+
metadata do
|
3
|
+
label :apache
|
4
|
+
|
5
|
+
confine do
|
6
|
+
find_package('httpd')
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def services
|
11
|
+
[
|
12
|
+
system_service('httpd', 30)
|
13
|
+
]
|
14
|
+
end
|
15
|
+
|
16
|
+
def config_files
|
17
|
+
['/etc/httpd']
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class Features::DynflowSidekiq < ForemanMaintain::Feature
|
2
|
+
metadata do
|
3
|
+
label :dynflow_sidekiq
|
4
|
+
|
5
|
+
confine do
|
6
|
+
server? && find_package('foreman-dynflow-sidekiq')
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def services
|
11
|
+
service_names.map { |service| system_service service, instance_priority(service) }
|
12
|
+
end
|
13
|
+
|
14
|
+
def config_files
|
15
|
+
# Workaround until foreman-installer can deploy scaled workers
|
16
|
+
service_symlinks = configured_instances.map do |service|
|
17
|
+
"/etc/systemd/system/multi-user.target.wants/#{service}.service"
|
18
|
+
end
|
19
|
+
[
|
20
|
+
'/etc/foreman/dynflow',
|
21
|
+
service_symlinks
|
22
|
+
].flatten
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def instance_priority(instance)
|
28
|
+
# Orchestrator should be started before the workers are
|
29
|
+
instance.end_with?('@orchestrator') ? 30 : 31
|
30
|
+
end
|
31
|
+
|
32
|
+
def service_names
|
33
|
+
configured_instances.map { |instance| "dynflow-sidekiq@#{instance}" }
|
34
|
+
end
|
35
|
+
|
36
|
+
def configured_instances
|
37
|
+
Dir['/etc/foreman/dynflow/*'].map { |config| File.basename(config, '.yml') }
|
38
|
+
end
|
39
|
+
end
|
@@ -16,9 +16,11 @@ class Features::ForemanDatabase < ForemanMaintain::Feature
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def config_files
|
19
|
-
|
20
|
-
'/var/lib/pgsql/data/postgresql.conf'
|
21
|
-
|
19
|
+
if check_min_version('foreman', '2.0')
|
20
|
+
['/var/opt/rh/rh-postgresql12/lib/pgsql/data/postgresql.conf']
|
21
|
+
else
|
22
|
+
['/var/lib/pgsql/data/postgresql.conf']
|
23
|
+
end
|
22
24
|
end
|
23
25
|
|
24
26
|
def services
|
@@ -17,7 +17,7 @@ class Features::ForemanProxy < ForemanMaintain::Feature
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def with_content?
|
20
|
-
!!feature(:pulp
|
20
|
+
!!feature(:instance).pulp
|
21
21
|
end
|
22
22
|
|
23
23
|
def dhcpd_conf_exist?
|
@@ -79,17 +79,26 @@ class Features::ForemanProxy < ForemanMaintain::Feature
|
|
79
79
|
|
80
80
|
def content_module
|
81
81
|
return @content_module if @content_module_detected
|
82
|
+
|
82
83
|
@content_module_detected = true
|
83
84
|
answer = feature(:installer).answers.find do |_, config|
|
84
|
-
config.is_a?(Hash) && config.key?(
|
85
|
+
config.is_a?(Hash) && config.key?(certs_param_name[:param_key])
|
85
86
|
end
|
86
|
-
@content_module = answer.nil? ?
|
87
|
+
@content_module = answer.nil? ? certs_param_name[:param_section] : answer.first
|
87
88
|
logger.debug("foreman proxy content module detected: #{@content_module}")
|
88
89
|
@content_module
|
89
90
|
end
|
90
91
|
|
92
|
+
def certs_param_name
|
93
|
+
if check_min_version('foreman', '1.21')
|
94
|
+
return { :param_section => 'certs', :param_key => 'tar_file' }
|
95
|
+
end
|
96
|
+
|
97
|
+
{ :param_section => 'foreman_proxy_content', :param_key => 'certs_tar' }
|
98
|
+
end
|
99
|
+
|
91
100
|
def certs_tar
|
92
|
-
feature(:installer).answers[content_module][
|
101
|
+
feature(:installer).answers[content_module][certs_param_name[:param_section]] if content_module
|
93
102
|
end
|
94
103
|
|
95
104
|
def settings_file
|
@@ -136,6 +145,7 @@ class Features::ForemanProxy < ForemanMaintain::Feature
|
|
136
145
|
http_line = ''
|
137
146
|
array_output.each do |str|
|
138
147
|
next unless str.include?('HTTP')
|
148
|
+
|
139
149
|
http_line = str
|
140
150
|
end
|
141
151
|
msg = http_line.split(curl_http_status.to_s).last
|
@@ -195,6 +205,7 @@ class Features::ForemanProxy < ForemanMaintain::Feature
|
|
195
205
|
def lookup_dhcpd_config_file
|
196
206
|
dhcpd_config_file = lookup_using_dhcp_yml
|
197
207
|
raise "Couldn't find DHCP Configuration file" if dhcpd_config_file.nil?
|
208
|
+
|
198
209
|
dhcpd_config_file
|
199
210
|
end
|
200
211
|
|
@@ -9,9 +9,11 @@ module ForemanMaintain
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def services
|
12
|
-
|
13
|
-
system_service('
|
14
|
-
|
12
|
+
if execute?('systemctl is-enabled foreman')
|
13
|
+
[system_service('foreman', 30, :socket => 'foreman')]
|
14
|
+
else
|
15
|
+
[system_service('httpd', 30)]
|
16
|
+
end
|
15
17
|
end
|
16
18
|
|
17
19
|
def plugins
|
@@ -41,6 +43,10 @@ module ForemanMaintain
|
|
41
43
|
'/var/lib/foreman/public'
|
42
44
|
]
|
43
45
|
end
|
46
|
+
|
47
|
+
def services_running?
|
48
|
+
services.all?(&:running?)
|
49
|
+
end
|
44
50
|
end
|
45
51
|
end
|
46
52
|
end
|
@@ -92,8 +92,15 @@ class Features::Installer < ForemanMaintain::Feature
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def upgrade(exec_options = {})
|
95
|
-
|
96
|
-
|
95
|
+
run(installer_arguments, exec_options)
|
96
|
+
end
|
97
|
+
|
98
|
+
def installer_arguments
|
99
|
+
installer_args = ' --disable-system-checks'
|
100
|
+
unless check_min_version('foreman', '2.1') || check_min_version('foreman-proxy', '2.1')
|
101
|
+
installer_args += ' --upgrade' if can_upgrade?
|
102
|
+
end
|
103
|
+
installer_args
|
97
104
|
end
|
98
105
|
|
99
106
|
def initial_admin_username
|
@@ -37,7 +37,9 @@ class Features::Instance < ForemanMaintain::Feature
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def postgresql_local?
|
40
|
-
database_local?(:candlepin_database) ||
|
40
|
+
database_local?(:candlepin_database) ||
|
41
|
+
database_local?(:foreman_database) ||
|
42
|
+
database_local?(:pulpcore_database)
|
41
43
|
end
|
42
44
|
|
43
45
|
def foreman_proxy_with_content?
|
@@ -64,6 +66,10 @@ class Features::Instance < ForemanMaintain::Feature
|
|
64
66
|
net
|
65
67
|
end
|
66
68
|
|
69
|
+
def pulp
|
70
|
+
feature(:pulp2) || feature(:pulpcore)
|
71
|
+
end
|
72
|
+
|
67
73
|
private
|
68
74
|
|
69
75
|
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
@@ -137,8 +143,9 @@ class Features::Instance < ForemanMaintain::Feature
|
|
137
143
|
{
|
138
144
|
'candlepin_auth' => %w[candlepin candlepin_database],
|
139
145
|
'candlepin' => %w[candlepin candlepin_database],
|
140
|
-
'pulp_auth' => %w[
|
141
|
-
'pulp' => %w[
|
146
|
+
'pulp_auth' => %w[pulp2 mongo],
|
147
|
+
'pulp' => %w[pulp2 mongo],
|
148
|
+
'pulpcore' => %w[pulpcore pulpcore_database],
|
142
149
|
'foreman_tasks' => %w[foreman_tasks]
|
143
150
|
}
|
144
151
|
end
|