Add backtrace formating method

This commit is contained in:
Evgeniy L 2013-08-01 12:47:28 +04:00
parent bb2c5d1ea5
commit 3c3dbf8538
3 changed files with 23 additions and 2 deletions

View File

@ -18,6 +18,7 @@ require 'json'
require 'logger'
require 'shellwords'
require 'astute/ext/exception'
require 'astute/config'
require 'astute/logparser'
require 'astute/orchestrator'

View File

@ -0,0 +1,20 @@
# Copyright 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
class Exception
def format_backtrace
backtrace.join("\n")
end
end

View File

@ -188,7 +188,7 @@ module Astute
begin
Astute::RedhatChecker.new(ctx, credentials).check_redhat_credentials
rescue Exception => e
Astute.logger.error("Error #{e.message} traceback #{e.backtrace.inspect}")
Astute.logger.error("Error #{e.message} traceback #{e.format_backtrace}")
raise StopIteration
end
end
@ -198,7 +198,7 @@ module Astute
begin
Astute::RedhatChecker.new(ctx, credentials).check_redhat_licenses(nodes)
rescue Exception => e
Astute.logger.error("Error #{e.message} traceback #{e.backtrace.inspect}")
Astute.logger.error("Error #{e.message} traceback #{e.format_backtrace}")
raise StopIteration
end
end