foreman_maintain 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/definitions/procedures/backup/snapshot/snapshot_deprecation_message.rb +14 -0
- data/definitions/procedures/packages/check_for_reboot.rb +16 -0
- data/definitions/scenarios/backup.rb +9 -2
- data/definitions/scenarios/puppet.rb +0 -3
- data/definitions/scenarios/upgrade_to_capsule_6_15.rb +1 -0
- data/definitions/scenarios/upgrade_to_capsule_6_15_z.rb +1 -0
- data/definitions/scenarios/upgrade_to_satellite_6_15.rb +1 -0
- data/definitions/scenarios/upgrade_to_satellite_6_15_z.rb +1 -0
- data/extras/foreman_protector/foreman-protector.whitelist +16 -0
- data/lib/foreman_maintain/cli/backup_command.rb +1 -1
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +8 -7
- data/definitions/checks/check_for_newer_packages.rb +0 -67
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d37937d8bc4cbf619ea0e654e6826ae92a96ecd74f1b260e5b402df7bcbdc68
|
4
|
+
data.tar.gz: a0fcf7a0f6802f7547c26d640650ac29cafa3568f7fdbc648f31d3dbdbcf6a72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bab8216e974e96128a5f0fb88a201d1c8dd9da13d71b89efea76337c242f6459285e8af8a8dbcacbaa318f402c1b26cc7056e5e1d976946b8939f13bbaa4fda
|
7
|
+
data.tar.gz: 59772c9b2ec381408458383f4e06bafb8bb3998f5c4cea60be7a2dc2a254803896a05aa2858aad48f34e54185b7db6a455534cafa5f671b6a52a69bbe0b07e74
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Procedures::Backup
|
2
|
+
module Snapshot
|
3
|
+
class SnapshotDeprecationMessage < ForemanMaintain::Procedure
|
4
|
+
metadata do
|
5
|
+
description 'Snapshot backups are deprecated'
|
6
|
+
tags :backup
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
set_warn('Snapshot backups are deprecated and will be removed in a future version.')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Procedures::Packages
|
2
|
+
class CheckForReboot < ForemanMaintain::Procedure
|
3
|
+
metadata do
|
4
|
+
description 'Check if system needs reboot'
|
5
|
+
end
|
6
|
+
|
7
|
+
def run
|
8
|
+
status, output = execute_with_status('dnf needs-restarting --reboothint')
|
9
|
+
if status == 1
|
10
|
+
set_status(:warning, output)
|
11
|
+
else
|
12
|
+
set_status(:success, output)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -20,7 +20,8 @@ module ForemanMaintain::Scenarios
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def compose
|
23
|
-
|
23
|
+
check_valid_strategy
|
24
|
+
snapshot_deprecation_warning
|
24
25
|
safety_confirmation
|
25
26
|
accessibility_confirmation
|
26
27
|
prepare_directory
|
@@ -110,6 +111,12 @@ module ForemanMaintain::Scenarios
|
|
110
111
|
end
|
111
112
|
end
|
112
113
|
|
114
|
+
def snapshot_deprecation_warning
|
115
|
+
if strategy == :snapshot
|
116
|
+
add_step_with_context(Procedures::Backup::Snapshot::SnapshotDeprecationMessage)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
113
120
|
def accessibility_confirmation
|
114
121
|
if [:offline, :snapshot].include?(strategy)
|
115
122
|
add_step_with_context(Procedures::Backup::AccessibilityConfirmation)
|
@@ -122,7 +129,7 @@ module ForemanMaintain::Scenarios
|
|
122
129
|
end
|
123
130
|
end
|
124
131
|
|
125
|
-
def
|
132
|
+
def check_valid_strategy
|
126
133
|
unless [:online, :offline, :snapshot].include? strategy
|
127
134
|
raise ArgumentError, "Unsupported strategy '#{strategy}'"
|
128
135
|
end
|
@@ -15,9 +15,6 @@ module ForemanMaintain::Scenarios
|
|
15
15
|
add_step(Procedures::Puppet::RemovePuppet)
|
16
16
|
add_step(Procedures::Puppet::RemovePuppetData) if context.get(:remove_data)
|
17
17
|
add_step(Procedures::Service::Restart)
|
18
|
-
if server?
|
19
|
-
add_step(Procedures::Foreman::ApipieCache)
|
20
|
-
end
|
21
18
|
end
|
22
19
|
end
|
23
20
|
end
|
@@ -39,5 +39,21 @@ python3-firewall
|
|
39
39
|
python3-nftables
|
40
40
|
python3-slip
|
41
41
|
python3-slip-dbus
|
42
|
+
# pcp
|
43
|
+
pcp
|
44
|
+
pcp-conf
|
45
|
+
pcp-libs
|
46
|
+
pcp-pmda-apache
|
47
|
+
pcp-pmda-openmetrics
|
48
|
+
pcp-pmda-postgresql
|
49
|
+
pcp-pmda-redis
|
50
|
+
pcp-system-tools
|
51
|
+
python3-pcp
|
52
|
+
grafana
|
53
|
+
grafana-pcp
|
42
54
|
# foreman-maintain
|
43
55
|
rubygem-foreman_maintain
|
56
|
+
# fapolicyd
|
57
|
+
fapolicyd
|
58
|
+
foreman-fapolicyd
|
59
|
+
foreman-proxy-fapolicyd
|
@@ -155,7 +155,7 @@ module ForemanMaintain
|
|
155
155
|
class BackupCommand < Base
|
156
156
|
subcommand 'online', 'Keep services online during backup', OnlineBackupCommand
|
157
157
|
subcommand 'offline', 'Shut down services to preserve consistent backup', OfflineBackupCommand
|
158
|
-
subcommand 'snapshot', 'Use snapshots of the databases to create backup', SnapshotBackupCommand
|
158
|
+
subcommand 'snapshot', 'Use snapshots of the databases to create backup (DEPRECATED)', SnapshotBackupCommand
|
159
159
|
end
|
160
160
|
# rubocop:enable Metrics/LineLength
|
161
161
|
end
|
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: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Nečas
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -159,7 +159,6 @@ files:
|
|
159
159
|
- config/hammer.yml.example
|
160
160
|
- definitions/checks/backup/certs_tar_exist.rb
|
161
161
|
- definitions/checks/candlepin/db_up.rb
|
162
|
-
- definitions/checks/check_for_newer_packages.rb
|
163
162
|
- definitions/checks/check_hotfix_installed.rb
|
164
163
|
- definitions/checks/check_tmout.rb
|
165
164
|
- definitions/checks/disk/available_space.rb
|
@@ -251,6 +250,7 @@ files:
|
|
251
250
|
- definitions/procedures/backup/snapshot/mount_pulp.rb
|
252
251
|
- definitions/procedures/backup/snapshot/mount_pulpcore_db.rb
|
253
252
|
- definitions/procedures/backup/snapshot/prepare_mount.rb
|
253
|
+
- definitions/procedures/backup/snapshot/snapshot_deprecation_message.rb
|
254
254
|
- definitions/procedures/crond/start.rb
|
255
255
|
- definitions/procedures/crond/stop.rb
|
256
256
|
- definitions/procedures/files/remove.rb
|
@@ -273,6 +273,7 @@ files:
|
|
273
273
|
- definitions/procedures/maintenance_mode/disable_maintenance_mode.rb
|
274
274
|
- definitions/procedures/maintenance_mode/enable_maintenance_mode.rb
|
275
275
|
- definitions/procedures/maintenance_mode/is_enabled.rb
|
276
|
+
- definitions/procedures/packages/check_for_reboot.rb
|
276
277
|
- definitions/procedures/packages/check_update.rb
|
277
278
|
- definitions/procedures/packages/enable_modules.rb
|
278
279
|
- definitions/procedures/packages/install.rb
|
@@ -424,7 +425,7 @@ homepage: https://github.com/theforeman/foreman_maintain
|
|
424
425
|
licenses:
|
425
426
|
- GPL-3.0
|
426
427
|
metadata: {}
|
427
|
-
post_install_message:
|
428
|
+
post_install_message:
|
428
429
|
rdoc_options: []
|
429
430
|
require_paths:
|
430
431
|
- lib
|
@@ -442,8 +443,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
442
443
|
- !ruby/object:Gem::Version
|
443
444
|
version: '0'
|
444
445
|
requirements: []
|
445
|
-
rubygems_version: 3.
|
446
|
-
signing_key:
|
446
|
+
rubygems_version: 3.3.26
|
447
|
+
signing_key:
|
447
448
|
specification_version: 4
|
448
449
|
summary: Foreman maintenance tool belt
|
449
450
|
test_files: []
|
@@ -1,67 +0,0 @@
|
|
1
|
-
class Checks::CheckForNewerPackages < ForemanMaintain::Check
|
2
|
-
metadata do
|
3
|
-
label :check_for_newer_packages
|
4
|
-
description 'Check for newer packages and optionally ask for confirmation if not found.'
|
5
|
-
|
6
|
-
param :packages,
|
7
|
-
'package names to validate',
|
8
|
-
:required => true
|
9
|
-
param :manual_confirmation_version,
|
10
|
-
'Version of satellite to ask the user if they are on the latest minor release of.',
|
11
|
-
:required => false
|
12
|
-
manual_detection
|
13
|
-
end
|
14
|
-
|
15
|
-
def run
|
16
|
-
check_for_package_update
|
17
|
-
if @manual_confirmation_version
|
18
|
-
question = 'Confirm that you are running the latest minor release of Satellite '\
|
19
|
-
"#{@manual_confirmation_version}"
|
20
|
-
answer = ask_decision(question, actions_msg: 'y(yes), q(quit)')
|
21
|
-
abort! if answer != :yes
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def check_for_package_update
|
26
|
-
exit_status, output = ForemanMaintain.package_manager.check_update(packages: @packages,
|
27
|
-
with_status: true)
|
28
|
-
packages_with_updates = []
|
29
|
-
if exit_status == 100
|
30
|
-
packages_with_updates = compare_pkg_versions(output).select do |_, result|
|
31
|
-
result == -1
|
32
|
-
end.keys
|
33
|
-
end
|
34
|
-
|
35
|
-
unless packages_with_updates.empty?
|
36
|
-
command = ForemanMaintain.pkg_and_cmd_name[1]
|
37
|
-
fail! 'Required updates for some packages detected.'\
|
38
|
-
"\nPlease update to the latest #{@manual_confirmation_version}.z release "\
|
39
|
-
'before proceeding, using:'\
|
40
|
-
"\n# #{command} upgrade run --target-version #{@manual_confirmation_version}.z"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def packages_and_versions(output)
|
45
|
-
pkgs_versions = {}
|
46
|
-
pkg_details = output.split("\n\n")[1].split
|
47
|
-
@packages.each do |pkg|
|
48
|
-
pkg_details.each_with_index do |ele, index|
|
49
|
-
next unless ele.start_with?(pkg)
|
50
|
-
pkgs_versions[pkg] = version(pkg_details[index + 1].split('-').first)
|
51
|
-
break
|
52
|
-
end
|
53
|
-
end
|
54
|
-
pkgs_versions
|
55
|
-
end
|
56
|
-
|
57
|
-
def compare_pkg_versions(output)
|
58
|
-
compare_pkg_versions = {}
|
59
|
-
packages_and_versions = packages_and_versions(output)
|
60
|
-
pkg_versions610 = { 'python3-pulp-2to3-migration' => version('0.12'),
|
61
|
-
'tfm-rubygem-katello' => version('4.1') }
|
62
|
-
packages_and_versions.each do |name, version|
|
63
|
-
compare_pkg_versions[name] = version.<=>(pkg_versions610[name])
|
64
|
-
end
|
65
|
-
compare_pkg_versions
|
66
|
-
end
|
67
|
-
end
|