Fix usage of log level in inspec plugin installation logic

Signed-off-by: Nik08 <nikita.mathur@progress.com>
This commit is contained in:
Nik08 2024-05-20 15:22:18 +05:30
parent 7924290714
commit 455f1a0d6f
2 changed files with 5 additions and 3 deletions

View file

@ -425,8 +425,10 @@ module InspecPlugins
"our apologies for the misunderstanding, and open an issue " \ "our apologies for the misunderstanding, and open an issue " \
"at https://github.com/inspec/inspec/issues/new") "at https://github.com/inspec/inspec/issues/new")
ui.exit Inspec::UI::EXIT_PLUGIN_ERROR ui.exit Inspec::UI::EXIT_PLUGIN_ERROR
rescue Inspec::Plugin::V2::InstallError rescue Inspec::Plugin::V2::InstallError => e
raise if Inspec::Log.level == :debug # This change is required for Ruby 3.3 upgrade
# Using Inspec::Log::level breaks with error `undefined method nil` in Ruby log library
Inspec::Log.debug e.backtrace
results = installer.search(plugin_name, exact: true) results = installer.search(plugin_name, exact: true)
source_host = URI(options[:source] || "https://rubygems.org/").host source_host = URI(options[:source] || "https://rubygems.org/").host

View file

@ -343,7 +343,7 @@ class PluginManagerCliInstall < Minitest::Test
assert_includes install_result.stdout, "DEBUG" assert_includes install_result.stdout, "DEBUG"
assert_includes install_result.stderr, "can't activate rake" assert_includes install_result.stdout, "Unknown error occurred - installation failed"
assert_exit_code 1, install_result assert_exit_code 1, install_result
end end