foreman_maintain 1.0.8 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/definitions/checks/package_manager/yum/validate_yum_config.rb +1 -3
- data/definitions/features/installer.rb +3 -1
- data/definitions/features/nftables.rb +5 -3
- data/definitions/features/puppet_server.rb +0 -2
- data/definitions/procedures/content/prepare.rb +1 -0
- data/definitions/procedures/content/switchover.rb +1 -0
- data/definitions/procedures/foreman/apipie_cache.rb +1 -1
- data/definitions/procedures/restore/candlepin_reset_migrations.rb +14 -0
- data/definitions/scenarios/puppet.rb +1 -0
- data/definitions/scenarios/restore.rb +2 -1
- data/definitions/scenarios/self_upgrade.rb +12 -2
- data/lib/foreman_maintain/concerns/firewall/nftables_maintenance_mode.rb +3 -3
- data/lib/foreman_maintain/concerns/metadata.rb +4 -0
- data/lib/foreman_maintain/reporter/cli_reporter.rb +24 -6
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +3 -3
- data/definitions/procedures/packages/enable_version_locking.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27d440b036591f10b20bfde591adfe573d8d48602c40a76791e9fe5fde2eb0a6
|
4
|
+
data.tar.gz: ed71b8df8d073dc8c0607a8b2fdb95926a659033ce5f97b6e01d24a3f1d0916d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e5b7682a945427963ce4931e2980e49b29633e53f6f3d6172e482a6eb6fe11c84b5f600f00195e6bfd66ba083e359ee811ab75196ffc9af6e096d36f52d0b7d
|
7
|
+
data.tar.gz: 3d4f6b27203254baeafb5f077569b4062c8ab96ee383595f3dd3dbc6acdb0849a68103a959e4306c3e05986c9cf9a3cc5b134726067bdb12e4c02553025f0978
|
@@ -41,9 +41,7 @@ module Checks::PackageManager
|
|
41
41
|
|
42
42
|
def yum_config_options
|
43
43
|
@yum_config_options ||= {
|
44
|
-
'exclude' => '^exclude\s*=\s*\S+.*$'
|
45
|
-
'clean_requirements_on_remove' =>
|
46
|
-
'^clean_requirements_on_remove\s*=\S*(1|yes|true)$'
|
44
|
+
'exclude' => '^exclude\s*=\s*\S+.*$'
|
47
45
|
}
|
48
46
|
end
|
49
47
|
end
|
@@ -64,7 +64,9 @@ class Features::Installer < ForemanMaintain::Feature
|
|
64
64
|
def config_files
|
65
65
|
Dir.glob(File.join(config_directory, '**/*')) +
|
66
66
|
[
|
67
|
-
'/usr/local/bin/validate_postgresql_connection.sh'
|
67
|
+
'/usr/local/bin/validate_postgresql_connection.sh',
|
68
|
+
'/opt/puppetlabs/puppet/cache/foreman_cache_data',
|
69
|
+
'/opt/puppetlabs/puppet/cache/pulpcore_cache_data'
|
68
70
|
]
|
69
71
|
end
|
70
72
|
|
@@ -25,12 +25,14 @@ class Features::Nftables < ForemanMaintain::Feature
|
|
25
25
|
execute!("nft add chain #{family} #{table} #{chain} #{chain_options}")
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
28
|
+
def add_rules(options = {})
|
29
29
|
family = options.fetch(:family, ip_family)
|
30
30
|
table = options.fetch(:table, table_name)
|
31
31
|
chain = options.fetch(:chain, chain_name)
|
32
|
-
|
33
|
-
|
32
|
+
rules = options.fetch(:rules) # needs validation
|
33
|
+
rules.each do |rule|
|
34
|
+
execute!("nft add rule #{family} #{table} #{chain} #{rule}")
|
35
|
+
end
|
34
36
|
end
|
35
37
|
|
36
38
|
def table_exist?(name = table_name)
|
@@ -11,8 +11,6 @@ class Features::PuppetServer < ForemanMaintain::Feature
|
|
11
11
|
[
|
12
12
|
'/etc/puppet',
|
13
13
|
'/etc/puppetlabs',
|
14
|
-
'/opt/puppetlabs/puppet/cache/foreman_cache_data',
|
15
|
-
'/var/lib/puppet/foreman_cache_data',
|
16
14
|
'/opt/puppetlabs/puppet/ssl/',
|
17
15
|
'/var/lib/puppet/ssl',
|
18
16
|
'/var/lib/puppet',
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Procedures::Restore
|
2
|
+
class CandlepinResetMigrations < ForemanMaintain::Procedure
|
3
|
+
metadata do
|
4
|
+
description 'Ensure Candlepin runs all migrations after restoring the database'
|
5
|
+
confine do
|
6
|
+
feature(:candlepin_database)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def run
|
11
|
+
FileUtils.rm_f('/var/lib/candlepin/.puppet-candlepin-rpm-version')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -15,6 +15,7 @@ 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
|
+
add_step(Procedures::Foreman::ApipieCache)
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
@@ -46,7 +46,8 @@ module ForemanMaintain::Scenarios
|
|
46
46
|
end
|
47
47
|
restore_mongo_dump(backup)
|
48
48
|
add_steps_with_context(Procedures::Pulp::Migrate,
|
49
|
-
Procedures::Pulpcore::Migrate
|
49
|
+
Procedures::Pulpcore::Migrate,
|
50
|
+
Procedures::Restore::CandlepinResetMigrations)
|
50
51
|
|
51
52
|
add_steps_with_context(Procedures::Restore::RegenerateQueues) if backup.online_backup?
|
52
53
|
add_steps_with_context(Procedures::Service::Start,
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module ForemanMaintain::Scenarios
|
2
2
|
class SelfUpgradeBase < ForemanMaintain::Scenario
|
3
|
+
include ForemanMaintain::Concerns::Downstream
|
3
4
|
def enabled_system_repos_id
|
4
5
|
repository_manager.enabled_repos.keys
|
5
6
|
end
|
@@ -67,7 +68,10 @@ module ForemanMaintain::Scenarios
|
|
67
68
|
|
68
69
|
def repos_ids_to_reenable
|
69
70
|
repos_ids_to_reenable = stored_enabled_repos_ids - all_maintenance_repos
|
70
|
-
|
71
|
+
if use_rhsm?
|
72
|
+
repos_ids_to_reenable << maintenance_repo(maintenance_repo_version)
|
73
|
+
end
|
74
|
+
repos_ids_to_reenable
|
71
75
|
end
|
72
76
|
|
73
77
|
def use_rhsm?
|
@@ -79,6 +83,10 @@ module ForemanMaintain::Scenarios
|
|
79
83
|
|
80
84
|
true
|
81
85
|
end
|
86
|
+
|
87
|
+
def req_repos_to_update_pkgs
|
88
|
+
main_rh_repos + [maintenance_repo_id(target_version)]
|
89
|
+
end
|
82
90
|
end
|
83
91
|
|
84
92
|
class SelfUpgrade < SelfUpgradeBase
|
@@ -94,9 +102,10 @@ module ForemanMaintain::Scenarios
|
|
94
102
|
pkgs_to_update = %w[satellite-maintain rubygem-foreman_maintain]
|
95
103
|
add_step(Procedures::Repositories::BackupEnabledRepos.new)
|
96
104
|
disable_repos
|
97
|
-
add_step(Procedures::Repositories::Enable.new(repos:
|
105
|
+
add_step(Procedures::Repositories::Enable.new(repos: req_repos_to_update_pkgs,
|
98
106
|
use_rhsm: use_rhsm?))
|
99
107
|
add_step(Procedures::Packages::Update.new(packages: pkgs_to_update, assumeyes: true))
|
108
|
+
disable_repos('*')
|
100
109
|
enable_repos(repos_ids_to_reenable)
|
101
110
|
end
|
102
111
|
end
|
@@ -113,6 +122,7 @@ module ForemanMaintain::Scenarios
|
|
113
122
|
|
114
123
|
def compose
|
115
124
|
if check_min_version('foreman', '2.5') || check_min_version('foreman-proxy', '2.5')
|
125
|
+
disable_repos('*')
|
116
126
|
enable_repos(repos_ids_to_reenable)
|
117
127
|
end
|
118
128
|
end
|
@@ -10,7 +10,7 @@ module ForemanMaintain
|
|
10
10
|
unless table_exist?
|
11
11
|
add_table
|
12
12
|
add_chain(:chain_options => nftables_chain_options)
|
13
|
-
|
13
|
+
add_rules(rules: nftables_rules)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -22,8 +22,8 @@ module ForemanMaintain
|
|
22
22
|
'{type filter hook input priority 0\\;}'
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
'tcp dport
|
25
|
+
def nftables_rules
|
26
|
+
['iifname "lo" accept', 'tcp dport 443 reject']
|
27
27
|
end
|
28
28
|
|
29
29
|
def status_for_maintenance_mode
|
@@ -100,6 +100,10 @@ module ForemanMaintain
|
|
100
100
|
@data[:advanced_run] = advanced_run
|
101
101
|
end
|
102
102
|
|
103
|
+
def do_not_whitelist
|
104
|
+
@data[:do_not_whitelist] = true
|
105
|
+
end
|
106
|
+
|
103
107
|
def self.eval_dsl(metadata, &block)
|
104
108
|
new(metadata).tap do |dsl|
|
105
109
|
dsl.instance_eval(&block)
|
@@ -317,7 +317,11 @@ module ForemanMaintain
|
|
317
317
|
|
318
318
|
steps_with_error = scenario.steps_with_error(:whitelisted => false)
|
319
319
|
steps_with_skipped = scenario.steps_with_skipped(:whitelisted => true)
|
320
|
-
|
320
|
+
not_skippable_steps = scenario.steps_with_error.select do |step|
|
321
|
+
step.metadata[:do_not_whitelist] == true
|
322
|
+
end
|
323
|
+
|
324
|
+
steps_to_whitelist = steps_with_error + steps_with_skipped - not_skippable_steps
|
321
325
|
unless steps_with_error.empty?
|
322
326
|
message << format(<<-MESSAGE.strip_heredoc, format_steps(steps_with_error, "\n", 2))
|
323
327
|
The following steps ended up in failing state:
|
@@ -325,11 +329,25 @@ module ForemanMaintain
|
|
325
329
|
%s
|
326
330
|
MESSAGE
|
327
331
|
whitelist_labels = steps_to_whitelist.map(&:label_dashed).join(',')
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
332
|
+
unless whitelist_labels.empty?
|
333
|
+
recommend << if scenario.detector.feature(:instance).downstream
|
334
|
+
format(<<-MESSAGE.strip_heredoc, whitelist_labels)
|
335
|
+
Resolve the failed steps and rerun the command.
|
336
|
+
|
337
|
+
If the situation persists and, you are unclear what to do next,
|
338
|
+
contact Red Hat Technical Support.
|
339
|
+
|
340
|
+
In case the failures are false positives, use
|
341
|
+
--whitelist="%s"
|
342
|
+
MESSAGE
|
343
|
+
else
|
344
|
+
format(<<-MESSAGE.strip_heredoc, whitelist_labels)
|
345
|
+
Resolve the failed steps and rerun the command.
|
346
|
+
In case the failures are false positives, use
|
347
|
+
--whitelist="%s"
|
348
|
+
MESSAGE
|
349
|
+
end
|
350
|
+
end
|
333
351
|
end
|
334
352
|
|
335
353
|
steps_with_warning = scenario.steps_with_warning(:whitelisted => false)
|
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.0.
|
4
|
+
version: 1.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Nečas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -273,7 +273,6 @@ files:
|
|
273
273
|
- definitions/procedures/maintenance_mode/enable_maintenance_mode.rb
|
274
274
|
- definitions/procedures/maintenance_mode/is_enabled.rb
|
275
275
|
- definitions/procedures/packages/check_update.rb
|
276
|
-
- definitions/procedures/packages/enable_version_locking.rb
|
277
276
|
- definitions/procedures/packages/install.rb
|
278
277
|
- definitions/procedures/packages/installer_confirmation.rb
|
279
278
|
- definitions/procedures/packages/lock_versions.rb
|
@@ -298,6 +297,7 @@ files:
|
|
298
297
|
- definitions/procedures/repositories/enable.rb
|
299
298
|
- definitions/procedures/repositories/setup.rb
|
300
299
|
- definitions/procedures/restore/candlepin_dump.rb
|
300
|
+
- definitions/procedures/restore/candlepin_reset_migrations.rb
|
301
301
|
- definitions/procedures/restore/configs.rb
|
302
302
|
- definitions/procedures/restore/confirmation.rb
|
303
303
|
- definitions/procedures/restore/drop_databases.rb
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Procedures::Packages
|
2
|
-
class EnableVersionLocking < ForemanMaintain::Procedure
|
3
|
-
metadata do
|
4
|
-
description 'Install and configure tools for version locking'
|
5
|
-
param :assumeyes, 'Do not ask for confirmation'
|
6
|
-
end
|
7
|
-
|
8
|
-
def run
|
9
|
-
installed_fm_packages = []
|
10
|
-
['satellite-maintain', 'rubygem-foreman_maintain'].each do |pkg|
|
11
|
-
installed_fm_packages << find_package(pkg)
|
12
|
-
end
|
13
|
-
package_manager.reinstall(installed_fm_packages, :assumeyes => @assumeyes)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|