From 1fbaad544c010cb1653e9c9beb29e595abad9a3f Mon Sep 17 00:00:00 2001 From: "Eric D. Helms" Date: Wed, 12 Apr 2023 13:59:53 -0400 Subject: [PATCH] Change --whitelist to --skip 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. --- lib/foreman_maintain/cli/base.rb | 14 +++++++------- lib/foreman_maintain/cli/upgrade_command.rb | 2 +- lib/foreman_maintain/reporter/cli_reporter.rb | 4 ++-- test/lib/reporter_test.rb | 12 ++++++------ 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/foreman_maintain/cli/base.rb b/lib/foreman_maintain/cli/base.rb index cb2b34933..f5fcecc4d 100644 --- a/lib/foreman_maintain/cli/base.rb +++ b/lib/foreman_maintain/cli/base.rb @@ -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 @@ -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') @@ -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 diff --git a/lib/foreman_maintain/cli/upgrade_command.rb b/lib/foreman_maintain/cli/upgrade_command.rb index ad2c02847..fef1179a6 100644 --- a/lib/foreman_maintain/cli/upgrade_command.rb +++ b/lib/foreman_maintain/cli/upgrade_command.rb @@ -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 diff --git a/lib/foreman_maintain/reporter/cli_reporter.rb b/lib/foreman_maintain/reporter/cli_reporter.rb index 1f7286697..5295fa67e 100644 --- a/lib/foreman_maintain/reporter/cli_reporter.rb +++ b/lib/foreman_maintain/reporter/cli_reporter.rb @@ -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 diff --git a/test/lib/reporter_test.rb b/test/lib/reporter_test.rb index cafeccb50..772cead57 100644 --- a/test/lib/reporter_test.rb +++ b/test/lib/reporter_test.rb @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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