foreman_maintain 0.9.1 → 0.9.2
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/check_for_newer_packages.rb +5 -3
- data/definitions/checks/disk/performance.rb +19 -8
- data/definitions/features/foreman_tasks.rb +11 -0
- data/definitions/procedures/content/prepare.rb +1 -1
- data/definitions/procedures/installer/upgrade_rake_task.rb +3 -1
- data/definitions/scenarios/restore.rb +2 -0
- data/lib/foreman_maintain/concerns/el_repos_manager_common.rb +20 -0
- data/lib/foreman_maintain/repos_manager/dnf_config_manager.rb +13 -0
- data/lib/foreman_maintain/repos_manager/el_common.rb +0 -0
- data/lib/foreman_maintain/repos_manager/yum_config_manager.rb +20 -0
- data/lib/foreman_maintain/utils/backup.rb +1 -1
- data/lib/foreman_maintain/utils/command_runner.rb +2 -1
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55215ac64deedb1ab1aafcef2f6b28392b48952a9f0923be2f95706aaa26d6b4
|
4
|
+
data.tar.gz: 0cadfaad877d10e17658ed3650ba483a8e7b8fdd9e898d383ee3871bf88ba498
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b2dbeddc647b557a0196fcea8e290e29a17e92a8ab38cee7acccbc165318bdd48cc43312232f928a30a2637dc290fd629fd07cfa27cdcb1808eb70b9903b261
|
7
|
+
data.tar.gz: 7dc280857da4485c5312d7b5047a94f1e0084da1c7e798964d2d66d7068daaced1268d34fcda1033e4fd73a6bd8caec8fa6450da7e5fb52f81866abb58bc0e04
|
@@ -33,9 +33,11 @@ class Checks::CheckForNewerPackages < ForemanMaintain::Check
|
|
33
33
|
end
|
34
34
|
|
35
35
|
unless packages_with_updates.empty?
|
36
|
-
|
37
|
-
|
38
|
-
|
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"
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
@@ -39,8 +39,8 @@ module Checks
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
43
|
-
@
|
42
|
+
def data_dirs
|
43
|
+
@data_dirs ||= %i[pulpcore_database mongo foreman_database].inject({}) do |dirs, f|
|
44
44
|
if feature(f) && File.directory?(feature(f).data_dir)
|
45
45
|
dirs[feature(f).label_dashed] = feature(f).data_dir
|
46
46
|
end
|
@@ -48,20 +48,32 @@ module Checks
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
def pulp_dir
|
52
|
+
@pulp_dir ||= begin
|
53
|
+
pulp_feature = feature(:pulp2) || feature(:pulpcore_database)
|
54
|
+
{ pulp_feature.label_dashed => pulp_feature.pulp_data_dir }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
51
58
|
def description
|
52
|
-
|
59
|
+
'Check recommended disk speed for '\
|
60
|
+
"#{[data_dirs.keys | pulp_dir.keys].join(', ')} directories."
|
61
|
+
end
|
62
|
+
|
63
|
+
def all_dirs
|
64
|
+
data_dirs.values | pulp_dir.values
|
53
65
|
end
|
54
66
|
|
55
67
|
def check_only_single_device?
|
56
|
-
|
68
|
+
all_dirs.each do |dir|
|
57
69
|
ForemanMaintain::Utils::Disk::Device.new(dir).name
|
58
70
|
end.uniq.length <= 1
|
59
71
|
end
|
60
72
|
|
61
73
|
def dirs_to_check
|
62
|
-
return
|
74
|
+
return all_dirs.first(1) if check_only_single_device?
|
63
75
|
|
64
|
-
|
76
|
+
all_dirs
|
65
77
|
end
|
66
78
|
|
67
79
|
private
|
@@ -74,11 +86,10 @@ module Checks
|
|
74
86
|
def compute_disk_speed(spinner)
|
75
87
|
success = true
|
76
88
|
io_obj = ForemanMaintain::Utils::Disk::NilDevice.new
|
77
|
-
|
78
89
|
dirs_to_check.each do |dir|
|
79
90
|
io_obj = ForemanMaintain::Utils::Disk::Device.new(dir)
|
80
91
|
|
81
|
-
spinner.update("[Speed check In-Progress] device
|
92
|
+
spinner.update("[Speed check In-Progress] device:#{io_obj.name}")
|
82
93
|
stats << io_obj
|
83
94
|
|
84
95
|
next if io_obj.read_speed >= EXPECTED_IO
|
@@ -17,6 +17,17 @@ class Features::ForemanTasks < ForemanMaintain::Feature
|
|
17
17
|
Actions::Candlepin::ListenOnCandlepinEvents
|
18
18
|
Actions::Katello::EventQueue::Monitor
|
19
19
|
Actions::Insights::EmailPoller
|
20
|
+
ForemanInventoryUpload::Async::GenerateReportJob
|
21
|
+
ForemanInventoryUpload::Async::QueueForUploadJob
|
22
|
+
ForemanInventoryUpload::Async::UploadReportJob
|
23
|
+
InsightsCloud::Async::InsightsClientStatusAging
|
24
|
+
InsightsCloud::Async::InsightsFullSync
|
25
|
+
InsightsCloud::Async::InsightsResolutionsSync
|
26
|
+
InsightsCloud::Async::InsightsRulesSync
|
27
|
+
InventorySync::Async::InventoryFullSync
|
28
|
+
InventorySync::Async::InventoryHostsSync
|
29
|
+
InventorySync::Async::InventoryScheduledSync
|
30
|
+
InventorySync::Async::InventorySelfHostSync
|
20
31
|
].freeze
|
21
32
|
|
22
33
|
metadata do
|
@@ -10,7 +10,7 @@ module Procedures::Content
|
|
10
10
|
sleep(20) # in satellite 6.9 the services are still coming up
|
11
11
|
# use interactive to get realtime output
|
12
12
|
env_vars = @quiet ? '' : 'preserve_output=true '
|
13
|
-
|
13
|
+
execute!("#{env_vars}foreman-rake katello:pulp3_migration", :interactive => true)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -5,7 +5,9 @@ module Procedures::Installer
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def run
|
8
|
-
|
8
|
+
# only run this in the Satellite scenario, as in others
|
9
|
+
# the installer runs this rake task for us already
|
10
|
+
execute!('foreman-rake upgrade:run') if feature(:satellite)
|
9
11
|
end
|
10
12
|
end
|
11
13
|
end
|
@@ -43,6 +43,8 @@ module ForemanMaintain::Scenarios
|
|
43
43
|
add_steps_with_context(Procedures::Restore::RegenerateQueues) if backup.online_backup?
|
44
44
|
add_steps_with_context(Procedures::Service::Start,
|
45
45
|
Procedures::Service::DaemonReload)
|
46
|
+
add_step(Procedures::Installer::Upgrade.new(:assumeyes => true))
|
47
|
+
add_step_with_context(Procedures::Installer::UpgradeRakeTask)
|
46
48
|
add_step_with_context(Procedures::Crond::Start) if feature(:cron)
|
47
49
|
end
|
48
50
|
# rubocop:enable Metrics/MethodLength,Metrics/AbcSize
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ForemanMaintain
|
2
|
+
module Concerns
|
3
|
+
module ElReposManagerCommon
|
4
|
+
include ForemanMaintain::Concerns::OsFacts
|
5
|
+
|
6
|
+
def package_manager
|
7
|
+
return 'dnf' if el8?
|
8
|
+
|
9
|
+
'yum'
|
10
|
+
end
|
11
|
+
|
12
|
+
def enabled_repos_hash
|
13
|
+
repos = execute("#{package_manager} repolist enabled -d 6 -e 0 2> /dev/null | grep -E 'Repo-id|Repo-baseurl'")
|
14
|
+
return {} if repos.empty?
|
15
|
+
|
16
|
+
Hash[*repos.delete!(' ').split("\n")]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module ForemanMaintain::ReposManager
|
2
|
+
class DnfConfigManager
|
3
|
+
include ForemanMaintain::Concerns::ElReposManagerCommon
|
4
|
+
|
5
|
+
def disable_repos(repo_ids)
|
6
|
+
execute!("dnf config-manager --set-disabled #{repo_ids.join(',')}")
|
7
|
+
end
|
8
|
+
|
9
|
+
def enable_repos(repo_ids)
|
10
|
+
execute!("dnf config-manager --set-enabled #{repo_ids.join(',')}")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
File without changes
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ForemanMaintain::ReposManager
|
2
|
+
class YumConfigManager
|
3
|
+
include ForemanMaintain::Concerns::ElReposManagerCommon
|
4
|
+
|
5
|
+
def disable_repos(repo_ids)
|
6
|
+
execute!("yum-config-manager --disable #{repo_ids.join(',')}")
|
7
|
+
end
|
8
|
+
|
9
|
+
def enable_repos(repo_ids)
|
10
|
+
execute!("yum-config-manager --enable #{repo_ids.join(',')}")
|
11
|
+
end
|
12
|
+
|
13
|
+
def enabled_repos_hash
|
14
|
+
repos = execute("yum repolist enabled -d 6 -e 0 2> /dev/null | grep -E 'Repo-id|Repo-baseurl'")
|
15
|
+
return {} if repos.empty?
|
16
|
+
|
17
|
+
Hash[*repos.delete!(' ').split("\n")]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -291,7 +291,7 @@ module ForemanMaintain
|
|
291
291
|
# I wanted to do `Socket.getifaddrs.map(&:name).uniq`,
|
292
292
|
# but this has to work with Ruby 2.0, and Socket.getifaddrs is 2.1+
|
293
293
|
errors = {}
|
294
|
-
system_interfaces = Dir.
|
294
|
+
system_interfaces = Dir.entries('/sys/class/net') - ['.', '..']
|
295
295
|
|
296
296
|
proxy_config = metadata.fetch('proxy_config', {})
|
297
297
|
|
@@ -66,7 +66,8 @@ module ForemanMaintain
|
|
66
66
|
log_file = Tempfile.open('captured-output')
|
67
67
|
exit_file = Tempfile.open('captured-exit-code')
|
68
68
|
Kernel.system(
|
69
|
-
"bash -c '#{full_command}; echo $? > #{exit_file.path}'
|
69
|
+
"stdbuf -oL -eL bash -c '#{full_command}; echo $? > #{exit_file.path}'"\
|
70
|
+
"| tee -i #{log_file.path}"
|
70
71
|
)
|
71
72
|
File.open(log_file.path) { |f| @output = f.read }
|
72
73
|
File.open(exit_file.path) do |f|
|
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.9.
|
4
|
+
version: 0.9.2
|
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: 2021-10
|
11
|
+
date: 2021-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -374,6 +374,7 @@ files:
|
|
374
374
|
- lib/foreman_maintain/concerns/base_database.rb
|
375
375
|
- lib/foreman_maintain/concerns/directory_marker.rb
|
376
376
|
- lib/foreman_maintain/concerns/downstream.rb
|
377
|
+
- lib/foreman_maintain/concerns/el_repos_manager_common.rb
|
377
378
|
- lib/foreman_maintain/concerns/finders.rb
|
378
379
|
- lib/foreman_maintain/concerns/hammer.rb
|
379
380
|
- lib/foreman_maintain/concerns/logger.rb
|
@@ -402,6 +403,9 @@ files:
|
|
402
403
|
- lib/foreman_maintain/procedure.rb
|
403
404
|
- lib/foreman_maintain/reporter.rb
|
404
405
|
- lib/foreman_maintain/reporter/cli_reporter.rb
|
406
|
+
- lib/foreman_maintain/repos_manager/dnf_config_manager.rb
|
407
|
+
- lib/foreman_maintain/repos_manager/el_common.rb
|
408
|
+
- lib/foreman_maintain/repos_manager/yum_config_manager.rb
|
405
409
|
- lib/foreman_maintain/runner.rb
|
406
410
|
- lib/foreman_maintain/runner/execution.rb
|
407
411
|
- lib/foreman_maintain/runner/stored_execution.rb
|