foreman_maintain 0.6.11 → 0.6.16
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/disk/available_space_candlepin.rb +27 -0
- data/definitions/checks/foreman/check_checkpoint_segments.rb +30 -22
- data/definitions/features/candlepin.rb +4 -0
- data/definitions/features/dynflow_sidekiq.rb +7 -4
- data/definitions/procedures/installer/upgrade_rake_task.rb +11 -0
- data/definitions/procedures/service/list.rb +12 -2
- data/definitions/scenarios/upgrade_to_satellite_6_8.rb +1 -0
- data/definitions/scenarios/upgrade_to_satellite_6_8_z.rb +1 -0
- data/extras/foreman_protector/foreman-protector.whitelist +1 -0
- data/lib/foreman_maintain.rb +2 -0
- data/lib/foreman_maintain/cli/upgrade_command.rb +3 -0
- data/lib/foreman_maintain/concerns/primary_checks.rb +23 -0
- data/lib/foreman_maintain/utils/disk/io_device.rb +4 -0
- data/lib/foreman_maintain/utils/service/systemd.rb +2 -1
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '03389eb2ca1e4f48b3fd795cdf443254a873c8823b2142bffdac15a4c940a29c'
|
4
|
+
data.tar.gz: 322a7413bb3e65c2d07f4646ee33f6e24cedfa64bfd5a519e91ea6c70ccfa53c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57661b18eafd6943bd5dfd73bf8314247ee426874b80de2ced9c1cf3341fc5e7d3750554bc349d09ae37d3dba4e5a7d9bf8f938c482f4d22080febc0f03e50f1
|
7
|
+
data.tar.gz: ea65edc6f4b121f32aad24069d0f7c68340465cd8d36fd3d1ca507b2e0f1a46bf4c62a9a62c5d965fc7915f6b66b0250ba8c3230de9b52a7114d94286aa91f4d
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Checks
|
2
|
+
module Disk
|
3
|
+
class AvailableSpaceCandlepin < ForemanMaintain::Check
|
4
|
+
metadata do
|
5
|
+
label :available_space_cp
|
6
|
+
description 'Check to make sure /var/lib/candlepin has enough space'
|
7
|
+
tags :pre_upgrade
|
8
|
+
confine do
|
9
|
+
feature(:candlepin) && check_min_version('candlepin', '3.1')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
MAX_USAGE_IN_PERCENT = 90
|
14
|
+
|
15
|
+
def run
|
16
|
+
assert(enough_space?, "System has more than #{MAX_USAGE_IN_PERCENT}% space used"\
|
17
|
+
" on #{feature(:candlepin).work_dir}.\n"\
|
18
|
+
'See https://bugzilla.redhat.com/show_bug.cgi?id=1898605')
|
19
|
+
end
|
20
|
+
|
21
|
+
def enough_space?
|
22
|
+
io_obj = ForemanMaintain::Utils::Disk::IODevice.new(feature(:candlepin).work_dir)
|
23
|
+
io_obj.space_used_in_percent < MAX_USAGE_IN_PERCENT
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -18,31 +18,39 @@ module Checks
|
|
18
18
|
# rubocop:disable Metrics/MethodLength
|
19
19
|
def check_custom_hiera
|
20
20
|
hiera_file = feature(:installer).custom_hiera_file
|
21
|
-
|
22
|
-
|
23
|
-
if config
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
elsif config['postgresql::server::config_entries'].key?('checkpoint_segments')
|
30
|
-
message = <<-MESSAGE.strip_heredoc
|
31
|
-
ERROR: Tuning option 'checkpoint_segments' found.
|
32
|
-
This option is no longer valid for PostgreSQL 9.5 or newer.
|
33
|
-
Please remove it from following file and re-run the command.
|
34
|
-
- #{hiera_file}
|
35
|
-
MESSAGE
|
36
|
-
if feature(:katello)
|
37
|
-
message += <<-MESSAGE.strip_heredoc
|
38
|
-
The presence of checkpoint_segments in #{hiera_file} indicates manual tuning.
|
39
|
-
Manual tuning can override values provided by the --tuning parameter.
|
40
|
-
Review #{hiera_file} for values that are already provided by the built in tuning profiles.
|
41
|
-
Built in tuning profiles also provide a supported upgrade path.
|
21
|
+
begin
|
22
|
+
config = YAML.load_file(hiera_file)
|
23
|
+
if config.is_a?(Hash) && config.key?('postgresql::server::config_entries')
|
24
|
+
if config['postgresql::server::config_entries'].nil?
|
25
|
+
return <<-MESSAGE.strip_heredoc
|
26
|
+
ERROR: 'postgresql::server::config_entries' cannot be null.
|
27
|
+
Please remove it from following file and re-run the command.
|
28
|
+
- #{hiera_file}
|
42
29
|
MESSAGE
|
30
|
+
elsif config['postgresql::server::config_entries'].key?('checkpoint_segments')
|
31
|
+
message = <<-MESSAGE.strip_heredoc
|
32
|
+
ERROR: Tuning option 'checkpoint_segments' found.
|
33
|
+
This option is no longer valid for PostgreSQL 9.5 or newer.
|
34
|
+
Please remove it from following file and re-run the command.
|
35
|
+
- #{hiera_file}
|
36
|
+
MESSAGE
|
37
|
+
if feature(:katello)
|
38
|
+
message += <<-MESSAGE.strip_heredoc
|
39
|
+
The presence of checkpoint_segments in #{hiera_file} indicates manual tuning.
|
40
|
+
Manual tuning can override values provided by the --tuning parameter.
|
41
|
+
Review #{hiera_file} for values that are already provided by the built in tuning profiles.
|
42
|
+
Built in tuning profiles also provide a supported upgrade path.
|
43
|
+
MESSAGE
|
44
|
+
end
|
45
|
+
return message
|
43
46
|
end
|
44
|
-
|
47
|
+
elsif config.is_a?(String)
|
48
|
+
fail! "Error: File #{hiera_file} is not a yaml file."
|
49
|
+
exit 1
|
45
50
|
end
|
51
|
+
rescue Psych::SyntaxError
|
52
|
+
fail! "Found syntax error in file: #{hiera_file}"
|
53
|
+
exit 1
|
46
54
|
end
|
47
55
|
end
|
48
56
|
# rubocop:enable Metrics/MethodLength
|
@@ -7,10 +7,6 @@ class Features::DynflowSidekiq < ForemanMaintain::Feature
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
def services
|
11
|
-
service_names.map { |service| system_service service, instance_priority(service) }
|
12
|
-
end
|
13
|
-
|
14
10
|
def config_files
|
15
11
|
# Workaround until foreman-installer can deploy scaled workers
|
16
12
|
service_symlinks = configured_instances.map do |service|
|
@@ -22,6 +18,13 @@ class Features::DynflowSidekiq < ForemanMaintain::Feature
|
|
22
18
|
].flatten
|
23
19
|
end
|
24
20
|
|
21
|
+
def services
|
22
|
+
service_names.map do |service|
|
23
|
+
system_service service, instance_priority(service),
|
24
|
+
:instance_parent_unit => 'dynflow-sidekiq@'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
25
28
|
private
|
26
29
|
|
27
30
|
def instance_priority(instance)
|
@@ -16,12 +16,22 @@ module Procedures::Service
|
|
16
16
|
|
17
17
|
def unit_files_list(services)
|
18
18
|
if systemd_installed?
|
19
|
-
|
20
|
-
|
19
|
+
execute("systemctl list-unit-files --type=service | \
|
20
|
+
grep '#{build_regex_for_services(services)}'")
|
21
21
|
else
|
22
22
|
regex = services.map { |service| "^#{service.name} " }.join('\|')
|
23
23
|
execute("chkconfig --list 2>&1 | grep '#{regex}'")
|
24
24
|
end
|
25
25
|
end
|
26
|
+
|
27
|
+
def build_regex_for_services(services)
|
28
|
+
services.map do |service|
|
29
|
+
if service.respond_to?(:instance_parent_unit) && service.instance_parent_unit
|
30
|
+
"^#{service.instance_parent_unit}.service"
|
31
|
+
else
|
32
|
+
"^#{service.name}.service"
|
33
|
+
end
|
34
|
+
end.join('\|')
|
35
|
+
end
|
26
36
|
end
|
27
37
|
end
|
@@ -59,6 +59,7 @@ module Scenarios::Satellite_6_8
|
|
59
59
|
add_step(Procedures::Packages::UnlockVersions.new)
|
60
60
|
add_step(Procedures::Packages::Update.new(:assumeyes => true))
|
61
61
|
add_step_with_context(Procedures::Installer::Upgrade)
|
62
|
+
add_step(Procedures::Installer::UpgradeRakeTask)
|
62
63
|
end
|
63
64
|
end
|
64
65
|
|
@@ -58,6 +58,7 @@ module Scenarios::Satellite_6_8_z
|
|
58
58
|
add_step(Procedures::Packages::UnlockVersions.new)
|
59
59
|
add_step(Procedures::Packages::Update.new(:assumeyes => true))
|
60
60
|
add_step_with_context(Procedures::Installer::Upgrade)
|
61
|
+
add_step(Procedures::Installer::UpgradeRakeTask)
|
61
62
|
end
|
62
63
|
end
|
63
64
|
|
data/lib/foreman_maintain.rb
CHANGED
@@ -21,6 +21,7 @@ module ForemanMaintain
|
|
21
21
|
require 'foreman_maintain/concerns/base_database'
|
22
22
|
require 'foreman_maintain/concerns/directory_marker'
|
23
23
|
require 'foreman_maintain/concerns/downstream'
|
24
|
+
require 'foreman_maintain/concerns/primary_checks'
|
24
25
|
require 'foreman_maintain/top_level_modules'
|
25
26
|
require 'foreman_maintain/yaml_storage'
|
26
27
|
require 'foreman_maintain/config'
|
@@ -41,6 +42,7 @@ module ForemanMaintain
|
|
41
42
|
require 'foreman_maintain/error'
|
42
43
|
|
43
44
|
class << self
|
45
|
+
include ForemanMaintain::Concerns::PrimaryChecks
|
44
46
|
attr_accessor :config, :logger
|
45
47
|
|
46
48
|
LOGGER_LEVEL_MAPPING = {
|
@@ -56,6 +56,7 @@ module ForemanMaintain
|
|
56
56
|
disable_self_upgrade_option
|
57
57
|
|
58
58
|
def execute
|
59
|
+
ForemanMaintain.validate_downstream_packages
|
59
60
|
ForemanMaintain.perform_self_upgrade unless disable_self_upgrade?
|
60
61
|
print_versions(UpgradeRunner.available_targets)
|
61
62
|
end
|
@@ -67,6 +68,7 @@ module ForemanMaintain
|
|
67
68
|
disable_self_upgrade_option
|
68
69
|
|
69
70
|
def execute
|
71
|
+
ForemanMaintain.validate_downstream_packages
|
70
72
|
ForemanMaintain.perform_self_upgrade unless disable_self_upgrade?
|
71
73
|
upgrade_runner.run_phase(:pre_upgrade_checks)
|
72
74
|
exit upgrade_runner.exit_code
|
@@ -86,6 +88,7 @@ module ForemanMaintain
|
|
86
88
|
end
|
87
89
|
|
88
90
|
def execute
|
91
|
+
ForemanMaintain.validate_downstream_packages
|
89
92
|
ForemanMaintain.perform_self_upgrade unless disable_self_upgrade?
|
90
93
|
if phase
|
91
94
|
upgrade_runner.run_phase(phase.to_sym)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module ForemanMaintain
|
2
|
+
module Concerns
|
3
|
+
module PrimaryChecks
|
4
|
+
def validate_downstream_packages
|
5
|
+
return unless detector.feature(:installer) && detector.feature(:installer).with_scenarios?
|
6
|
+
if (package = package_name) && !package_manager.installed?(package)
|
7
|
+
raise ForemanMaintain::Error::Fail,
|
8
|
+
"Error: Important rpm package #{package} is not installed!"\
|
9
|
+
"\nInstall #{package} rpm to ensure system consistency."
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def package_name
|
14
|
+
installed_scenario = detector.feature(:installer).last_scenario
|
15
|
+
if installed_scenario == 'satellite'
|
16
|
+
'satellite'
|
17
|
+
elsif installed_scenario == 'capsule'
|
18
|
+
'satellite-capsule'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -22,6 +22,10 @@ module ForemanMaintain
|
|
22
22
|
convert_kb_to_mb(execute!("df #{dir}|awk {'print $4'}|tail -1").to_i)
|
23
23
|
end
|
24
24
|
|
25
|
+
def space_used_in_percent
|
26
|
+
execute!("df #{dir}|awk {'print $5'}|tail -1").to_i
|
27
|
+
end
|
28
|
+
|
25
29
|
private
|
26
30
|
|
27
31
|
# In fio command, --direct option bypass the cache page
|
@@ -1,16 +1,17 @@
|
|
1
1
|
module ForemanMaintain::Utils
|
2
2
|
module Service
|
3
3
|
class Systemd < Abstract
|
4
|
+
attr_reader :instance_parent_unit
|
4
5
|
def initialize(name, priority, options = {})
|
5
6
|
super
|
6
7
|
@sys = SystemHelpers.new
|
8
|
+
@instance_parent_unit = options.fetch(:instance_parent_unit, nil)
|
7
9
|
end
|
8
10
|
|
9
11
|
def command(action, options = {})
|
10
12
|
do_wait = options.fetch(:wait, true) # wait for service to start
|
11
13
|
all = @options.fetch(:all, false)
|
12
14
|
skip_enablement = @options.fetch(:skip_enablement, false)
|
13
|
-
|
14
15
|
if skip_enablement && %w[enable disable].include?(action)
|
15
16
|
return skip_enablement_message(action, @name)
|
16
17
|
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: 0.6.
|
4
|
+
version: 0.6.16
|
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:
|
11
|
+
date: 2021-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -125,6 +125,7 @@ files:
|
|
125
125
|
- definitions/checks/check_hotfix_installed.rb
|
126
126
|
- definitions/checks/check_tmout.rb
|
127
127
|
- definitions/checks/disk/available_space.rb
|
128
|
+
- definitions/checks/disk/available_space_candlepin.rb
|
128
129
|
- definitions/checks/disk/performance.rb
|
129
130
|
- definitions/checks/env_proxy.rb
|
130
131
|
- definitions/checks/foreman/check_checkpoint_segments.rb
|
@@ -239,6 +240,7 @@ files:
|
|
239
240
|
- definitions/procedures/hammer_setup.rb
|
240
241
|
- definitions/procedures/installer/run.rb
|
241
242
|
- definitions/procedures/installer/upgrade.rb
|
243
|
+
- definitions/procedures/installer/upgrade_rake_task.rb
|
242
244
|
- definitions/procedures/iptables/add_maintenance_mode_chain.rb
|
243
245
|
- definitions/procedures/iptables/remove_maintenance_mode_chain.rb
|
244
246
|
- definitions/procedures/knowledge_base_article.rb
|
@@ -337,6 +339,7 @@ files:
|
|
337
339
|
- lib/foreman_maintain/concerns/hammer.rb
|
338
340
|
- lib/foreman_maintain/concerns/logger.rb
|
339
341
|
- lib/foreman_maintain/concerns/metadata.rb
|
342
|
+
- lib/foreman_maintain/concerns/primary_checks.rb
|
340
343
|
- lib/foreman_maintain/concerns/reporter.rb
|
341
344
|
- lib/foreman_maintain/concerns/scenario_metadata.rb
|
342
345
|
- lib/foreman_maintain/concerns/system_helpers.rb
|