foreman_maintain 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e995fb504729078ae910121820a8f286d1256b4319d07d25f27a17768ba515af
4
- data.tar.gz: 8fb3b6231928b49a6c6cd8375a14394b31839452ead4c0a7e3dbc198f405912d
3
+ metadata.gz: 55215ac64deedb1ab1aafcef2f6b28392b48952a9f0923be2f95706aaa26d6b4
4
+ data.tar.gz: 0cadfaad877d10e17658ed3650ba483a8e7b8fdd9e898d383ee3871bf88ba498
5
5
  SHA512:
6
- metadata.gz: 12ff59c3185962df60825149e3f34892c6bc42071fb39b35aa701b891dd34eb71843784c161e64d0218e669e66a2f85715991f76a319f48f6fb4dbeba55ddf2f
7
- data.tar.gz: 747024ed62640c6c49406f573557253e6ea96037921633ca94489c20f34f32a1a233c4f6a9bb67bdac45aa9dd8af9bb727733f7531c8d0c5303f56ce59a8ce60
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
- failure_message = 'An update is available for package(s): '\
37
- "#{packages_with_updates.join(',')}. Please update before proceeding!"
38
- fail! failure_message
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 default_dirs
43
- @default_dirs ||= %i[pulp2 pulpcore_database mongo foreman_database].inject({}) do |dirs, f|
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
- "Check recommended disk speed for #{default_dirs.keys.join(', ')} directories."
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
- default_dirs.values do |dir|
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 default_dirs.values.first(1) if check_only_single_device?
74
+ return all_dirs.first(1) if check_only_single_device?
63
75
 
64
- default_dirs.values
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: #{io_obj.name}")
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
- puts execute!("#{env_vars}foreman-rake katello:pulp3_migration", :interactive => true)
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
- execute!('foreman-rake upgrade:run')
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.children('/sys/class/net')
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}' | tee -i #{log_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|
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '0.9.1'.freeze
2
+ VERSION = '0.9.2'.freeze
3
3
  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.9.1
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-20 00:00:00.000000000 Z
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