foreman_maintain 1.7.4 → 1.7.5

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: 9cd7c83e3e9aa5d629b7c65334c4022e8923979a432a917570733afd4d9fef41
4
- data.tar.gz: bc2306bdcac1cb11c91f9105902bdac47cf9ad4ddd02a0774d25b035da4a67f5
3
+ metadata.gz: cd1a7ccb0a384dfbcbde42660854837199df64a4bcf465a3ea92fb77809eff3a
4
+ data.tar.gz: 54f3cbec98e27261489708521a4cb43a41411cb0c40699a5a04c09c6ec66edb3
5
5
  SHA512:
6
- metadata.gz: 8ae072acb083a756c5e4e3eb6b9c87f6f79ebfaa1a70e0385cc0f150078476c63d88c91b443d2b5d9ccb8a0f6c1ec3685f5c26600a147c7ed2f756c0530c6e72
7
- data.tar.gz: 76edef0a64cabe97dfb4f515dcc20be20f562418d0e6dbe5b58b27f52bde5821791afe152342c17170ed32d4e377072b35288b5a8c77266b1ff39fe5eaac7044
6
+ metadata.gz: a60449b267d0b2e5cf90358b87f0ebebf3987b782fae40fcedcc88472790e4ecca1c2a4d4bf3d92497fb328e56fa792b3b8e8fa5ac05c50866f3f3662b4f31c0
7
+ data.tar.gz: 3fb5c40f6edac2b69cb455af6c90c9c43a4ec91a0d2e8dca590edf2339931c08c58f239565a601280f9b81a4d5ab4c742ad91740bd96e0a26bab633aaa04cc16
@@ -36,7 +36,11 @@ module ForemanMaintain
36
36
  PHASES.each do |phase|
37
37
  return run_rollback if quit?
38
38
 
39
- run_phase(phase)
39
+ if skip?(phase)
40
+ skip_phase(phase)
41
+ else
42
+ run_phase(phase)
43
+ end
40
44
  end
41
45
 
42
46
  finish_update unless quit?
@@ -90,12 +94,22 @@ module ForemanMaintain
90
94
  @ask_to_confirm_update = phase == :pre_update_checks
91
95
  end
92
96
 
97
+ def skip_phase(skipped_phase)
98
+ with_non_empty_scenario(skipped_phase) do |scenario|
99
+ @reporter.before_scenario_starts(scenario)
100
+ @reporter.puts <<~MESSAGE
101
+ Skipping #{skipped_phase} phase as it was already run before.
102
+ MESSAGE
103
+ @reporter.after_scenario_finishes(scenario)
104
+ end
105
+ end
106
+
93
107
  private
94
108
 
95
109
  def rollback_pre_migrations
96
110
  raise "Unexpected phase #{phase}, expecting pre_migrations" unless phase == :pre_migrations
97
111
 
98
- rollback_needed = scenario(:pre_migrations).steps.any? { |s| s.executed? && s.success? }
112
+ rollback_needed = find_scenario(:pre_migrations).steps.any? { |s| s.executed? && s.success? }
99
113
  if rollback_needed
100
114
  @quit = false
101
115
  # prevent the unnecessary confirmation questions
@@ -110,7 +124,7 @@ module ForemanMaintain
110
124
  end
111
125
 
112
126
  def with_non_empty_scenario(phase)
113
- next_scenario = scenario(phase)
127
+ next_scenario = find_scenario(phase)
114
128
  unless next_scenario.nil? || next_scenario.steps.empty?
115
129
  yield next_scenario
116
130
  end
@@ -153,6 +167,11 @@ module ForemanMaintain
153
167
  @ask_to_confirm_update = false
154
168
  end
155
169
 
170
+ def skip?(next_phase)
171
+ # the next_phase was run before the current phase
172
+ PHASES.index(next_phase) < PHASES.index(phase)
173
+ end
174
+
156
175
  def phase=(phase)
157
176
  raise "Unknown phase #{phase}" unless PHASES.include?(phase)
158
177
 
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '1.7.4'.freeze
2
+ VERSION = '1.7.5'.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: 1.7.4
4
+ version: 1.7.5
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: 2024-09-18 00:00:00.000000000 Z
11
+ date: 2024-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp