-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(VANAGON-57) inform on STDERR, not STDOUT #474
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,7 +78,7 @@ def file | |
# | ||
# @raise [RuntimeError] an exception is raised if the sum does not match the sum of the file | ||
def verify # rubocop:disable Metrics/AbcSize | ||
puts "Verifying file: #{file} against sum: '#{sum}'" | ||
$stderr.puts "Verifying file: #{file} against sum: '#{sum}'" | ||
actual = get_sum(File.join(workdir, file), sum_type) | ||
return true if sum == actual | ||
|
||
|
@@ -92,7 +92,7 @@ def download(target_url, target_file = nil, headers = { "Accept-Encoding" => "id | |
uri = URI.parse(target_url.to_s) | ||
target_file ||= File.basename(uri.path) | ||
|
||
puts "Downloading file '#{target_file}' from url '#{target_url}'" | ||
$stderr.puts "Downloading file '#{target_file}' from url '#{target_url}'" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also should go to stdout |
||
|
||
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http| | ||
http.request(Net::HTTP::Get.new(uri, headers)) do |response| | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,8 +43,8 @@ def filter_out_components(only_build) | |
# flatten all the results in to one array and set project.components to that. | ||
@project.components = only_build.flat_map { |comp| @project.filter_component(comp) }.uniq | ||
if @verbose | ||
puts "Only building:" | ||
@project.components.each { |comp| puts comp.name } | ||
$stderr.puts "Only building:" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should go to stdout |
||
@project.components.each { |comp| $stderr.puts comp.name } | ||
end | ||
end | ||
|
||
|
@@ -117,7 +117,7 @@ def run # rubocop:disable Metrics/AbcSize | |
|
||
@engine.startup(@workdir) | ||
|
||
puts "Target is #{@engine.target}" | ||
$stderr.puts "Target is #{@engine.target}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should go to stdout |
||
retry_task { install_build_dependencies } | ||
retry_task { @project.fetch_sources(@workdir) } | ||
|
||
|
@@ -133,8 +133,8 @@ def run # rubocop:disable Metrics/AbcSize | |
cleanup_workdir | ||
end | ||
rescue => e | ||
puts e | ||
puts e.backtrace.join("\n") | ||
$stderr.puts e | ||
$stderr.puts e.backtrace.join("\n") | ||
raise e | ||
ensure | ||
if ["hardware", "ec2"].include?(@engine.name) | ||
|
@@ -148,7 +148,7 @@ def render | |
raise Vanagon::Error, "Project requires a version set, all is lost." | ||
end | ||
|
||
puts "rendering Makefile" | ||
$stderr.puts "rendering Makefile" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should go to stdout |
||
retry_task { @project.fetch_sources(@workdir) } | ||
@project.make_bill_of_materials(@workdir) | ||
@project.generate_packaging_artifacts(@workdir) | ||
|
@@ -159,7 +159,7 @@ def prepare(workdir = nil) # rubocop:disable Metrics/AbcSize | |
@workdir = workdir ? FileUtils.mkdir_p(workdir).first : Dir.mktmpdir | ||
@engine.startup(@workdir) | ||
|
||
puts "Devkit on #{@engine.target}" | ||
$stderr.puts "Devkit on #{@engine.target}" | ||
|
||
install_build_dependencies | ||
@project.fetch_sources(@workdir) | ||
|
@@ -169,8 +169,8 @@ def prepare(workdir = nil) # rubocop:disable Metrics/AbcSize | |
@engine.ship_workdir(@workdir) | ||
@engine.dispatch("(cd #{@engine.remote_workdir}; #{@platform.make} #{@project.name}-project)") | ||
rescue => e | ||
puts e | ||
puts e.backtrace.join("\n") | ||
$stderr.puts e | ||
$stderr.puts e.backtrace.join("\n") | ||
raise e | ||
end | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,17 +57,17 @@ def instance | |
end | ||
|
||
def select_target | ||
puts "Instance created id: #{instance.id}" | ||
puts "Created instance waiting for status ok" | ||
$stderr.puts "Instance created id: #{instance.id}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should go to stdout |
||
$stderr.puts "Created instance waiting for status ok" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should go to stdout |
||
@ec2.wait_until(:instance_status_ok, instance_ids: [instance.id]) | ||
puts "Instance running" | ||
$stderr.puts "Instance running" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should go to stdout |
||
@target = instance.private_ip_address | ||
rescue ::Aws::Waiters::Errors::WaiterFailed => error | ||
fail "Failed to wait for ec2 instance to start got error #{error}" | ||
end | ||
|
||
def teardown | ||
puts "Destroying instance on AWS id: #{instance.id}" | ||
$stderr.puts "Destroying instance on AWS id: #{instance.id}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should go to stdout |
||
instances.batch_terminate! | ||
end | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ def polling_lock(host) | |
Vanagon::Driver.logger.info "Polling for a lock on #{host}." | ||
@lockman.polling_lock(host, VANAGON_LOCK_USER, "Vanagon automated lock") | ||
Vanagon::Driver.logger.info "Lock acquired on #{host}." | ||
puts "Lock acquired on #{host} for #{VANAGON_LOCK_USER}." | ||
$stderr.puts "Lock acquired on #{host} for #{VANAGON_LOCK_USER}." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should go to stdout |
||
host | ||
end | ||
|
||
|
@@ -33,7 +33,7 @@ def node_lock(hosts) | |
Vanagon::Driver.logger.info "Attempting to lock #{h}." | ||
if @lockman.lock(h, VANAGON_LOCK_USER, "Vanagon automated lock") | ||
Vanagon::Driver.logger.info "Lock acquired on #{h}." | ||
puts "Lock acquired on #{h} for #{VANAGON_LOCK_USER}." | ||
$stderr.puts "Lock acquired on #{h} for #{VANAGON_LOCK_USER}." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should go to stdout |
||
return h | ||
end | ||
end | ||
|
@@ -45,7 +45,7 @@ def node_lock(hosts) | |
# complete. In this case, we'll attempt to unlock the hardware | ||
def teardown | ||
Vanagon::Driver.logger.info "Removing lock on #{@target}." | ||
puts "Removing lock on #{@target}." | ||
$stderr.puts "Removing lock on #{@target}." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should go to stdout |
||
@lockman.unlock(@target, VANAGON_LOCK_USER) | ||
end | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ def read_vanagon_token(path = "~/.vanagon-token") | |
absolute_path = File.expand_path(path) | ||
return nil unless File.exist?(absolute_path) | ||
|
||
puts "Reading vmpooler token from: #{path}" | ||
$stderr.puts "Reading vmpooler token from: #{path}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should go to stdout There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is exactly the message that is screwing us up in CI by being printed to stdout. |
||
File.read(absolute_path).chomp | ||
end | ||
private :read_vanagon_token | ||
|
@@ -70,7 +70,7 @@ def read_vmfloaty_token(path = "~/.vmfloaty.yml") | |
absolute_path = File.expand_path(path) | ||
return nil unless File.exist?(absolute_path) | ||
|
||
puts "Reading vmpooler token from: #{path}" | ||
$stderr.puts "Reading vmpooler token from: #{path}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should go to stdout |
||
YAML.load_file(absolute_path)['token'] | ||
end | ||
private :read_vmfloaty_token | ||
|
@@ -119,7 +119,7 @@ def teardown | |
) | ||
if response and response["ok"] | ||
Vanagon::Driver.logger.info "#{@target} has been destroyed" | ||
puts "#{@target} has been destroyed" | ||
$stderr.puts "#{@target} has been destroyed" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should go to stdout |
||
else | ||
Vanagon::Driver.logger.info "#{@target} could not be destroyed" | ||
warn "#{@target} could not be destroyed" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ def initialize(banner, options = []) | |
end | ||
|
||
opts.on('-h', '--help', 'Display help') do | ||
puts opts | ||
$stdout.puts opts | ||
exit 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unrelated, but why would displaying help return 1 and not 0? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You know, I actually wonder who did that too. Asking for help and getting help means it did what you asked for. I'll fix that in this PR. |
||
end | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -228,7 +228,7 @@ def identifier(ident) | |
# | ||
# @param name [String] name of component to add. must be present in configdir/components and named $name.rb currently | ||
def component(name) | ||
puts "Loading #{name}" if @project.settings[:verbose] | ||
$stderr.puts "Loading #{name}" if @project.settings[:verbose] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should go to stdout |
||
if @include_components.empty? or @include_components.include?(name) | ||
component = Vanagon::Component.load_component(name, File.join(Vanagon::Driver.configdir, "components"), @project.settings, @project.platform) | ||
@project.components << component | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like it should go to stdout