Skip to content

Commit

Permalink
Proposed fix for SeattleTestbed#92
Browse files Browse the repository at this point in the history
This removes two conditional function-level `import`s of
`servicelogger.py`. As these could be reached from within a Repy
program, and Repy forbids `import`, this caused a misleading
error message.
(See SeattleTestbed#69 for another similarly-looking problem).
  • Loading branch information
aaaaalbert committed Feb 3, 2017
1 parent 8f354ac commit ea1d779
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions tracebackrepy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import sys

# We need the service logger to log internal errors -Brent
# import servicelogger
import servicelogger

# Used to determine whether or not we use the service logger to log internal
# errors. Defaults to false. -Brent
Expand Down Expand Up @@ -54,9 +54,6 @@ def initialize(useservlog=False, logdir = '.'):
global servicelog
global logdirectory

if useservlog:
import servicelogger

servicelog = useservlog
logdirectory = logdir

Expand Down Expand Up @@ -210,9 +207,6 @@ def handle_internalerror(error_string, exitcode):
<Return>
Shouldn't return because harshexit will always be called.
"""
if servicelog:
import servicelogger

try:
print >> sys.stderr, "Internal Error"
handle_exception()
Expand Down Expand Up @@ -246,7 +240,8 @@ def handle_internalerror(error_string, exitcode):

# Again we want to ensure that even if we fail to log, we still exit.
try:
servicelogger.multi_process_log(exceptionstring, identifier, logdirectory)
if servicelog:
servicelogger.multi_process_log(exceptionstring, identifier, logdirectory)
except Exception, e:
# if an exception occurs, log it (unfortunately, to the user's log)
print 'Inner abort of servicelogger'
Expand Down

0 comments on commit ea1d779

Please sign in to comment.