foreman_maintain 1.14.5 → 1.16.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f53d295c4f0818653dc030e5cac7efcdfc80b2ce31ce8e1c068edc2997b1e83d
4
- data.tar.gz: 1518000a6ece5919e4e437bc8b702df19345b0740991c333acb8702f60e02d1c
3
+ metadata.gz: 2fbc59722769aa8b7c256a9c19be18a3774f2620555267b4aa7d185404d4849b
4
+ data.tar.gz: 0c0eec1446182e0b3638b90e75cb1ab7a74183e47c4ba93b27e0e4033c9c4581
5
5
  SHA512:
6
- metadata.gz: 468c3e686ac6d9fb1772697a16df958d9e65d99dd3d886edbbb2647b5f80abd0ba4e1ee362635d2fb12fb000f0e45eaebbadbf11acc6df7bfa5d13e408642015
7
- data.tar.gz: 4a19eea89a7c5760ab4f9f7d2d388bce1b5de4e40fa36a1a8ff61722c8b742ac821c6ce2512203c9dfc074afeeb3a052d143322b2e7a75c066efb614da2f518b
6
+ metadata.gz: 4370f30e4f5bbbcd103bab4330d4208a4cef93e599b85ca2f990bf674a61e1a86c4b5cf62b4dc0dc74f62ebae1a977dcc4aeacb7b8631ff1015a516b817a95bb
7
+ data.tar.gz: 48778609cbf309de9abb05ea30b1b5715fe53d639100b8edeb7f1bb83535dee6d80d496886e2f02be5f97dfa3ffb09a0963c8b0a20fcbd35853b1a2b2c27733a
@@ -1,3 +1,5 @@
1
+ require "etc"
2
+
1
3
  class Features::ForemanTasks < ForemanMaintain::Feature
2
4
  MIN_AGE = 30
3
5
  TIMEOUT_FOR_TASKS_STATUS = 300
@@ -177,7 +179,13 @@ class Features::ForemanTasks < ForemanMaintain::Feature
177
179
  f.write(csv_output)
178
180
  f.close
179
181
  end
180
- execute("bzip2 #{filepath} -c -9 > #{filepath}.bz2")
182
+
183
+ # only if pbzip2, use max 8 threads, but at least 1 thread
184
+ cpu_count = Etc.nprocessors
185
+ threads = [[cpu_count / 2, 1].max, 8].min
186
+
187
+ compressor = system("which pbzip2 >/dev/null 2>&1") ? "pbzip2 -p#{threads}" : "bzip2"
188
+ execute("nice -n 10 #{compressor} #{filepath} -c -9 > #{filepath}.bz2")
181
189
  FileUtils.rm_rf(filepath)
182
190
  end
183
191
 
@@ -179,7 +179,6 @@ class Features::Instance < ForemanMaintain::Feature
179
179
  def component_features_map
180
180
  {
181
181
  'candlepin_auth' => %w[candlepin candlepin_database],
182
- 'candlepin_events' => %w[candlepin candlepin_database],
183
182
  'candlepin' => %w[candlepin candlepin_database],
184
183
  'pulp3' => %w[pulpcore pulpcore_database],
185
184
  'pulp3_content' => %w[pulpcore pulpcore_database],
@@ -106,6 +106,7 @@ module ForemanMaintain::Scenarios
106
106
  if Packages.skip_installer_run?(context.get(:packages))
107
107
  add_step_with_context(Procedures::Packages::Update,
108
108
  :force => true, :warn_on_errors => true)
109
+ add_step(Procedures::Packages::CheckForReboot)
109
110
  else
110
111
  unless context.get(:downloadonly)
111
112
  add_steps_with_context(
@@ -126,6 +127,7 @@ module ForemanMaintain::Scenarios
126
127
  add_step_with_context(Procedures::Packages::LockVersions)
127
128
  else
128
129
  add_step_with_context(Procedures::Installer::Run)
130
+ add_step(Procedures::Packages::CheckForReboot)
129
131
  end
130
132
 
131
133
  add_step(Procedures::Packages::LockingStatus)
@@ -4,7 +4,10 @@ module ForemanMaintain::Scenarios
4
4
  include ForemanMaintain::Concerns::Versions
5
5
 
6
6
  def target_version
7
- feature(:instance).target_version
7
+ @target_version ||= begin
8
+ v = Gem::Version.new(feature(:instance).target_version)
9
+ "#{v.segments[0]}.#{v.segments[1] + 1}"
10
+ end
8
11
  end
9
12
 
10
13
  def current_version
@@ -39,19 +42,30 @@ module ForemanMaintain::Scenarios
39
42
  true
40
43
  end
41
44
 
45
+ def maintain_version
46
+ @maintain_version ||= feature(:instance).target_version
47
+ end
48
+
49
+ def current_major
50
+ Gem::Version.new(current_version).segments[0..1].join('.')
51
+ end
52
+
53
+ def upgrade_repo_version
54
+ Gem::Version.new(current_version).bump.segments[0..1].join('.')
55
+ end
56
+
42
57
  def req_repos_to_update_pkgs
58
+ version = upgrade_repo_version
43
59
  if use_rhsm?
44
- main_rh_repos + [maintenance_repo_id(target_version)]
60
+ main_rh_repos + [maintenance_repo_id(version)]
45
61
  else
46
- [maintenance_repo_id(target_version)]
62
+ [maintenance_repo_id(version)]
47
63
  end
48
64
  end
49
65
 
50
66
  def self_upgrade_allowed?
51
- target = Gem::Version.new(target_version).version
52
-
53
- Gem::Version.new(current_version).segments[0..1].join('.') == target ||
54
- Gem::Version.new(current_version).bump.segments[0..1].join('.') == target
67
+ current_major == maintain_version ||
68
+ Gem::Version.new(current_version).bump.segments[0..1].join('.') == maintain_version
55
69
  end
56
70
  end
57
71
 
@@ -67,10 +81,10 @@ module ForemanMaintain::Scenarios
67
81
  unless self_upgrade_allowed?
68
82
  raise(
69
83
  ForemanMaintain::Error::Warn,
70
- "foreman-maintain is too many versions ahead. The target " \
71
- "version is #{target_version} while the currently installed " \
72
- "version is #{current_version}. Please rollback " \
73
- "foreman-maintain to the proper version."
84
+ "foreman-maintain does not support the installed version of Satellite." \
85
+ "The currently installed version in #{current_version}," \
86
+ "while foreman-maintain only supports #{maintain_version}." \
87
+ "Please install the right version of foreman-maintain."
74
88
  )
75
89
  end
76
90
 
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '1.14.5'.freeze
2
+ VERSION = '1.16.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_maintain
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.5
4
+ version: 1.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
@@ -500,7 +500,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
500
500
  - !ruby/object:Gem::Version
501
501
  version: '0'
502
502
  requirements: []
503
- rubygems_version: 4.0.10
503
+ rubygems_version: 4.0.16
504
504
  specification_version: 4
505
505
  summary: Foreman maintenance tool belt
506
506
  test_files: []