foreman_maintain 1.10.3 → 1.12.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/definitions/checks/container/podman_login.rb +30 -0
- data/definitions/checks/iop_advisor/db_up.rb +33 -0
- data/definitions/checks/iop_inventory/db_up.rb +33 -0
- data/definitions/checks/iop_remediations/db_up.rb +33 -0
- data/definitions/checks/iop_vmaas/db_up.rb +33 -0
- data/definitions/checks/iop_vulnerability/db_up.rb +33 -0
- data/definitions/features/containers.rb +8 -0
- data/definitions/features/iop.rb +46 -0
- data/definitions/features/iop_advisor_database.rb +45 -0
- data/definitions/features/iop_inventory_database.rb +45 -0
- data/definitions/features/iop_remediations_database.rb +45 -0
- data/definitions/features/iop_vmaas_database.rb +45 -0
- data/definitions/features/iop_vulnerability_database.rb +45 -0
- data/definitions/procedures/backup/online/iop_advisor_db.rb +20 -0
- data/definitions/procedures/backup/online/iop_inventory_db.rb +20 -0
- data/definitions/procedures/backup/online/iop_remediations_db.rb +21 -0
- data/definitions/procedures/backup/online/iop_vmaas_db.rb +20 -0
- data/definitions/procedures/backup/online/iop_vulnerability_db.rb +21 -0
- data/definitions/procedures/restore/drop_databases.rb +46 -1
- data/definitions/procedures/restore/iop_advisor_dump.rb +27 -0
- data/definitions/procedures/restore/iop_inventory_dump.rb +27 -0
- data/definitions/procedures/restore/iop_remediations_dump.rb +27 -0
- data/definitions/procedures/restore/iop_vmaas_dump.rb +25 -0
- data/definitions/procedures/restore/iop_vulnerability_dump.rb +27 -0
- data/definitions/reports/advisor_on_prem_remediations.rb +33 -0
- data/definitions/reports/alternate_content_sources.rb +46 -0
- data/definitions/reports/content.rb +54 -0
- data/definitions/reports/image_mode_hosts.rb +50 -0
- data/definitions/reports/inventory.rb +25 -1
- data/definitions/reports/networking.rb +78 -0
- data/definitions/reports/platform.rb +1 -1
- data/definitions/scenarios/backup.rb +10 -0
- data/definitions/scenarios/restore.rb +25 -0
- data/definitions/scenarios/satellite_upgrade.rb +1 -0
- data/definitions/scenarios/update.rb +1 -0
- data/lib/foreman_maintain/cli/report_command.rb +112 -10
- data/lib/foreman_maintain/concerns/downstream.rb +5 -0
- data/lib/foreman_maintain/utils/backup.rb +5 -0
- data/lib/foreman_maintain/utils/service/systemd.rb +2 -2
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +31 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfa2280e285e63ea4e7b6269dc6761598c17034fc9febfde0aca731b19a684c3
|
4
|
+
data.tar.gz: b83257b1cefd0ed6e6ad12205442b1817a2b2395b315b08f59a34c8b09833517
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da581d87a81c7b38ab139245323e2ad3f9958fff5094c27b00ef28ff7e519741f18bb909388c660208ce2531ddc14bb39c7873deeacc1502d11185417f4bb321
|
7
|
+
data.tar.gz: 143cd40662be08087e1da5f2cb29c40dbe24bbecd19ea292c6c34394b218606aeb024ddd2757d7fbbbb0edfc5d1220b92dcde0596bd011be6e8ec2cc47274a3c
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Checks::Container
|
2
|
+
class PodmanLogin < ForemanMaintain::Check
|
3
|
+
metadata do
|
4
|
+
for_feature :satellite
|
5
|
+
confine do
|
6
|
+
feature(:satellite)&.connected? && feature(:containers)
|
7
|
+
end
|
8
|
+
description 'Check whether podman is logged in to registry'
|
9
|
+
tags :pre_upgrade
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
login_status, _output = execute_with_status('podman login --get-login registry.redhat.io')
|
14
|
+
assert(
|
15
|
+
login_status == 0,
|
16
|
+
failure_message
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def failure_message
|
23
|
+
<<~MSG
|
24
|
+
You are using containers from registry.redhat.io,
|
25
|
+
but your system is not logged in to the registry, or the login expired.
|
26
|
+
Please login to registry.redhat.io.
|
27
|
+
MSG
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Checks
|
2
|
+
module IopAdvisor
|
3
|
+
class DBUp < ForemanMaintain::Check
|
4
|
+
metadata do
|
5
|
+
description 'Make sure IoP Advisor DB is up'
|
6
|
+
label :iop_advisor_db_up
|
7
|
+
for_feature :iop_advisor
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
status = false
|
12
|
+
if feature(:iop_advisor_database).psql_cmd_available?
|
13
|
+
with_spinner('Checking connection to the IoP Advisor DB') do
|
14
|
+
status = feature(:iop_advisor_database).ping
|
15
|
+
end
|
16
|
+
assert(status, 'IoP Advisor DB is not responding. ' \
|
17
|
+
'It needs to be up and running to perform the following steps',
|
18
|
+
:next_steps => start_pgsql)
|
19
|
+
else
|
20
|
+
feature(:iop_advisor_database).raise_psql_missing_error
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def start_pgsql
|
25
|
+
if feature(:iop_advisor_database).local?
|
26
|
+
[Procedures::Service::Start.new(:only => 'postgresql')]
|
27
|
+
else
|
28
|
+
[] # there is nothing we can do for remote db
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Checks
|
2
|
+
module IopInventory
|
3
|
+
class DBUp < ForemanMaintain::Check
|
4
|
+
metadata do
|
5
|
+
description 'Make sure IoP Inventory DB is up'
|
6
|
+
label :iop_inventory_db_up
|
7
|
+
for_feature :iop_inventory
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
status = false
|
12
|
+
if feature(:iop_inventory_database).psql_cmd_available?
|
13
|
+
with_spinner('Checking connection to the IoP Inventory DB') do
|
14
|
+
status = feature(:iop_inventory_database).ping
|
15
|
+
end
|
16
|
+
assert(status, 'IoP Inventory DB is not responding. ' \
|
17
|
+
'It needs to be up and running to perform the following steps',
|
18
|
+
:next_steps => start_pgsql)
|
19
|
+
else
|
20
|
+
feature(:iop_inventory_database).raise_psql_missing_error
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def start_pgsql
|
25
|
+
if feature(:iop_inventory_database).local?
|
26
|
+
[Procedures::Service::Start.new(:only => 'postgresql')]
|
27
|
+
else
|
28
|
+
[] # there is nothing we can do for remote db
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Checks
|
2
|
+
module IopRemediations
|
3
|
+
class DBUp < ForemanMaintain::Check
|
4
|
+
metadata do
|
5
|
+
description 'Make sure IoP Remediations DB is up'
|
6
|
+
label :iop_remediations_db_up
|
7
|
+
for_feature :iop_remediations
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
status = false
|
12
|
+
if feature(:iop_remediations_database).psql_cmd_available?
|
13
|
+
with_spinner('Checking connection to the IoP Remediations DB') do
|
14
|
+
status = feature(:iop_remediations_database).ping
|
15
|
+
end
|
16
|
+
assert(status, 'IoP Remediations DB is not responding. ' \
|
17
|
+
'It needs to be up and running to perform the following steps',
|
18
|
+
:next_steps => start_pgsql)
|
19
|
+
else
|
20
|
+
feature(:iop_remediations_database).raise_psql_missing_error
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def start_pgsql
|
25
|
+
if feature(:iop_remediations_database).local?
|
26
|
+
[Procedures::Service::Start.new(:only => 'postgresql')]
|
27
|
+
else
|
28
|
+
[] # there is nothing we can do for remote db
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Checks
|
2
|
+
module IopVmaas
|
3
|
+
class DBUp < ForemanMaintain::Check
|
4
|
+
metadata do
|
5
|
+
description 'Make sure IoP Vmaas DB is up'
|
6
|
+
label :iop_vmaas_db_up
|
7
|
+
for_feature :iop_vmaas
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
status = false
|
12
|
+
if feature(:iop_vmaas_database).psql_cmd_available?
|
13
|
+
with_spinner('Checking connection to the IoP Vmaas DB') do
|
14
|
+
status = feature(:iop_vmaas_database).ping
|
15
|
+
end
|
16
|
+
assert(status, 'IoP Vmaas DB is not responding. ' \
|
17
|
+
'It needs to be up and running to perform the following steps',
|
18
|
+
:next_steps => start_pgsql)
|
19
|
+
else
|
20
|
+
feature(:iop_vmaas_database).raise_psql_missing_error
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def start_pgsql
|
25
|
+
if feature(:iop_vmaas_database).local?
|
26
|
+
[Procedures::Service::Start.new(:only => 'postgresql')]
|
27
|
+
else
|
28
|
+
[] # there is nothing we can do for remote db
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Checks
|
2
|
+
module IopVulnerability
|
3
|
+
class DBUp < ForemanMaintain::Check
|
4
|
+
metadata do
|
5
|
+
description 'Make sure IoP Vulnerability DB is up'
|
6
|
+
label :iop_vulnerability_db_up
|
7
|
+
for_feature :iop_vulnerability
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
status = false
|
12
|
+
if feature(:iop_vulnerability_database).psql_cmd_available?
|
13
|
+
with_spinner('Checking connection to the IoP Vulnerability DB') do
|
14
|
+
status = feature(:iop_vulnerability_database).ping
|
15
|
+
end
|
16
|
+
assert(status, 'IoP Vulnerability DB is not responding. ' \
|
17
|
+
'It needs to be up and running to perform the following steps',
|
18
|
+
:next_steps => start_pgsql)
|
19
|
+
else
|
20
|
+
feature(:iop_vulnerability_database).raise_psql_missing_error
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def start_pgsql
|
25
|
+
if feature(:iop_vulnerability_database).local?
|
26
|
+
[Procedures::Service::Start.new(:only => 'postgresql')]
|
27
|
+
else
|
28
|
+
[] # there is nothing we can do for remote db
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class Features::Iop < ForemanMaintain::Feature
|
2
|
+
metadata do
|
3
|
+
label :iop
|
4
|
+
|
5
|
+
confine do
|
6
|
+
File.exist?('/etc/containers/networks/iop-core-network.json') ||
|
7
|
+
File.exist?('/etc/containers/systemd/iop-core.network')
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def config_files
|
12
|
+
[
|
13
|
+
'/var/lib/kafka',
|
14
|
+
'/var/lib/vmaas',
|
15
|
+
]
|
16
|
+
end
|
17
|
+
|
18
|
+
# rubocop:disable Metrics/MethodLength
|
19
|
+
def services
|
20
|
+
[
|
21
|
+
system_service('iop-core-engine', 20),
|
22
|
+
system_service('iop-core-gateway', 20),
|
23
|
+
system_service('iop-core-host-inventory', 20),
|
24
|
+
system_service('iop-core-host-inventory-api', 20),
|
25
|
+
system_service('iop-core-host-inventory-migrate', 20),
|
26
|
+
system_service('iop-core-ingress', 20),
|
27
|
+
system_service('iop-core-kafka', 20),
|
28
|
+
system_service('iop-core-puptoo', 20),
|
29
|
+
system_service('iop-core-yuptoo', 20),
|
30
|
+
system_service('iop-service-advisor-backend-api', 20),
|
31
|
+
system_service('iop-service-advisor-backend-service', 20),
|
32
|
+
system_service('iop-service-remediations-api', 20),
|
33
|
+
system_service('iop-service-vmaas-reposcan', 20),
|
34
|
+
system_service('iop-service-vmaas-webapp-go', 20),
|
35
|
+
system_service('iop-service-vuln-dbupgrade', 20),
|
36
|
+
system_service('iop-service-vuln-evaluator-recalc', 20),
|
37
|
+
system_service('iop-service-vuln-evaluator-upload', 20),
|
38
|
+
system_service('iop-service-vuln-grouper', 20),
|
39
|
+
system_service('iop-service-vuln-listener', 20),
|
40
|
+
system_service('iop-service-vuln-manager', 20),
|
41
|
+
system_service('iop-service-vuln-taskomatic', 20),
|
42
|
+
system_service('iop-service-vuln-vmaas-sync', 20),
|
43
|
+
]
|
44
|
+
end
|
45
|
+
# rubocop:enable Metrics/MethodLength
|
46
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
class Features::IopAdvisorDatabase < ForemanMaintain::Feature
|
2
|
+
include ForemanMaintain::Concerns::BaseDatabase
|
3
|
+
|
4
|
+
metadata do
|
5
|
+
label :iop_advisor_database
|
6
|
+
|
7
|
+
confine do
|
8
|
+
File.exist?('/etc/containers/networks/iop-core-network.json') ||
|
9
|
+
File.exist?('/etc/containers/systemd/iop-core.network')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def configuration
|
14
|
+
@configuration || load_configuration
|
15
|
+
end
|
16
|
+
|
17
|
+
def services
|
18
|
+
[
|
19
|
+
system_service('postgresql', 10, :component => 'iop',
|
20
|
+
:db_feature => feature(:iop_advisor_database)),
|
21
|
+
]
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def load_configuration
|
27
|
+
podman_command = "podman exec iop-service-advisor-api bash -c 'env |grep DB_'"
|
28
|
+
podman_result = execute!(podman_command, merge_stderr: false).lines.map do |l|
|
29
|
+
l.strip.split('=')
|
30
|
+
end.to_h
|
31
|
+
|
32
|
+
db_host = if podman_result['ADVISOR_DB_HOST'].start_with?('/var/run/postgresql')
|
33
|
+
'localhost'
|
34
|
+
else
|
35
|
+
podman_result['ADVISOR_DB_HOST']
|
36
|
+
end
|
37
|
+
@configuration = {
|
38
|
+
'host' => db_host,
|
39
|
+
'port' => podman_result['ADVISOR_DB_PORT'],
|
40
|
+
'database' => podman_result['ADVISOR_DB_NAME'],
|
41
|
+
'password' => podman_result['ADVISOR_DB_PASSWORD'],
|
42
|
+
'username' => podman_result['ADVISOR_DB_USER'],
|
43
|
+
}
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
class Features::IopInventoryDatabase < ForemanMaintain::Feature
|
2
|
+
include ForemanMaintain::Concerns::BaseDatabase
|
3
|
+
|
4
|
+
metadata do
|
5
|
+
label :iop_inventory_database
|
6
|
+
|
7
|
+
confine do
|
8
|
+
File.exist?('/etc/containers/networks/iop-core-network.json') ||
|
9
|
+
File.exist?('/etc/containers/systemd/iop-core.network')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def configuration
|
14
|
+
@configuration || load_configuration
|
15
|
+
end
|
16
|
+
|
17
|
+
def services
|
18
|
+
[
|
19
|
+
system_service('postgresql', 10, :component => 'iop',
|
20
|
+
:db_feature => feature(:iop_inventory_database)),
|
21
|
+
]
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def load_configuration
|
27
|
+
podman_command = "podman exec iop-core-host-inventory bash -c 'env |grep INVENTORY_DB_'"
|
28
|
+
podman_result = execute!(podman_command, merge_stderr: false).lines.map do |l|
|
29
|
+
l.strip.split('=')
|
30
|
+
end.to_h
|
31
|
+
|
32
|
+
db_host = if podman_result['INVENTORY_DB_HOST'].start_with?('/var/run/postgresql')
|
33
|
+
'localhost'
|
34
|
+
else
|
35
|
+
podman_result['INVENTORY_DB_HOST']
|
36
|
+
end
|
37
|
+
@configuration = {
|
38
|
+
'host' => db_host,
|
39
|
+
'port' => podman_result['INVENTORY_DB_PORT'],
|
40
|
+
'database' => podman_result['INVENTORY_DB_NAME'],
|
41
|
+
'password' => podman_result['INVENTORY_DB_PASS'],
|
42
|
+
'username' => podman_result['INVENTORY_DB_USER'],
|
43
|
+
}
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
class Features::IopRemediationsDatabase < ForemanMaintain::Feature
|
2
|
+
include ForemanMaintain::Concerns::BaseDatabase
|
3
|
+
|
4
|
+
metadata do
|
5
|
+
label :iop_remediations_database
|
6
|
+
|
7
|
+
confine do
|
8
|
+
File.exist?('/etc/containers/networks/iop-core-network.json') ||
|
9
|
+
File.exist?('/etc/containers/systemd/iop-core.network')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def configuration
|
14
|
+
@configuration || load_configuration
|
15
|
+
end
|
16
|
+
|
17
|
+
def services
|
18
|
+
[
|
19
|
+
system_service('postgresql', 10, :component => 'iop',
|
20
|
+
:db_feature => feature(:iop_remediations_database)),
|
21
|
+
]
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def load_configuration
|
27
|
+
podman_command = "podman exec iop-service-remediations-api bash -c 'env |grep DB_'"
|
28
|
+
podman_result = execute!(podman_command, merge_stderr: false).lines.map do |l|
|
29
|
+
l.strip.split('=')
|
30
|
+
end.to_h
|
31
|
+
|
32
|
+
db_host = if podman_result['DB_HOST'].start_with?('/var/run/postgresql')
|
33
|
+
'localhost'
|
34
|
+
else
|
35
|
+
podman_result['DB_HOST']
|
36
|
+
end
|
37
|
+
@configuration = {
|
38
|
+
'host' => db_host,
|
39
|
+
'port' => podman_result['DB_PORT'],
|
40
|
+
'database' => podman_result['DB_DATABASE'],
|
41
|
+
'password' => podman_result['DB_PASSWORD'],
|
42
|
+
'username' => podman_result['DB_USERNAME'],
|
43
|
+
}
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
class Features::IopVmaasDatabase < ForemanMaintain::Feature
|
2
|
+
include ForemanMaintain::Concerns::BaseDatabase
|
3
|
+
|
4
|
+
metadata do
|
5
|
+
label :iop_vmaas_database
|
6
|
+
|
7
|
+
confine do
|
8
|
+
File.exist?('/etc/containers/networks/iop-core-network.json') ||
|
9
|
+
File.exist?('/etc/containers/systemd/iop-core.network')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def configuration
|
14
|
+
@configuration || load_configuration
|
15
|
+
end
|
16
|
+
|
17
|
+
def services
|
18
|
+
[
|
19
|
+
system_service('postgresql', 10, :component => 'iop',
|
20
|
+
:db_feature => feature(:iop_vmaas_database)),
|
21
|
+
]
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def load_configuration
|
27
|
+
podman_command = "podman exec iop-service-vmaas-reposcan bash -c 'env |grep POSTGRESQL_'"
|
28
|
+
podman_result = execute!(podman_command, merge_stderr: false).lines.map do |l|
|
29
|
+
l.strip.split('=')
|
30
|
+
end.to_h
|
31
|
+
|
32
|
+
db_host = if podman_result['POSTGRESQL_HOST'].start_with?('/var/run/postgresql')
|
33
|
+
'localhost'
|
34
|
+
else
|
35
|
+
podman_result['POSTGRESQL_HOST']
|
36
|
+
end
|
37
|
+
@configuration = {
|
38
|
+
'host' => db_host,
|
39
|
+
'port' => podman_result['POSTGRESQL_PORT'],
|
40
|
+
'database' => podman_result['POSTGRESQL_DATABASE'],
|
41
|
+
'password' => podman_result['POSTGRESQL_PASSWORD'],
|
42
|
+
'username' => podman_result['POSTGRESQL_USER'],
|
43
|
+
}
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
class Features::IopVulnerabilityDatabase < ForemanMaintain::Feature
|
2
|
+
include ForemanMaintain::Concerns::BaseDatabase
|
3
|
+
|
4
|
+
metadata do
|
5
|
+
label :iop_vulnerability_database
|
6
|
+
|
7
|
+
confine do
|
8
|
+
File.exist?('/etc/containers/networks/iop-core-network.json') ||
|
9
|
+
File.exist?('/etc/containers/systemd/iop-core.network')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def configuration
|
14
|
+
@configuration || load_configuration
|
15
|
+
end
|
16
|
+
|
17
|
+
def services
|
18
|
+
[
|
19
|
+
system_service('postgresql', 10, :component => 'iop',
|
20
|
+
:db_feature => feature(:iop_vulnerability_database)),
|
21
|
+
]
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def load_configuration
|
27
|
+
podman_command = "podman exec iop-service-vuln-manager bash -c 'env |grep POSTGRES_'"
|
28
|
+
podman_result = execute!(podman_command, merge_stderr: false).lines.map do |l|
|
29
|
+
l.strip.split('=')
|
30
|
+
end.to_h
|
31
|
+
|
32
|
+
db_host = if podman_result['POSTGRES_HOST'].start_with?('/var/run/postgresql')
|
33
|
+
'localhost'
|
34
|
+
else
|
35
|
+
podman_result['POSTGRES_HOST']
|
36
|
+
end
|
37
|
+
@configuration = {
|
38
|
+
'host' => db_host,
|
39
|
+
'port' => podman_result['POSTGRES_PORT'],
|
40
|
+
'database' => podman_result['POSTGRES_DB'],
|
41
|
+
'password' => podman_result['POSTGRES_PASSWORD'],
|
42
|
+
'username' => podman_result['POSTGRES_USER'],
|
43
|
+
}
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Procedures::Backup
|
2
|
+
module Online
|
3
|
+
class IopAdvisorDB < ForemanMaintain::Procedure
|
4
|
+
metadata do
|
5
|
+
description 'Backup IoP Advisor database'
|
6
|
+
tags :backup
|
7
|
+
label :backup_online_iop_advisor_db
|
8
|
+
for_feature :iop_advisor_database
|
9
|
+
preparation_steps { Checks::IopAdvisor::DBUp.new }
|
10
|
+
param :backup_dir, 'Directory where to backup to', :required => true
|
11
|
+
end
|
12
|
+
|
13
|
+
def run
|
14
|
+
with_spinner('Getting IoP Advisor DB dump') do
|
15
|
+
feature(:iop_advisor_database).dump_db(File.join(@backup_dir, 'iop_advisor.dump'))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Procedures::Backup
|
2
|
+
module Online
|
3
|
+
class IopInventoryDB < ForemanMaintain::Procedure
|
4
|
+
metadata do
|
5
|
+
description 'Backup IoP Inventory database'
|
6
|
+
tags :backup
|
7
|
+
label :backup_online_iop_inventory_db
|
8
|
+
for_feature :iop_inventory_database
|
9
|
+
preparation_steps { Checks::IopInventory::DBUp.new }
|
10
|
+
param :backup_dir, 'Directory where to backup to', :required => true
|
11
|
+
end
|
12
|
+
|
13
|
+
def run
|
14
|
+
with_spinner('Getting IoP Inventory DB dump') do
|
15
|
+
feature(:iop_inventory_database).dump_db(File.join(@backup_dir, 'iop_inventory.dump'))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Procedures::Backup
|
2
|
+
module Online
|
3
|
+
class IopRemediationsDB < ForemanMaintain::Procedure
|
4
|
+
metadata do
|
5
|
+
description 'Backup IoP Remediations database'
|
6
|
+
tags :backup
|
7
|
+
label :backup_online_iop_remediations_db
|
8
|
+
for_feature :iop_remediations_database
|
9
|
+
preparation_steps { Checks::IopRemediations::DBUp.new }
|
10
|
+
param :backup_dir, 'Directory where to backup to', :required => true
|
11
|
+
end
|
12
|
+
|
13
|
+
def run
|
14
|
+
with_spinner('Getting IoP Remediations DB dump') do
|
15
|
+
feature(:iop_remediations_database).dump_db(File.join(@backup_dir,
|
16
|
+
'iop_remediations.dump'))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Procedures::Backup
|
2
|
+
module Online
|
3
|
+
class IopVmaasDB < ForemanMaintain::Procedure
|
4
|
+
metadata do
|
5
|
+
description 'Backup IoP Vmaas database'
|
6
|
+
tags :backup
|
7
|
+
label :backup_online_iop_vmaas_db
|
8
|
+
for_feature :iop_vmaas_database
|
9
|
+
preparation_steps { Checks::IopVmaas::DBUp.new }
|
10
|
+
param :backup_dir, 'Directory where to backup to', :required => true
|
11
|
+
end
|
12
|
+
|
13
|
+
def run
|
14
|
+
with_spinner('Getting IoP Vmaas DB dump') do
|
15
|
+
feature(:iop_vmaas_database).dump_db(File.join(@backup_dir, 'iop_vmaas.dump'))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Procedures::Backup
|
2
|
+
module Online
|
3
|
+
class IopVulnerabilityDB < ForemanMaintain::Procedure
|
4
|
+
metadata do
|
5
|
+
description 'Backup IoP Vulnerability database'
|
6
|
+
tags :backup
|
7
|
+
label :backup_online_iop_vulnerability_db
|
8
|
+
for_feature :iop_vulnerability_database
|
9
|
+
preparation_steps { Checks::IopVulnerability::DBUp.new }
|
10
|
+
param :backup_dir, 'Directory where to backup to', :required => true
|
11
|
+
end
|
12
|
+
|
13
|
+
def run
|
14
|
+
with_spinner('Getting IoP Vulnerability DB dump') do
|
15
|
+
feature(:iop_vulnerability_database).dump_db(File.join(@backup_dir,
|
16
|
+
'iop_vulnerability.dump'))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -8,7 +8,12 @@ module Procedures::Restore
|
|
8
8
|
:required => true
|
9
9
|
|
10
10
|
confine do
|
11
|
-
feature(:foreman_database) || feature(:candlepin_database) || feature(:pulpcore_database)
|
11
|
+
feature(:foreman_database) || feature(:candlepin_database) || feature(:pulpcore_database) ||
|
12
|
+
feature(:iop_advisor_database) ||
|
13
|
+
feature(:iop_inventory_database) ||
|
14
|
+
feature(:iop_remediations_database) ||
|
15
|
+
feature(:iop_vmaas_database) ||
|
16
|
+
feature(:iop_vulnerability_database)
|
12
17
|
end
|
13
18
|
end
|
14
19
|
|
@@ -20,6 +25,11 @@ module Procedures::Restore
|
|
20
25
|
drop_foreman(backup, spinner)
|
21
26
|
drop_candlepin(backup, spinner)
|
22
27
|
drop_pulpcore(backup, spinner)
|
28
|
+
drop_iop_advisor(backup, spinner)
|
29
|
+
drop_iop_inventory(backup, spinner)
|
30
|
+
drop_iop_remediations(backup, spinner)
|
31
|
+
drop_iop_vmaas(backup, spinner)
|
32
|
+
drop_iop_vulnerability(backup, spinner)
|
23
33
|
end
|
24
34
|
end
|
25
35
|
|
@@ -43,5 +53,40 @@ module Procedures::Restore
|
|
43
53
|
feature(:pulpcore_database).dropdb
|
44
54
|
end
|
45
55
|
end
|
56
|
+
|
57
|
+
def drop_iop_advisor(backup, spinner)
|
58
|
+
if backup.file_map[:iop_advisor_dump][:present]
|
59
|
+
spinner.update('Dropping iop_advisor database')
|
60
|
+
feature(:iop_advisor_database).dropdb
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def drop_iop_inventory(backup, spinner)
|
65
|
+
if backup.file_map[:iop_inventory_dump][:present]
|
66
|
+
spinner.update('Dropping iop_inventory database')
|
67
|
+
feature(:iop_inventory_database).dropdb
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def drop_iop_remediations(backup, spinner)
|
72
|
+
if backup.file_map[:iop_remediations_dump][:present]
|
73
|
+
spinner.update('Dropping iop_remediations database')
|
74
|
+
feature(:iop_remediations_database).dropdb
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def drop_iop_vmaas(backup, spinner)
|
79
|
+
if backup.file_map[:iop_vmaas_dump][:present]
|
80
|
+
spinner.update('Dropping iop_vmaas database')
|
81
|
+
feature(:iop_vmaas_database).dropdb
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def drop_iop_vulnerability(backup, spinner)
|
86
|
+
if backup.file_map[:iop_vulnerability_dump][:present]
|
87
|
+
spinner.update('Dropping iop_vulnerability database')
|
88
|
+
feature(:iop_vulnerability_database).dropdb
|
89
|
+
end
|
90
|
+
end
|
46
91
|
end
|
47
92
|
end
|