mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
Enable DEBUG=1 when using bundler related task
When running any logstash's command you can use DEBUG=1 which should give the user a bit more information about what LS is doing. This PR changes the behavior of bundler to make sure its run with the `--verbose` flag. Fixes #5199
This commit is contained in:
parent
99daeffac5
commit
493c50c427
1 changed files with 22 additions and 3 deletions
|
@ -104,13 +104,22 @@ module LogStash
|
|||
::Bundler.settings[:gemfile] = LogStash::Environment::GEMFILE_PATH
|
||||
::Bundler.settings[:without] = options[:without].join(":")
|
||||
|
||||
if !debug?
|
||||
# Will deal with transient network errors
|
||||
execute_bundler_with_retry(options)
|
||||
else
|
||||
options[:verbose] = true
|
||||
execute_bundler(options)
|
||||
end
|
||||
end
|
||||
|
||||
def execute_bundler_with_retry(options)
|
||||
try = 0
|
||||
# capture_stdout also traps any raised exception and pass them back as the function return [output, exception]
|
||||
output, exception = capture_stdout do
|
||||
loop do
|
||||
begin
|
||||
::Bundler.reset!
|
||||
::Bundler::CLI.start(bundler_arguments(options))
|
||||
execute_bundler(options)
|
||||
break
|
||||
rescue ::Bundler::VersionConflict => e
|
||||
$stderr.puts("Plugin version conflict, aborting")
|
||||
|
@ -132,12 +141,20 @@ module LogStash
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
raise exception if exception
|
||||
|
||||
return output
|
||||
end
|
||||
|
||||
def execute_bundler(options)
|
||||
::Bundler.reset!
|
||||
::Bundler::CLI.start(bundler_arguments(options))
|
||||
end
|
||||
|
||||
def debug?
|
||||
ENV["DEBUG"]
|
||||
end
|
||||
|
||||
# build Bundler::CLI.start arguments array from the given options hash
|
||||
# @param option [Hash] the invoke! options hash
|
||||
# @return [Array<String>] Bundler::CLI.start string arguments array
|
||||
|
@ -162,6 +179,8 @@ module LogStash
|
|||
arguments << "--all" if options[:all]
|
||||
end
|
||||
|
||||
arguments << "--verbose" if options[:verbose]
|
||||
|
||||
arguments.flatten
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue