foreman_maintain 0.8.27 → 0.8.30

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: b9456621c95c1feb4fdf10d4bd85cc22d2d22f667c9d8b227d7662c7575edc20
4
- data.tar.gz: '09ae4ff692aac1550ade1264662014671c78a5890f007180a9f28e67a090f240'
3
+ metadata.gz: d754a81f9efab9d0c7d52788bf5523923027055fc2372a5f91095326dcf3c80b
4
+ data.tar.gz: b83d60aedd820a6ba565bc82c0490fec3fd6c6fcfd3f2af215dc8254a3673bf2
5
5
  SHA512:
6
- metadata.gz: d35101818f38bed03e8e08271fc1b73e34fb10b5db613bb094dac1d32d375f7e2b5061217e487a1130f78a35ac287b1ee49426d60af366c002b2d4f2ada81b4d
7
- data.tar.gz: 4f00f5a90c9e3e3f9cf920136e78c276cccdc9b905b1dbb87453729a02aab8c25cbffcc961ea2f301e4f96825d0b4e2e814fcba11385bb0c4c37b7f952395c7e
6
+ metadata.gz: 2913b00fafee3daa898c25ba5abe993aa19273e2caaa6fcdb7b868bcf6b3abd0521515a0dfe29e9ea774df1e106b91995e1b4c0f5e6ee02d66a853e6b6f598fa
7
+ data.tar.gz: c8782dee263bd2cee34e99c4ee103fea41a0976f8395a6362b29e8b129be9982a38967a716b196df67d11d2b22044a49b0bfff0d439ceaf036c7ee2d1b220656
@@ -4,6 +4,7 @@ module Procedures::Content
4
4
  description 'Prepare content for Pulp 3'
5
5
  for_feature :pulpcore
6
6
  param :quiet, 'Keep the output on a single line', :flag => true, :default => false
7
+ do_not_whitelist
7
8
  end
8
9
 
9
10
  def run
@@ -9,6 +9,7 @@ module Procedures::Content
9
9
  end
10
10
 
11
11
  param :skip_deb, 'Do not run debian options in installer.'
12
+ do_not_whitelist
12
13
  end
13
14
 
14
15
  def run
@@ -0,0 +1,14 @@
1
+ module Procedures::Restore
2
+ class CandlepinResetMigrations < ForemanMaintain::Procedure
3
+ metadata do
4
+ description 'Ensure Candlepin runs all migrations after restoring the database'
5
+ confine do
6
+ feature(:candlepin_database)
7
+ end
8
+ end
9
+
10
+ def run
11
+ FileUtils.rm_f('/var/lib/candlepin/.puppet-candlepin-rpm-version')
12
+ end
13
+ end
14
+ end
@@ -37,7 +37,8 @@ module ForemanMaintain::Scenarios
37
37
  end
38
38
  restore_mongo_dump(backup)
39
39
  add_steps_with_context(Procedures::Pulp::Migrate,
40
- Procedures::Pulpcore::Migrate)
40
+ Procedures::Pulpcore::Migrate,
41
+ Procedures::Restore::CandlepinResetMigrations)
41
42
 
42
43
  add_steps_with_context(Procedures::Restore::RegenerateQueues) if backup.online_backup?
43
44
  add_steps_with_context(Procedures::Service::Start,
@@ -13,15 +13,22 @@ module ForemanMaintain::Scenarios
13
13
  end
14
14
 
15
15
  def target_version
16
- @target_version ||= context.get(:target_version)
16
+ current_full_version = feature(:instance).downstream.current_version
17
+ @target_version ||= current_full_version.bump
17
18
  end
18
19
 
19
20
  def current_version
20
21
  feature(:instance).downstream.current_minor_version
21
22
  end
22
23
 
24
+ def maintenance_repo_label
25
+ @maintenance_repo_label ||= context.get(:maintenance_repo_label)
26
+ end
27
+
23
28
  def maintenance_repo_id(version)
24
- if (repo = ENV['maintenance_repo'])
29
+ if maintenance_repo_label
30
+ return maintenance_repo_label
31
+ elsif (repo = ENV['MAINTENANCE_REPO_LABEL'])
25
32
  return repo unless repo.empty?
26
33
  end
27
34
 
@@ -1,38 +1,23 @@
1
1
  module ForemanMaintain
2
2
  module Cli
3
3
  class SelfUpgradeCommand < Base
4
- option ['--target-version'], 'TARGET_VERSION',\
5
- 'Major version of the Satellite or Capsule'\
6
- ', e.g 7.0', :required => true
4
+ option ['--maintenance-repo-label'], 'REPOSITORY_LABEL',\
5
+ 'Repository label from which packages should be updated.'\
6
+ 'This can be used when standard CDN repositories are unavailable.'
7
7
  def execute
8
- allow_major_version_upgrade_only
9
8
  run_scenario(upgrade_scenario, upgrade_rescue_scenario)
10
9
  end
11
10
 
12
11
  def upgrade_scenario
13
- Scenarios::SelfUpgrade.new(target_version: target_version)
12
+ Scenarios::SelfUpgrade.new(
13
+ maintenance_repo_label: maintenance_repo_label
14
+ )
14
15
  end
15
16
 
16
17
  def upgrade_rescue_scenario
17
- Scenarios::SelfUpgradeRescue.new(target_version: target_version)
18
- end
19
-
20
- def current_downstream_version
21
- ForemanMaintain.detector.feature(:instance).downstream.current_version
22
- end
23
-
24
- def allow_major_version_upgrade_only
25
- begin
26
- next_version = Gem::Version.new(target_version)
27
- rescue ArgumentError => err
28
- raise Error::UsageError, "Invalid version! #{err}"
29
- end
30
- if current_downstream_version >= next_version
31
- message = "The target-version #{target_version} should be "\
32
- "greater than existing version #{current_downstream_version},"\
33
- "\nand self-upgrade should be used for major version upgrades only!"
34
- raise Error::UsageError, message
35
- end
18
+ Scenarios::SelfUpgradeRescue.new(
19
+ maintenance_repo_label: maintenance_repo_label
20
+ )
36
21
  end
37
22
  end
38
23
  end
@@ -100,6 +100,10 @@ module ForemanMaintain
100
100
  @data[:advanced_run] = advanced_run
101
101
  end
102
102
 
103
+ def do_not_whitelist
104
+ @data[:do_not_whitelist] = true
105
+ end
106
+
103
107
  def self.eval_dsl(metadata, &block)
104
108
  new(metadata).tap do |dsl|
105
109
  dsl.instance_eval(&block)
@@ -317,7 +317,11 @@ module ForemanMaintain
317
317
 
318
318
  steps_with_error = scenario.steps_with_error(:whitelisted => false)
319
319
  steps_with_skipped = scenario.steps_with_skipped(:whitelisted => true)
320
- steps_to_whitelist = steps_with_error + steps_with_skipped
320
+ not_skippable_steps = scenario.steps_with_error.select do |step|
321
+ step.metadata[:do_not_whitelist] == true
322
+ end
323
+
324
+ steps_to_whitelist = steps_with_error + steps_with_skipped - not_skippable_steps
321
325
  unless steps_with_error.empty?
322
326
  message << format(<<-MESSAGE.strip_heredoc, format_steps(steps_with_error, "\n", 2))
323
327
  The following steps ended up in failing state:
@@ -325,11 +329,25 @@ module ForemanMaintain
325
329
  %s
326
330
  MESSAGE
327
331
  whitelist_labels = steps_to_whitelist.map(&:label_dashed).join(',')
328
- recommend << format(<<-MESSAGE.strip_heredoc, whitelist_labels)
329
- Resolve the failed steps and rerun
330
- the command. In case the failures are false positives,
331
- use --whitelist="%s"
332
- MESSAGE
332
+ unless whitelist_labels.empty?
333
+ recommend << if scenario.detector.feature(:instance).downstream
334
+ format(<<-MESSAGE.strip_heredoc, whitelist_labels)
335
+ Resolve the failed steps and rerun the command.
336
+
337
+ If the situation persists and, you are unclear what to do next,
338
+ contact Red Hat Technical Support.
339
+
340
+ In case the failures are false positives, use
341
+ --whitelist="%s"
342
+ MESSAGE
343
+ else
344
+ format(<<-MESSAGE.strip_heredoc, whitelist_labels)
345
+ Resolve the failed steps and rerun the command.
346
+ In case the failures are false positives, use
347
+ --whitelist="%s"
348
+ MESSAGE
349
+ end
350
+ end
333
351
  end
334
352
 
335
353
  steps_with_warning = scenario.steps_with_warning(:whitelisted => false)
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '0.8.27'.freeze
2
+ VERSION = '0.8.30'.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.8.27
4
+ version: 0.8.30
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: 2022-04-19 00:00:00.000000000 Z
11
+ date: 2022-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp
@@ -279,6 +279,7 @@ files:
279
279
  - definitions/procedures/repositories/enable.rb
280
280
  - definitions/procedures/repositories/setup.rb
281
281
  - definitions/procedures/restore/candlepin_dump.rb
282
+ - definitions/procedures/restore/candlepin_reset_migrations.rb
282
283
  - definitions/procedures/restore/configs.rb
283
284
  - definitions/procedures/restore/confirmation.rb
284
285
  - definitions/procedures/restore/drop_databases.rb