From 6810be6d31d6e32bff68afb5a1931f54d6807b52 Mon Sep 17 00:00:00 2001 From: "Eric D. Helms" Date: Tue, 25 Jul 2023 10:00:29 -0400 Subject: [PATCH] Drop Candlepin database validation The Candlepin database validation via cpdb --validate was only viable for the Candlepin 0.9 to 2.0 upgrade path and since then has performed no function. --- definitions/checks/candlepin/validate_db.rb | 17 ---------------- definitions/features/candlepin_database.rb | 22 --------------------- 2 files changed, 39 deletions(-) delete mode 100644 definitions/checks/candlepin/validate_db.rb diff --git a/definitions/checks/candlepin/validate_db.rb b/definitions/checks/candlepin/validate_db.rb deleted file mode 100644 index 9e7e8b8a4..000000000 --- a/definitions/checks/candlepin/validate_db.rb +++ /dev/null @@ -1,17 +0,0 @@ -module Checks::Candlepin - class ValidateDb < ForemanMaintain::Check - metadata do - description 'Check to validate candlepin database' - tags :pre_upgrade - - confine do - feature(:candlepin_database)&.validate_available_in_cpdb? - end - end - - def run - result, result_msg = feature(:candlepin_database).execute_cpdb_validate_cmd - assert(result == 0, result_msg) - end - end -end diff --git a/definitions/features/candlepin_database.rb b/definitions/features/candlepin_database.rb index c5cd2d2e9..1b75258bc 100644 --- a/definitions/features/candlepin_database.rb +++ b/definitions/features/candlepin_database.rb @@ -22,26 +22,12 @@ def configuration @configuration || load_configuration end - def validate_available_in_cpdb? - check_option_using_cpdb_help('validate') - end - def check_option_using_cpdb_help(option_name, parent_cmd = '') parent_cmd = '/usr/share/candlepin/cpdb' if parent_cmd.empty? help_cmd = "#{parent_cmd} --help | grep -c '\\-\\-#{option_name}'" execute?(help_cmd) end - def execute_cpdb_validate_cmd - main_cmd = cpdb_validate_cmd - return [true, nil] if main_cmd.empty? - main_cmd += format_shell_args( - '-u' => configuration['username'], '-p' => configuration[%(password)] - ) - main_cmd += format_shell_args(extend_with_db_options) - execute_with_status(main_cmd, :hidden_patterns => [configuration['password']]) - end - def env_content_ids_with_null_content sql = <<-SQL SELECT ec.id @@ -87,12 +73,4 @@ def fetch_extra_param(url, key_name) output = /#{key_name}=([^&]*)?/.match(query_string) output[1] if output end - - def cpdb_validate_cmd - return '' unless check_option_using_cpdb_help('validate') - cmd = '/usr/share/candlepin/cpdb --validate' - return cmd unless check_option_using_cpdb_help('verbose', cmd) - cmd += ' --verbose' - cmd - end end