foreman_maintain 1.7.3 → 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: e3e15401e01712537566856184b187a132a0c3db2634955d8688875ba4c2ca01
4
- data.tar.gz: 5e0bcafc241cf70f128ebe6fe887b50b83dd265311fec601360f92bbd2760751
3
+ metadata.gz: cd1a7ccb0a384dfbcbde42660854837199df64a4bcf465a3ea92fb77809eff3a
4
+ data.tar.gz: 54f3cbec98e27261489708521a4cb43a41411cb0c40699a5a04c09c6ec66edb3
5
5
  SHA512:
6
- metadata.gz: c6344eb03b0caec004ebd5920bd7d416535000379361146680af2e1870d28a98816403210bcc8db78dc18be27c2d8559400fbc0c7160f5e8c680923f833b4eb6
7
- data.tar.gz: cd87120311bedea2789b1ccf9db5b16ae8b81282eb0d49ac9e053f19b4702328dca9a502e4788898fd47330122dca3014dabf579f02a8e885c24685c72fd619c
6
+ metadata.gz: a60449b267d0b2e5cf90358b87f0ebebf3987b782fae40fcedcc88472790e4ecca1c2a4d4bf3d92497fb328e56fa792b3b8e8fa5ac05c50866f3f3662b4f31c0
7
+ data.tar.gz: 3fb5c40f6edac2b69cb455af6c90c9c43a4ec91a0d2e8dca590edf2339931c08c58f239565a601280f9b81a4d5ab4c742ad91740bd96e0a26bab633aaa04cc16
@@ -21,11 +21,13 @@ class Features::Pulpcore < ForemanMaintain::Feature
21
21
  end
22
22
 
23
23
  def cli(args)
24
- parse_json(execute("pulp --format json #{args}"))
24
+ parse_json(execute!("pulp --format json #{args}"))
25
25
  end
26
26
 
27
27
  def running_tasks
28
28
  cli('task list --state-in running --state-in canceling')
29
+ rescue ForemanMaintain::Error::ExecutionError
30
+ []
29
31
  end
30
32
 
31
33
  def wait_for_tasks(spinner, timeout_for_tasks_status = TIMEOUT_FOR_TASKS_STATUS)
@@ -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
 
@@ -55,6 +55,10 @@ module ForemanMaintain::Utils
55
55
  raise NotImplementedError
56
56
  end
57
57
 
58
+ def restart
59
+ raise NotImplementedError
60
+ end
61
+
58
62
  def enable
59
63
  raise NotImplementedError
60
64
  end
@@ -38,6 +38,14 @@ module ForemanMaintain::Utils
38
38
  [0, db_status.last]
39
39
  end
40
40
 
41
+ def restart
42
+ command_name = ForemanMaintain.command_name
43
+ db_status(<<~MSG
44
+ Remote databases are not managed by #{command_name} and therefore was not restarted.
45
+ MSG
46
+ )
47
+ end
48
+
41
49
  def running?
42
50
  status.first == 0
43
51
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanMaintain
2
- VERSION = '1.7.3'.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.3
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-08-29 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