foreman_maintain 0.1.6 → 0.2.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.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +48 -10
  3. data/bin/foreman-maintain-rotate-tar +18 -0
  4. data/definitions/checks/backup/certs_tar_exist.rb +24 -0
  5. data/definitions/checks/backup/directory_ready.rb +21 -0
  6. data/definitions/checks/candlepin/db_up.rb +29 -0
  7. data/definitions/checks/check_epel_repository.rb +21 -0
  8. data/definitions/checks/foreman/db_up.rb +29 -0
  9. data/definitions/checks/hammer_ping.rb +3 -1
  10. data/definitions/checks/mongo/db_up.rb +29 -0
  11. data/definitions/checks/mongo/tools_installed.rb +31 -0
  12. data/definitions/checks/repositories/validate.rb +0 -3
  13. data/definitions/checks/root_user.rb +12 -0
  14. data/definitions/features/candlepin.rb +16 -0
  15. data/definitions/features/candlepin_database.rb +3 -1
  16. data/definitions/features/downstream.rb +21 -22
  17. data/definitions/features/foreman_database.rb +2 -0
  18. data/definitions/features/foreman_proxy.rb +70 -7
  19. data/definitions/features/foreman_server.rb +29 -0
  20. data/definitions/features/foreman_tasks.rb +5 -1
  21. data/definitions/features/hammer.rb +158 -3
  22. data/definitions/features/installer.rb +106 -0
  23. data/definitions/features/instance.rb +39 -0
  24. data/definitions/features/katello.rb +43 -0
  25. data/definitions/features/mongo.rb +159 -0
  26. data/definitions/features/pulp.rb +30 -0
  27. data/definitions/features/puppet.rb +21 -0
  28. data/definitions/features/puppet_server.rb +2 -6
  29. data/definitions/features/service.rb +134 -0
  30. data/definitions/features/sync_plans.rb +1 -1
  31. data/definitions/features/tar.rb +69 -0
  32. data/definitions/procedures/backup/accessibility_confirmation.rb +14 -0
  33. data/definitions/procedures/backup/clean.rb +16 -0
  34. data/definitions/procedures/backup/compress_data.rb +26 -0
  35. data/definitions/procedures/backup/config_files.rb +36 -0
  36. data/definitions/procedures/backup/metadata.rb +56 -0
  37. data/definitions/procedures/backup/offline/candlepin_db.rb +57 -0
  38. data/definitions/procedures/backup/offline/foreman_db.rb +57 -0
  39. data/definitions/procedures/backup/offline/mongo.rb +56 -0
  40. data/definitions/procedures/backup/online/candlepin_db.rb +20 -0
  41. data/definitions/procedures/backup/online/foreman_db.rb +20 -0
  42. data/definitions/procedures/backup/online/mongo.rb +21 -0
  43. data/definitions/procedures/backup/online/pg_global_objects.rb +23 -0
  44. data/definitions/procedures/backup/online/safety_confirmation.rb +25 -0
  45. data/definitions/procedures/backup/prepare_directory.rb +29 -0
  46. data/definitions/procedures/backup/pulp.rb +68 -0
  47. data/definitions/procedures/backup/snapshot/clean_mount.rb +24 -0
  48. data/definitions/procedures/backup/snapshot/logical_volume_confirmation.rb +47 -0
  49. data/definitions/procedures/backup/snapshot/mount_base.rb +27 -0
  50. data/definitions/procedures/backup/snapshot/mount_candlepin_db.rb +48 -0
  51. data/definitions/procedures/backup/snapshot/mount_foreman_db.rb +48 -0
  52. data/definitions/procedures/backup/snapshot/mount_mongo.rb +35 -0
  53. data/definitions/procedures/backup/snapshot/mount_pulp.rb +24 -0
  54. data/definitions/procedures/backup/snapshot/prepare_mount.rb +16 -0
  55. data/definitions/procedures/foreman_tasks/fetch_tasks_status.rb +1 -0
  56. data/definitions/procedures/hammer_setup.rb +4 -39
  57. data/definitions/procedures/installer/upgrade.rb +1 -21
  58. data/definitions/procedures/repositories/setup.rb +0 -4
  59. data/definitions/procedures/service/base.rb +31 -0
  60. data/definitions/procedures/service/disable.rb +14 -0
  61. data/definitions/procedures/service/enable.rb +14 -0
  62. data/definitions/procedures/service/list.rb +26 -0
  63. data/definitions/procedures/service/restart.rb +49 -0
  64. data/definitions/procedures/service/start.rb +14 -0
  65. data/definitions/procedures/service/status.rb +14 -0
  66. data/definitions/procedures/service/stop.rb +14 -0
  67. data/definitions/scenarios/backup.rb +242 -0
  68. data/definitions/scenarios/services.rb +156 -0
  69. data/definitions/scenarios/upgrade_to_satellite_6_2.rb +2 -2
  70. data/definitions/scenarios/upgrade_to_satellite_6_2_z.rb +2 -2
  71. data/definitions/scenarios/upgrade_to_satellite_6_3.rb +2 -2
  72. data/definitions/scenarios/upgrade_to_satellite_6_3_z.rb +2 -2
  73. data/definitions/scenarios/upgrade_to_satellite_6_4.rb +79 -0
  74. data/definitions/scenarios/upgrade_to_satellite_6_4_z.rb +79 -0
  75. data/lib/foreman_maintain.rb +5 -0
  76. data/lib/foreman_maintain/cli.rb +4 -0
  77. data/lib/foreman_maintain/cli/backup_command.rb +157 -0
  78. data/lib/foreman_maintain/cli/base.rb +18 -8
  79. data/lib/foreman_maintain/cli/service_command.rb +112 -0
  80. data/lib/foreman_maintain/cli/transform_clamp_options.rb +1 -1
  81. data/lib/foreman_maintain/concerns/base_database.rb +57 -5
  82. data/lib/foreman_maintain/concerns/hammer.rb +0 -9
  83. data/lib/foreman_maintain/concerns/metadata.rb +3 -1
  84. data/lib/foreman_maintain/concerns/reporter.rb +12 -0
  85. data/lib/foreman_maintain/concerns/system_helpers.rb +45 -2
  86. data/lib/foreman_maintain/detector.rb +3 -3
  87. data/lib/foreman_maintain/error.rb +12 -0
  88. data/lib/foreman_maintain/executable.rb +29 -6
  89. data/lib/foreman_maintain/feature.rb +15 -0
  90. data/lib/foreman_maintain/param.rb +4 -3
  91. data/lib/foreman_maintain/reporter.rb +6 -2
  92. data/lib/foreman_maintain/reporter/cli_reporter.rb +26 -10
  93. data/lib/foreman_maintain/runner.rb +26 -15
  94. data/lib/foreman_maintain/runner/execution.rb +5 -1
  95. data/lib/foreman_maintain/scenario.rb +11 -3
  96. data/lib/foreman_maintain/upgrade_runner.rb +0 -2
  97. data/lib/foreman_maintain/utils.rb +2 -2
  98. data/lib/foreman_maintain/utils/command_runner.rb +0 -2
  99. data/lib/foreman_maintain/utils/hash_tools.rb +21 -0
  100. data/lib/foreman_maintain/utils/mongo_core.rb +37 -0
  101. data/lib/foreman_maintain/version.rb +1 -1
  102. metadata +58 -8
  103. data/definitions/features/katello_service.rb +0 -118
  104. data/definitions/procedures/katello_service/restart.rb +0 -24
  105. data/definitions/procedures/katello_service/start.rb +0 -19
  106. data/definitions/procedures/katello_service/stop.rb +0 -17
  107. data/lib/foreman_maintain/utils/facter.rb +0 -21
  108. data/lib/foreman_maintain/utils/hammer.rb +0 -79
@@ -4,8 +4,8 @@ module ForemanMaintain
4
4
  extend Concerns::Finders
5
5
  attr_reader :options
6
6
  def_delegators :execution,
7
- :success?, :skipped?, :fail?, :warning?, :output,
8
- :assumeyes?, :whitelisted?,
7
+ :success?, :skipped?, :fail?, :aborted?, :warning?, :output,
8
+ :assumeyes?, :whitelisted?, :ask_decision,
9
9
  :execution, :puts, :print, :with_spinner, :ask, :storage
10
10
 
11
11
  def initialize(options = {})
@@ -72,15 +72,34 @@ module ForemanMaintain
72
72
  raise Error::Warn, message
73
73
  end
74
74
 
75
+ def skip(message = '')
76
+ raise Error::Skip, message
77
+ end
78
+
79
+ def abort!(message = '')
80
+ raise Error::Abort, message
81
+ end
82
+
75
83
  # rubocop:disable Naming/AccessorMethodName
76
84
  def set_fail(message)
77
- execution.status = :fail
78
- execution.output << message
85
+ set_status(:fail, message)
79
86
  end
80
87
 
81
88
  def set_warn(message)
82
- execution.status = :warning
83
- execution.output << message
89
+ set_status(:warning, message)
90
+ end
91
+
92
+ def set_skip(message)
93
+ set_status(:skipped, message)
94
+ end
95
+
96
+ def set_abort(message)
97
+ set_status(:abort, message)
98
+ end
99
+
100
+ def set_status(status, message)
101
+ execution.status = status
102
+ execution.output << message if message && !message.empty?
84
103
  end
85
104
  # rubocop:enable Naming/AccessorMethodName
86
105
 
@@ -119,6 +138,10 @@ module ForemanMaintain
119
138
  unless skipped?
120
139
  run
121
140
  end
141
+ rescue Error::Skip => e
142
+ set_skip(e.message)
143
+ rescue Error::Abort => e
144
+ set_abort(e.message)
122
145
  end
123
146
 
124
147
  # method defined both on object and class to ensure we work always with object
@@ -1,6 +1,7 @@
1
1
  module ForemanMaintain
2
2
  class Feature
3
3
  include Concerns::Logger
4
+ include Concerns::Reporter
4
5
  include Concerns::SystemHelpers
5
6
  include Concerns::Metadata
6
7
  include Concerns::Finders
@@ -14,10 +15,24 @@ module ForemanMaintain
14
15
  "#{self.class.metadata[:label]}<#{self.class.name}>"
15
16
  end
16
17
 
18
+ # Override method with hash of applicable services for feature.
19
+ # Services have a number for priority in order to ensure
20
+ # they are started and stopped in the correct order.
21
+ # example:
22
+ # { :foo_service => 10, :bar_service => 20 }
23
+ def services
24
+ {}
25
+ end
26
+
17
27
  # Override to generate additional feature instances that can't be
18
28
  # autodetected directly
19
29
  def additional_features
20
30
  []
21
31
  end
32
+
33
+ # list of config files the feature uses
34
+ def config_files
35
+ []
36
+ end
22
37
  end
23
38
  end
@@ -3,7 +3,7 @@ module ForemanMaintain
3
3
  attr_reader :name, :description, :options
4
4
 
5
5
  def initialize(name, description, options, &block)
6
- options.validate_options!(:description, :required, :flag, :array, :allowed_values)
6
+ options.validate_options!(:description, :required, :flag, :array, :allowed_values, :default)
7
7
  @name = name
8
8
  @description = description || options[:description] || ''
9
9
  @options = options
@@ -12,6 +12,7 @@ module ForemanMaintain
12
12
  @block = block
13
13
  @allowed_values = @options.fetch(:allowed_values, [])
14
14
  @array = @options.fetch(:array, false)
15
+ @default = @options.fetch(:default, nil)
15
16
  end
16
17
 
17
18
  def flag?
@@ -26,8 +27,9 @@ module ForemanMaintain
26
27
  @array
27
28
  end
28
29
 
29
- # rubocop:disable Metrics/PerceivedComplexity,Metrics/CyclomaticComplexity
30
30
  def process(value)
31
+ # default values imply we can not pass nil if there is non-nil default
32
+ value = @default if value.nil?
31
33
  value = process_array(value) if array?
32
34
  value = @block.call(value) if @block
33
35
  if value.nil? && required?
@@ -38,7 +40,6 @@ module ForemanMaintain
38
40
  validate_with_allowed_values(value)
39
41
  value
40
42
  end
41
- # rubocop:enable Metrics/PerceivedComplexity,Metrics/CyclomaticComplexity
42
43
 
43
44
  def process_array(value)
44
45
  if value.is_a?(Array)
@@ -58,6 +58,10 @@ module ForemanMaintain
58
58
  end
59
59
  end
60
60
 
61
+ def assumeyes=(assume)
62
+ @assumeyes = !!assume
63
+ end
64
+
61
65
  private
62
66
 
63
67
  def single_step_decision(step)
@@ -85,7 +89,7 @@ module ForemanMaintain
85
89
  decision
86
90
  end
87
91
 
88
- # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
92
+ # rubocop:disable Metrics/MethodLength
89
93
  def ask_to_select(message, steps)
90
94
  if assumeyes?
91
95
  puts('(assuming first option)')
@@ -105,7 +109,7 @@ module ForemanMaintain
105
109
  end
106
110
  end
107
111
  end
108
- # rubocop:enable Metrics/MethodLength,Metrics/AbcSize
112
+ # rubocop:enable Metrics/MethodLength
109
113
 
110
114
  # loop over the block until it returns some non-false value
111
115
  def until_valid_decision
@@ -4,6 +4,7 @@ require 'highline'
4
4
  module ForemanMaintain
5
5
  class Reporter
6
6
  class CLIReporter < Reporter
7
+ include Concerns::Logger
7
8
  # Simple spinner able to keep updating current line
8
9
  class Spinner
9
10
  def initialize(reporter, interval = 0.1)
@@ -81,11 +82,13 @@ module ForemanMaintain
81
82
  end
82
83
 
83
84
  def before_scenario_starts(scenario)
85
+ logger.info("=== Scenario '#{scenario.description || scenario.class}' started ===")
84
86
  puts "Running #{scenario.description || scenario.class}"
85
87
  hline('=')
86
88
  end
87
89
 
88
90
  def before_execution_starts(execution)
91
+ logger.info("--- Execution step '#{execution.name}' started ---")
89
92
  puts(execution_info(execution, ''))
90
93
  end
91
94
 
@@ -141,19 +144,16 @@ module ForemanMaintain
141
144
  def after_execution_finishes(execution)
142
145
  puts_status(execution.status)
143
146
  puts(execution.output) unless execution.output.empty?
144
- if execution.status == :already_run
145
- puts(<<-MESSAGE.strip_heredoc)
146
- The step was skipped as it was already run and it is marked
147
- as run_once. Use --force to enforce the execution.
148
- MESSAGE
149
- end
147
+ puts(already_run_msg) if execution.status == :already_run
150
148
  hline
151
149
  new_line_if_needed
150
+ logger.info("--- Execution step '#{execution.name}' finished ---")
152
151
  end
153
152
 
154
153
  def after_scenario_finishes(scenario)
155
154
  scenario_failure_message(scenario)
156
155
  puts "\n"
156
+ logger.info("=== Scenario '#{scenario.description || scenario.class}' finished ===")
157
157
  end
158
158
 
159
159
  def clear_line
@@ -181,13 +181,13 @@ module ForemanMaintain
181
181
  ask_to_select('Select step to continue', steps, &:runtime_message)
182
182
  end
183
183
 
184
- def ask_decision(message)
184
+ def ask_decision(message, options = 'y(yes), n(no), q(quit)')
185
185
  if assumeyes?
186
186
  print("#{message} (assuming yes)")
187
187
  return :yes
188
188
  end
189
189
  until_valid_decision do
190
- filter_decision(ask("#{message}, [y(yes), n(no), q(quit)]"))
190
+ filter_decision(ask("#{message}, [#{options}]"))
191
191
  end
192
192
  ensure
193
193
  clear_line
@@ -202,7 +202,7 @@ module ForemanMaintain
202
202
  decision
203
203
  end
204
204
 
205
- # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
205
+ # rubocop:disable Metrics/MethodLength
206
206
  def ask_to_select(message, steps)
207
207
  if assumeyes?
208
208
  puts('(assuming first option)')
@@ -224,7 +224,7 @@ module ForemanMaintain
224
224
  ensure
225
225
  clear_line
226
226
  end
227
- # rubocop:enable Metrics/MethodLength,Metrics/AbcSize
227
+ # rubocop:enable Metrics/MethodLength
228
228
 
229
229
  # loop over the block until it returns some non-false value
230
230
  def until_valid_decision
@@ -252,6 +252,7 @@ module ForemanMaintain
252
252
  def status_label(status)
253
253
  mapping = { :success => { :label => '[OK]', :color => :green },
254
254
  :fail => { :label => '[FAIL]', :color => :red },
255
+ :abort => { :label => '[ABORTED]', :color => :red },
255
256
  :running => { :label => '[RUNNING]', :color => :blue },
256
257
  :skipped => { :label => '[SKIPPED]', :color => :yellow },
257
258
  :already_run => { :label => '[ALREADY RUN]', :color => :yellow },
@@ -278,6 +279,16 @@ module ForemanMaintain
278
279
  Scenario [#{scenario.description}] failed.
279
280
  MESSAGE
280
281
  recommend = []
282
+
283
+ steps_with_abort = scenario.steps_with_abort(:whitelisted => false)
284
+ unless steps_with_abort.empty?
285
+ message << format(<<-MESSAGE.strip_heredoc, format_steps(steps_with_abort, "\n", 2))
286
+ The processing was aborted by user during the following steps:
287
+
288
+ %s
289
+ MESSAGE
290
+ end
291
+
281
292
  steps_with_error = scenario.steps_with_error(:whitelisted => false)
282
293
  unless steps_with_error.empty?
283
294
  message << format(<<-MESSAGE.strip_heredoc, format_steps(steps_with_error, "\n", 2))
@@ -313,6 +324,11 @@ module ForemanMaintain
313
324
  def format_steps(steps, join_with = ', ', indent = 0)
314
325
  steps.map { |s| "#{' ' * indent}[#{s.label_dashed}]" }.join(join_with)
315
326
  end
327
+
328
+ def already_run_msg
329
+ 'The step was skipped as it was already run and it is marked' \
330
+ ' as run_once. Use --force to enforce the execution.'
331
+ end
316
332
  end
317
333
  end
318
334
  end
@@ -1,15 +1,17 @@
1
1
  module ForemanMaintain
2
2
  # Class responsible for running the scenario
3
3
  class Runner
4
+ include Concerns::Logger
4
5
  attr_reader :reporter, :exit_code
5
6
 
6
7
  require 'foreman_maintain/runner/execution'
7
8
  require 'foreman_maintain/runner/stored_execution'
8
9
  def initialize(reporter, scenarios, options = {})
9
- options.validate_options!(:assumeyes, :whitelist, :force)
10
+ options.validate_options!(:assumeyes, :whitelist, :force, :rescue_scenario)
10
11
  @assumeyes = options.fetch(:assumeyes, false)
11
12
  @whitelist = options.fetch(:whitelist, [])
12
13
  @force = options.fetch(:force, false)
14
+ @rescue_scenario = options.fetch(:rescue_scenario, nil)
13
15
  @reporter = reporter
14
16
  @scenarios = Array(scenarios)
15
17
  @quit = false
@@ -28,11 +30,15 @@ module ForemanMaintain
28
30
  def run
29
31
  @scenarios.each do |scenario|
30
32
  run_scenario(scenario)
31
- break if @quit
33
+ next unless @quit
34
+ if @rescue_scenario
35
+ logger.debug('=== Rescue scenario found. Executing ===')
36
+ execute_scenario_steps(@rescue_scenario, true)
37
+ end
38
+ break
32
39
  end
33
40
  end
34
41
 
35
- # rubocop:disable Metrics/CyclomaticComplexity
36
42
  def run_scenario(scenario, confirm = true)
37
43
  return if scenario.steps.empty?
38
44
  raise 'The runner is already in quit state' if quit?
@@ -47,7 +53,6 @@ module ForemanMaintain
47
53
  @last_scenario = scenario unless scenario.steps.empty?
48
54
  @exit_code = 1 if scenario.failed?
49
55
  end
50
- # rubocop:enable Metrics/CyclomaticComplexity
51
56
 
52
57
  def whitelisted_step?(step)
53
58
  @whitelist.include?(step.label_dashed.to_s)
@@ -55,7 +60,8 @@ module ForemanMaintain
55
60
 
56
61
  def confirm_scenario(scenario)
57
62
  return unless @last_scenario
58
- decision = if @last_scenario.steps_with_error(:whitelisted => false).any?
63
+ decision = if @last_scenario.steps_with_error(:whitelisted => false).any? ||
64
+ @last_scenario.steps_with_abort(:whitelisted => false).any?
59
65
  :quit
60
66
  elsif @last_scenario.steps_with_warning(:whitelisted => false).any?
61
67
  reporter.ask_decision("Continue with [#{scenario.description}]")
@@ -84,9 +90,10 @@ module ForemanMaintain
84
90
 
85
91
  private
86
92
 
87
- def execute_scenario_steps(scenario)
93
+ def execute_scenario_steps(scenario, force = false)
88
94
  scenario.before_scenarios.flatten.each { |before_scenario| run_scenario(before_scenario) }
89
- return if quit? # the before scenarios caused the stop of the execution
95
+ confirm_scenario(scenario)
96
+ return if !force && quit? # the before scenarios caused the stop of the execution
90
97
  @reporter.before_scenario_starts(scenario)
91
98
  run_steps(scenario, scenario.steps)
92
99
  @reporter.after_scenario_finishes(scenario)
@@ -94,9 +101,9 @@ module ForemanMaintain
94
101
 
95
102
  def run_steps(scenario, steps)
96
103
  @steps_to_run = ForemanMaintain::DependencyGraph.sort(steps)
97
- while !@quit && !@steps_to_run.empty?
104
+ while (scenario.run_strategy == :fail_slow || !@quit) && !@steps_to_run.empty?
98
105
  execution = run_step(@steps_to_run.shift)
99
- post_step_decisions(scenario, execution)
106
+ post_step_decisions(scenario, execution) unless execution.success?
100
107
  end
101
108
  end
102
109
 
@@ -114,15 +121,19 @@ module ForemanMaintain
114
121
 
115
122
  def post_step_decisions(scenario, execution)
116
123
  step = execution.step
117
- next_steps_decision = ask_about_offered_steps(step)
118
- if next_steps_decision != :yes &&
119
- execution.fail? && !execution.whitelisted? &&
120
- scenario.run_strategy == :fail_fast
124
+ if execution.aborted?
121
125
  ask_to_quit
126
+ else
127
+ next_steps_decision = ask_about_offered_steps(step)
128
+ if next_steps_decision != :yes &&
129
+ execution.fail? && !execution.whitelisted? &&
130
+ scenario.run_strategy == :fail_fast
131
+ ask_to_quit
132
+ end
122
133
  end
123
134
  end
124
135
 
125
- # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity
136
+ # rubocop:disable Metrics/MethodLength
126
137
  def ask_about_offered_steps(step)
127
138
  if assumeyes? && rerun_check?(step)
128
139
  @reporter.puts 'Check still failing after attempt to fix. Skipping'
@@ -143,7 +154,7 @@ module ForemanMaintain
143
154
  end
144
155
  end
145
156
  end
146
- # rubocop:enable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity
157
+ # rubocop:enable Metrics/MethodLength
147
158
 
148
159
  def rerun_check?(step)
149
160
  @last_decision_step == step
@@ -4,7 +4,7 @@ module ForemanMaintain
4
4
  class Execution
5
5
  include Concerns::Logger
6
6
  extend Forwardable
7
- def_delegators :reporter, :with_spinner, :puts, :print, :ask, :assumeyes?
7
+ def_delegators :reporter, :with_spinner, :puts, :print, :ask, :assumeyes?, :ask_decision
8
8
 
9
9
  # Step performed as part of the execution
10
10
  attr_reader :step
@@ -47,6 +47,10 @@ module ForemanMaintain
47
47
  @status == :fail
48
48
  end
49
49
 
50
+ def aborted?
51
+ @status == :abort
52
+ end
53
+
50
54
  def skipped?
51
55
  @status == :skipped
52
56
  end
@@ -108,6 +108,10 @@ module ForemanMaintain
108
108
  filter_whitelisted(executed_steps.find_all(&:fail?), options)
109
109
  end
110
110
 
111
+ def steps_with_abort(options = {})
112
+ filter_whitelisted(executed_steps.find_all(&:aborted?), options)
113
+ end
114
+
111
115
  def steps_with_warning(options = {})
112
116
  filter_whitelisted(executed_steps.find_all(&:warning?), options)
113
117
  end
@@ -124,7 +128,9 @@ module ForemanMaintain
124
128
  end
125
129
 
126
130
  def passed?
127
- (steps_with_error(:whitelisted => false) + steps_with_warning(:whitelisted => false)).empty?
131
+ (steps_with_abort(:whitelisted => false) +
132
+ steps_with_error(:whitelisted => false) +
133
+ steps_with_warning(:whitelisted => false)).empty?
128
134
  end
129
135
 
130
136
  def failed?
@@ -149,8 +155,10 @@ module ForemanMaintain
149
155
  add_steps([step]) unless step.nil?
150
156
  end
151
157
 
152
- def add_step_with_context(definition)
153
- add_step(definition.send(:new, context.params_for(definition))) if definition.present?
158
+ def add_step_with_context(definition, extra_params = {})
159
+ if definition.present?
160
+ add_step(definition.send(:new, context.params_for(definition).merge(extra_params)))
161
+ end
154
162
  end
155
163
 
156
164
  def add_steps_with_context(*definitions)
@@ -155,7 +155,6 @@ module ForemanMaintain
155
155
 
156
156
  private
157
157
 
158
- # rubocop:disable Metrics/AbcSize
159
158
  def rollback_pre_migrations
160
159
  raise "Unexpected phase #{phase}, expecting pre_migrations" unless phase == :pre_migrations
161
160
  rollback_needed = scenario(:pre_migrations).steps.any? { |s| s.executed? && s.success? }
@@ -175,7 +174,6 @@ module ForemanMaintain
175
174
  The upgrade failed and system was restored to pre-upgrade state.
176
175
  MESSAGE
177
176
  end
178
- # rubocop:enable Metrics/AbcSize
179
177
 
180
178
  def with_non_empty_scenario(phase)
181
179
  next_scenario = scenario(phase)