From e390efbb10aeeb58be0ee8390a9f702f10861147 Mon Sep 17 00:00:00 2001 From: "kirby@puppetlabs.com" Date: Fri, 5 Jun 2020 11:27:49 -0700 Subject: [PATCH] Rescue and warn when graphite connection cannot be opened This commit updates vmpooler graphite stats behavior when a connection cannot be opened to the graphite server to warn instead of allowing the full backtrace to be output to stderr. Without this change a backtrace is output to stderr when a graphite connection fails. --- lib/vmpooler/graphite.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/vmpooler/graphite.rb b/lib/vmpooler/graphite.rb index c630a47..2b207c9 100644 --- a/lib/vmpooler/graphite.rb +++ b/lib/vmpooler/graphite.rb @@ -35,6 +35,8 @@ module Vmpooler socket.close end end + rescue Errno::EADDRNOTAVAIL => e + warn "Could not assign address to graphite server #{server}: #{e}" rescue StandardError => e warn "Failure logging #{path} to graphite server [#{server}:#{port}]: #{e}" end