foreman_maintain 0.6.10 → 0.6.15
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/foreman/check_checkpoint_segments.rb +30 -22
- 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.rb +2 -2
- 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/service/systemd.rb +2 -1
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddf7d7720cb922e61c0d6245c14929ebb3745307b7b166f89921667a4948d4f1
|
4
|
+
data.tar.gz: 88c7794cbeb2c13d0bb8e86f4762a516ceec7e7ac48aa03b4c00bcb12bcbe33f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 786f1416f313f3a60d8109edf2c25636770c6592ffb74d921587d23b4da89f1fdd034cb42e610a1df86b54d9118e97b12f7bc8e004019ab664655d577893c1f9
|
7
|
+
data.tar.gz: 672090585c8fa8b490af89bc9fe14b94aca471ef1457e0553697285e24f20878e2c9743054c6451364418f6d403f129bef6636c7615605a43503843a133b7c83
|
@@ -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 = {
|
data/lib/foreman_maintain/cli.rb
CHANGED
@@ -57,7 +57,7 @@ module ForemanMaintain
|
|
57
57
|
raise error
|
58
58
|
end
|
59
59
|
|
60
|
-
puts error.message
|
60
|
+
$stderr.puts error.message
|
61
61
|
logger.error(error)
|
62
62
|
|
63
63
|
@exit_code = 1
|
@@ -65,7 +65,7 @@ module ForemanMaintain
|
|
65
65
|
|
66
66
|
def process_usage_error(error)
|
67
67
|
log_exit_code_info(1)
|
68
|
-
puts error.message
|
68
|
+
$stderr.puts error.message
|
69
69
|
exit!
|
70
70
|
end
|
71
71
|
end
|
@@ -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
|
@@ -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.15
|
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-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -239,6 +239,7 @@ files:
|
|
239
239
|
- definitions/procedures/hammer_setup.rb
|
240
240
|
- definitions/procedures/installer/run.rb
|
241
241
|
- definitions/procedures/installer/upgrade.rb
|
242
|
+
- definitions/procedures/installer/upgrade_rake_task.rb
|
242
243
|
- definitions/procedures/iptables/add_maintenance_mode_chain.rb
|
243
244
|
- definitions/procedures/iptables/remove_maintenance_mode_chain.rb
|
244
245
|
- definitions/procedures/knowledge_base_article.rb
|
@@ -337,6 +338,7 @@ files:
|
|
337
338
|
- lib/foreman_maintain/concerns/hammer.rb
|
338
339
|
- lib/foreman_maintain/concerns/logger.rb
|
339
340
|
- lib/foreman_maintain/concerns/metadata.rb
|
341
|
+
- lib/foreman_maintain/concerns/primary_checks.rb
|
340
342
|
- lib/foreman_maintain/concerns/reporter.rb
|
341
343
|
- lib/foreman_maintain/concerns/scenario_metadata.rb
|
342
344
|
- lib/foreman_maintain/concerns/system_helpers.rb
|
@@ -404,7 +406,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
404
406
|
- !ruby/object:Gem::Version
|
405
407
|
version: '0'
|
406
408
|
requirements: []
|
407
|
-
rubygems_version: 3.0.
|
409
|
+
rubygems_version: 3.0.8
|
408
410
|
signing_key:
|
409
411
|
specification_version: 4
|
410
412
|
summary: Foreman maintenance tool belt
|