Skip to content

Commit

Permalink
Change --whitelist to --skip
Browse files Browse the repository at this point in the history
The whitelist option doesn't accurately capture what will happen
when steps are supplied to the option. The change to --skip can help
to better understand that steps included with it will be skipped.
  • Loading branch information
ehelms committed Sep 21, 2023
1 parent 249ce77 commit 1fbaad5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
14 changes: 7 additions & 7 deletions lib/foreman_maintain/cli/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def run_scenario(scenarios, rescue_scenario = nil)
@runner ||=
ForemanMaintain::Runner.new(reporter, scenarios,
:assumeyes => option_wrapper('assumeyes?'),
:whitelist => option_wrapper('whitelist') || [],
:whitelist => option_wrapper('skip') || [],
:force => option_wrapper('force?'),
:rescue_scenario => rescue_scenario)
runner.run
Expand Down Expand Up @@ -153,7 +153,7 @@ def self.tags_option
end

# rubocop:disable Metrics/MethodLength
def self.interactive_option(opts = %w[assumeyes whitelist force plaintext])
def self.interactive_option(opts = %w[assumeyes skip force plaintext])
delete_duplicate_assumeyes_if_any

if opts.include?('assumeyes')
Expand All @@ -163,11 +163,11 @@ def self.interactive_option(opts = %w[assumeyes whitelist force plaintext])
end
end

if opts.include?('whitelist')
option(['-w', '--whitelist'], 'whitelist',
'Comma-separated list of labels of steps to be skipped') do |whitelist|
raise ArgumentError, 'value not specified' if whitelist.nil? || whitelist.empty?
whitelist.split(',').map(&:strip)
if opts.include?('skip')
option(['--skip'], 'steps',
'Comma-separated list of step labels to be skipped') do |steps|
raise ArgumentError, 'value not specified' if steps.nil? || steps.empty?
steps.split(',').map(&:strip)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/foreman_maintain/cli/upgrade_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def upgrade_runner
validate_target_version!
@upgrade_runner = ForemanMaintain::UpgradeRunner.new(target_version, reporter,
:assumeyes => assumeyes?,
:whitelist => whitelist || [],
:whitelist => skip || [],
:force => force?).tap(&:load)
end

Expand Down
4 changes: 2 additions & 2 deletions lib/foreman_maintain/reporter/cli_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,13 @@ def scenario_failure_message(scenario)
contact #{scenario.detector.feature(:instance).project_support_entity}.
In case the failures are false positives, use
--whitelist="#{whitelist_labels}"
--skip="%s"
MESSAGE
else
format(<<-MESSAGE.strip_heredoc)
Resolve the failed steps and rerun the command.
In case the failures are false positives, use
--whitelist="#{whitelist_labels}"
--skip="%s"
MESSAGE
end
end
Expand Down
12 changes: 6 additions & 6 deletions test/lib/reporter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def decision_question(description)
contact Red Hat Technical Support.
In case the failures are false positives, use
--whitelist="dummy-check-fail,dummy-check-fail2"
--skip="dummy-check-fail,dummy-check-fail2"
MESSAGE
end

Expand Down Expand Up @@ -168,7 +168,7 @@ def decision_question(description)
Resolve the failed steps and rerun the command.
In case the failures are false positives, use
--whitelist="dummy-check-fail,dummy-check-fail2"
--skip="dummy-check-fail,dummy-check-fail2"
MESSAGE
end

Expand Down Expand Up @@ -219,7 +219,7 @@ def decision_question(description)
Resolve the failed steps and rerun the command.
In case the failures are false positives, use
--whitelist="dummy-check-fail"
--skip="dummy-check-fail"
The steps in warning state itself might not mean there is an error,
but it should be reviewed to ensure the behavior is expected
Expand Down Expand Up @@ -256,7 +256,7 @@ def decision_question(description)
contact Red Hat Technical Support.
In case the failures are false positives, use
--whitelist="dummy-check-fail"
--skip="dummy-check-fail"
The steps in warning state itself might not mean there is an error,
but it should be reviewed to ensure the behavior is expected
Expand Down Expand Up @@ -307,7 +307,7 @@ def decision_question(description)
Resolve the failed steps and rerun the command.
In case the failures are false positives, use
--whitelist="dummy-check-fail"
--skip="dummy-check-fail"
The steps in warning state itself might not mean there is an error,
but it should be reviewed to ensure the behavior is expected
Expand Down Expand Up @@ -338,7 +338,7 @@ def decision_question(description)
Resolve the failed steps and rerun the command.
In case the failures are false positives, use
--whitelist="dummy-check-fail"
--skip="dummy-check-fail"
MESSAGE
end

Expand Down

0 comments on commit 1fbaad5

Please sign in to comment.