foreman_maintain 1.4.1 → 1.4.3
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/katello_agent.rb +41 -0
- 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/concerns/primary_checks.rb +2 -1
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +9 -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: 2d9b46e0f2566916075ef7ec1972734f31919fafaa10ce814a2e5006ece9ab62
|
4
|
+
data.tar.gz: 989952ede4062aaba32b380a5226b63e9aaa0c22ffbf34b79bc80a153a0b0920
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9a380eb151bfadbbba33824d438dc69fe47732cf3219af14b8e78ebcb2bb8dd5ba590fc9887d936aa1eb662e644f8e085a39c2023a71e5d3d975075d37a57bb
|
7
|
+
data.tar.gz: 7725d0d13f08191822fbda79b828498d8b064a984ca8d38a841d1e400768ec6c530ea8d99c94ea35f6a62ac547455de32a9d4048d06a3d4a953fd065908385d1
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
class Checks::CheckKatelloAgentEnabled < ForemanMaintain::Check
|
4
|
+
metadata do
|
5
|
+
label :check_katello_agent_enabled
|
6
|
+
description 'Check whether the katello-agent feature is enabled before upgrading'
|
7
|
+
tags :pre_upgrade
|
8
|
+
|
9
|
+
confine do
|
10
|
+
!feature(:capsule)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def run
|
15
|
+
instance_name = feature(:instance).downstream ? "Satellite" : "Katello"
|
16
|
+
instance_version = feature(:instance).downstream ? "6.15" : "4.10"
|
17
|
+
installer_command = feature(:instance).downstream ? "satellite-installer" : "foreman-installer"
|
18
|
+
maintain_command = feature(:instance).downstream ? "satellite-maintain" : "foreman-maintain"
|
19
|
+
|
20
|
+
assert(
|
21
|
+
!katello_agent_enabled?,
|
22
|
+
"The katello-agent feature is enabled on this system. As of #{instance_name}"\
|
23
|
+
" #{instance_version}, katello-agent is removed and will no longer function."\
|
24
|
+
" Before proceeding with the upgrade, you should ensure that you have deployed"\
|
25
|
+
" and configured an alternative tool for remote package management and patching"\
|
26
|
+
" for content hosts, such as Remote Execution (REX) with pull-based transport."\
|
27
|
+
" See the Managing Hosts guide in the #{instance_name} documentation for more info."\
|
28
|
+
" Disable katello-agent with the command"\
|
29
|
+
" `#{installer_command} --foreman-proxy-content-enable-katello-agent false`"\
|
30
|
+
" before proceeding with the upgrade. Alternatively, you may skip this check and proceed by"\
|
31
|
+
" running #{maintain_command} again with the `--whitelist` option, which will automatically"\
|
32
|
+
" uninstall katello-agent."
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def katello_agent_enabled?
|
39
|
+
feature(:installer).answers['foreman_proxy_content']['enable_katello_agent']
|
40
|
+
end
|
41
|
+
end
|
@@ -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
|
@@ -2,7 +2,8 @@ module ForemanMaintain
|
|
2
2
|
module Concerns
|
3
3
|
module PrimaryChecks
|
4
4
|
def validate_downstream_packages
|
5
|
-
return unless detector.feature(:installer)
|
5
|
+
return unless detector.feature(:installer)
|
6
|
+
|
6
7
|
if (package = package_name) && !package_manager.installed?(package)
|
7
8
|
raise ForemanMaintain::Error::Fail,
|
8
9
|
"Error: Important rpm package #{package} is not installed!"\
|
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.3
|
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-
|
11
|
+
date: 2023-11-06 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
|
@@ -182,6 +181,7 @@ files:
|
|
182
181
|
- definitions/checks/foreman_tasks/invalid/check_planning_state.rb
|
183
182
|
- definitions/checks/foreman_tasks/not_paused.rb
|
184
183
|
- definitions/checks/foreman_tasks/not_running.rb
|
184
|
+
- definitions/checks/katello_agent.rb
|
185
185
|
- definitions/checks/maintenance_mode/check_consistency.rb
|
186
186
|
- definitions/checks/non_rh_packages.rb
|
187
187
|
- definitions/checks/package_manager/dnf/validate_dnf_config.rb
|
@@ -251,6 +251,7 @@ files:
|
|
251
251
|
- definitions/procedures/backup/snapshot/mount_pulp.rb
|
252
252
|
- definitions/procedures/backup/snapshot/mount_pulpcore_db.rb
|
253
253
|
- definitions/procedures/backup/snapshot/prepare_mount.rb
|
254
|
+
- definitions/procedures/backup/snapshot/snapshot_deprecation_message.rb
|
254
255
|
- definitions/procedures/crond/start.rb
|
255
256
|
- definitions/procedures/crond/stop.rb
|
256
257
|
- definitions/procedures/files/remove.rb
|
@@ -273,6 +274,7 @@ files:
|
|
273
274
|
- definitions/procedures/maintenance_mode/disable_maintenance_mode.rb
|
274
275
|
- definitions/procedures/maintenance_mode/enable_maintenance_mode.rb
|
275
276
|
- definitions/procedures/maintenance_mode/is_enabled.rb
|
277
|
+
- definitions/procedures/packages/check_for_reboot.rb
|
276
278
|
- definitions/procedures/packages/check_update.rb
|
277
279
|
- definitions/procedures/packages/enable_modules.rb
|
278
280
|
- definitions/procedures/packages/install.rb
|
@@ -424,7 +426,7 @@ homepage: https://github.com/theforeman/foreman_maintain
|
|
424
426
|
licenses:
|
425
427
|
- GPL-3.0
|
426
428
|
metadata: {}
|
427
|
-
post_install_message:
|
429
|
+
post_install_message:
|
428
430
|
rdoc_options: []
|
429
431
|
require_paths:
|
430
432
|
- lib
|
@@ -442,8 +444,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
442
444
|
- !ruby/object:Gem::Version
|
443
445
|
version: '0'
|
444
446
|
requirements: []
|
445
|
-
rubygems_version: 3.
|
446
|
-
signing_key:
|
447
|
+
rubygems_version: 3.3.26
|
448
|
+
signing_key:
|
447
449
|
specification_version: 4
|
448
450
|
summary: Foreman maintenance tool belt
|
449
451
|
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
|