foreman_maintain 0.6.0 → 0.6.5
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 +5 -5
- data/README.md +4 -0
- data/definitions/checks/check_hotfix_installed.rb +2 -1
- data/definitions/checks/disk/performance.rb +24 -9
- data/definitions/checks/foreman/check_corrupted_roles.rb +14 -2
- 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 +1 -1
- data/definitions/features/foreman_database.rb +5 -3
- data/definitions/features/foreman_server.rb +9 -3
- data/definitions/features/foreman_tasks.rb +7 -2
- data/definitions/features/installer.rb +9 -2
- data/definitions/features/instance.rb +5 -2
- data/definitions/features/katello.rb +7 -0
- data/definitions/features/{pulp3.rb → pulpcore.rb} +9 -3
- data/definitions/features/pulpcore_database.rb +39 -0
- data/definitions/features/puppet_server.rb +6 -2
- data/definitions/features/service.rb +10 -3
- data/definitions/features/tar.rb +5 -0
- data/definitions/procedures/backup/config_files.rb +3 -0
- data/definitions/procedures/backup/metadata.rb +2 -0
- data/definitions/procedures/backup/offline/pulpcore_db.rb +57 -0
- data/definitions/procedures/backup/online/pulpcore_db.rb +20 -0
- data/definitions/procedures/backup/snapshot/logical_volume_confirmation.rb +1 -0
- data/definitions/procedures/backup/snapshot/mount_pulpcore_db.rb +48 -0
- data/definitions/procedures/content/prepare.rb +2 -2
- 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/installer_confirmation.rb +1 -1
- data/definitions/procedures/packages/update.rb +1 -1
- data/definitions/procedures/packages/update_all_confirmation.rb +24 -0
- data/definitions/procedures/pulpcore/migrate.rb +25 -0
- data/definitions/procedures/restore/configs.rb +6 -0
- data/definitions/procedures/restore/drop_databases.rb +11 -1
- data/definitions/procedures/restore/extract_files.rb +1 -0
- data/definitions/procedures/restore/pulpcore_dump.rb +30 -0
- data/definitions/procedures/restore/regenerate_queues.rb +69 -0
- data/definitions/procedures/service/stop.rb +1 -1
- data/definitions/scenarios/backup.rb +21 -4
- data/definitions/scenarios/content.rb +27 -0
- data/definitions/scenarios/packages.rb +38 -14
- data/definitions/scenarios/restore.rb +10 -2
- 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/extras/foreman_protector/foreman-protector.py +1 -1
- 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/packages_command.rb +1 -1
- 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 +14 -10
- data/lib/foreman_maintain/feature.rb +4 -0
- 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 +6 -6
- data/lib/foreman_maintain/upgrade_runner.rb +20 -26
- data/lib/foreman_maintain/utils/backup.rb +62 -62
- data/lib/foreman_maintain/utils/disk/io_device.rb +1 -1
- data/lib/foreman_maintain/utils/facter.rb +1 -1
- data/lib/foreman_maintain/utils/service/abstract.rb +6 -0
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +184 -165
- data/definitions/checks/check_epel_repository.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 78da2357707f4caa6c3a4aa295c75a07abfff9370800b51b0f03647b2f3abb7f
|
4
|
+
data.tar.gz: 592c818c90870337f4fdc866a29e09e9f9b483f712603d18b84cc5533563d615
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64cf4d1dee1a471a0082fb6daf6ec23812b50ecfb7a32620966c790c2bf976d75fb1b86ae14e73fbda169393abea261fba30c07c00fad589c19ea5ea9902584b
|
7
|
+
data.tar.gz: 94611d55110abfcb196b9bd758af79352930aa977d36a1deb2c08f412730f596fbfeea19585f03ed671797028e2f7a3e6e4484ecec6e77541c73645260fa1a4c
|
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,9 +3,14 @@ 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
16
|
feature(:instance).pulp
|
@@ -14,9 +19,6 @@ module Checks
|
|
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
|
@@ -14,14 +14,22 @@ module Checks
|
|
14
14
|
def run
|
15
15
|
items = find_filter_permissions
|
16
16
|
assert(items.empty?,
|
17
|
-
|
17
|
+
error_message(items),
|
18
18
|
:next_steps => Procedures::Foreman::FixCorruptedRoles.new)
|
19
19
|
end
|
20
20
|
|
21
|
+
def error_message(items)
|
22
|
+
roles = items.map { |item| item['role_name'] }.uniq
|
23
|
+
'There are filters having permissions with multiple resource types. ' \
|
24
|
+
'Roles with such filters are:' \
|
25
|
+
"\n#{roles.join("\n")}"
|
26
|
+
end
|
27
|
+
|
21
28
|
def find_filter_permissions
|
22
29
|
feature(:foreman_database).query(self.class.inconsistent_filter_perms)
|
23
30
|
end
|
24
31
|
|
32
|
+
# rubocop:disable Metrics/MethodLength
|
25
33
|
def self.inconsistent_filter_perms
|
26
34
|
subquery = <<-SQL
|
27
35
|
SELECT filters.id AS filter_id,
|
@@ -32,14 +40,17 @@ module Checks
|
|
32
40
|
filterings.id AS filtering_id,
|
33
41
|
permissions.id AS permission_id,
|
34
42
|
permissions.name AS permission_name,
|
35
|
-
permissions.resource_type
|
43
|
+
permissions.resource_type,
|
44
|
+
roles.name AS role_name
|
36
45
|
FROM filters INNER JOIN filterings ON filters.id = filterings.filter_id
|
37
46
|
INNER JOIN permissions ON permissions.id = filterings.permission_id
|
47
|
+
INNER JOIN roles ON filters.role_id = roles.id
|
38
48
|
SQL
|
39
49
|
|
40
50
|
<<-SQL
|
41
51
|
SELECT DISTINCT first.filter_id,
|
42
52
|
first.role_id,
|
53
|
+
first.role_name,
|
43
54
|
first.filtering_id,
|
44
55
|
first.permission_id,
|
45
56
|
first.permission_name,
|
@@ -54,6 +65,7 @@ module Checks
|
|
54
65
|
OR (first.resource_type != second.resource_type))
|
55
66
|
SQL
|
56
67
|
end
|
68
|
+
# rubocop:enable Metrics/MethodLength
|
57
69
|
end
|
58
70
|
end
|
59
71
|
end
|
@@ -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
|
@@ -13,7 +13,7 @@ class Features::DynflowSidekiq < ForemanMaintain::Feature
|
|
13
13
|
|
14
14
|
def config_files
|
15
15
|
# Workaround until foreman-installer can deploy scaled workers
|
16
|
-
service_symlinks =
|
16
|
+
service_symlinks = configured_instances.map do |service|
|
17
17
|
"/etc/systemd/system/multi-user.target.wants/#{service}.service"
|
18
18
|
end
|
19
19
|
[
|
@@ -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
|
@@ -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
|
@@ -162,8 +162,13 @@ class Features::ForemanTasks < ForemanMaintain::Feature
|
|
162
162
|
def export_csv(sql, file_name, state)
|
163
163
|
dir = prepare_for_backup(state)
|
164
164
|
filepath = "#{dir}/#{file_name}"
|
165
|
-
|
166
|
-
|
165
|
+
csv_output = feature(:foreman_database).query_csv(sql)
|
166
|
+
File.open(filepath, 'w') do |f|
|
167
|
+
f.write(csv_output)
|
168
|
+
f.close
|
169
|
+
end
|
170
|
+
execute("bzip2 #{filepath} -c -9 > #{filepath}.bz2")
|
171
|
+
FileUtils.rm_rf(filepath)
|
167
172
|
end
|
168
173
|
|
169
174
|
def old_tasks_condition(state = "'stopped', 'paused'")
|
@@ -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?
|
@@ -65,7 +67,7 @@ class Features::Instance < ForemanMaintain::Feature
|
|
65
67
|
end
|
66
68
|
|
67
69
|
def pulp
|
68
|
-
feature(:pulp2) || feature(:
|
70
|
+
feature(:pulp2) || feature(:pulpcore)
|
69
71
|
end
|
70
72
|
|
71
73
|
private
|
@@ -143,6 +145,7 @@ class Features::Instance < ForemanMaintain::Feature
|
|
143
145
|
'candlepin' => %w[candlepin candlepin_database],
|
144
146
|
'pulp_auth' => %w[pulp2 mongo],
|
145
147
|
'pulp' => %w[pulp2 mongo],
|
148
|
+
'pulpcore' => %w[pulpcore pulpcore_database],
|
146
149
|
'foreman_tasks' => %w[foreman_tasks]
|
147
150
|
}
|
148
151
|
end
|
@@ -52,6 +52,13 @@ class Features::Katello < ForemanMaintain::Feature
|
|
52
52
|
end
|
53
53
|
# rubocop:enable Metrics/MethodLength
|
54
54
|
|
55
|
+
def config_files_exclude_for_online
|
56
|
+
[
|
57
|
+
'/var/lib/qpidd',
|
58
|
+
'/var/lib/candlepin/activemq-artemis'
|
59
|
+
]
|
60
|
+
end
|
61
|
+
|
55
62
|
private
|
56
63
|
|
57
64
|
def installer_scenario_answers
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'foreman_maintain/utils/service/systemd'
|
2
2
|
|
3
|
-
class Features::
|
3
|
+
class Features::Pulpcore < ForemanMaintain::Feature
|
4
4
|
metadata do
|
5
|
-
label :
|
5
|
+
label :pulpcore
|
6
6
|
|
7
7
|
confine do
|
8
8
|
ForemanMaintain::Utils::Service::Systemd.new('pulpcore-api', 0).exist?
|
@@ -11,12 +11,18 @@ class Features::Pulp3 < ForemanMaintain::Feature
|
|
11
11
|
|
12
12
|
def services
|
13
13
|
[
|
14
|
+
system_service('rh-redis5-redis', 5),
|
14
15
|
system_service('pulpcore-api', 10),
|
15
16
|
system_service('pulpcore-content', 10),
|
16
17
|
system_service('pulpcore-resource-manager', 10),
|
17
18
|
system_service('pulpcore-worker@*', 20, :all => true, :skip_enablement => true),
|
18
|
-
system_service('rh-redis5-redis', 30),
|
19
19
|
system_service('httpd', 30)
|
20
20
|
]
|
21
21
|
end
|
22
|
+
|
23
|
+
def config_files
|
24
|
+
[
|
25
|
+
'/etc/pulp/settings.py'
|
26
|
+
]
|
27
|
+
end
|
22
28
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class Features::PulpcoreDatabase < ForemanMaintain::Feature
|
2
|
+
PULPCORE_DB_CONFIG = '/etc/pulp/settings.py'.freeze
|
3
|
+
|
4
|
+
include ForemanMaintain::Concerns::BaseDatabase
|
5
|
+
|
6
|
+
metadata do
|
7
|
+
label :pulpcore_database
|
8
|
+
|
9
|
+
confine do
|
10
|
+
file_nonzero?(PULPCORE_DB_CONFIG)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def configuration
|
15
|
+
@configuration || load_configuration
|
16
|
+
end
|
17
|
+
|
18
|
+
def services
|
19
|
+
[
|
20
|
+
system_service('postgresql', 10, :component => 'pulpcore',
|
21
|
+
:db_feature => feature(:pulpcore_database))
|
22
|
+
]
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def load_configuration
|
28
|
+
full_config = File.read(PULPCORE_DB_CONFIG).split(/[\s,'":]/).reject(&:empty?)
|
29
|
+
|
30
|
+
@configuration = {}
|
31
|
+
@configuration['adapter'] = 'postgresql'
|
32
|
+
@configuration['host'] = full_config[full_config.index('HOST') + 1]
|
33
|
+
@configuration['port'] = full_config[full_config.index('PORT') + 1]
|
34
|
+
@configuration['database'] = full_config[full_config.index('NAME') + 1]
|
35
|
+
@configuration['username'] = full_config[full_config.index('USER') + 1]
|
36
|
+
@configuration['password'] = full_config[full_config.index('PASSWORD') + 1]
|
37
|
+
@configuration
|
38
|
+
end
|
39
|
+
end
|