Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions supervisor/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def list_of_strings(arg):
return []
try:
return [x.strip() for x in arg.split(',')]
except:
except Exception:
raise ValueError("not a valid list of strings: " + repr(arg))

def list_of_ints(arg):
Expand All @@ -52,7 +52,7 @@ def list_of_ints(arg):
else:
try:
return list(map(int, arg.split(",")))
except:
except Exception:
raise ValueError("not a valid list of ints: " + repr(arg))

def list_of_exitcodes(arg):
Expand All @@ -62,7 +62,7 @@ def list_of_exitcodes(arg):
if (val > 255) or (val < 0):
raise ValueError('Invalid exit code "%s"' % val)
return vals
except:
except Exception:
raise ValueError("not a valid list of exit codes: " + repr(arg))

def dict_of_key_value_pairs(arg):
Expand Down Expand Up @@ -221,7 +221,7 @@ def create_and_bind(self):
try:
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(self.addr())
except:
except Exception:
sock.close()
raise
return sock
Expand Down Expand Up @@ -252,7 +252,7 @@ def create_and_bind(self):
sock.bind(self.addr())
self._chown()
self._chmod()
except:
except Exception:
sock.close()
if os.path.exists(self.path):
os.unlink(self.path)
Expand Down Expand Up @@ -295,7 +295,7 @@ def colon_separated_user_group(arg):
uid = name_to_uid(parts[0])
gid = name_to_gid(parts[1])
return (uid, gid)
except:
except Exception:
raise ValueError('Invalid user:group definition %s' % arg)

def name_to_uid(name):
Expand Down
2 changes: 1 addition & 1 deletion supervisor/dispatchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ def handle_result(self, result):
logger.warn('%s: event was rejected' % procname)
self._change_listener_state(EventListenerStates.ACKNOWLEDGED)
notify(EventRejectedEvent(process, process.event))
except:
except Exception:
logger.warn('%s: event caused an error' % procname)
self._change_listener_state(EventListenerStates.UNKNOWN)
notify(EventRejectedEvent(process, process.event))
Expand Down
8 changes: 4 additions & 4 deletions supervisor/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def found_terminator (self):
# This isn't used anywhere.
# r.handler = h # CYCLE
h.handle_request (r)
except:
except Exception:
self.server.exceptions.increment()
(file, fun, line), t, v, tbinfo = \
asyncore.compact_traceback()
Expand All @@ -458,7 +458,7 @@ def found_terminator (self):
'error')
try:
r.error (500)
except:
except Exception:
pass
return

Expand Down Expand Up @@ -588,7 +588,7 @@ def __init__(self, socketname, sockchmod, sockchown, logger_object):
sys.stderr.write(msg)
try:
os.unlink(socketname)
except:
except Exception:
pass
sock.close()
time.sleep(.3)
Expand Down Expand Up @@ -819,7 +819,7 @@ def make_http_servers(options, supervisord):
for name, factory, d in options.rpcinterface_factories:
try:
inst = factory(supervisord, **d)
except:
except Exception:
tb = traceback.format_exc()
options.logger.warn(tb)
raise ValueError('Could not make %s rpc interface' % name)
Expand Down
4 changes: 2 additions & 2 deletions supervisor/loggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def emit(self, record):
# time it's called. So just do it again
self.stream.write(msg)
self.flush()
except:
except Exception:
self.handleError()

def handleError(self):
Expand Down Expand Up @@ -376,7 +376,7 @@ def emit(self, record):
self._syslog(msg)
except UnicodeError:
self._syslog(msg.encode("UTF-8"))
except:
except Exception:
self.handleError()

def getLogger(level=None):
Expand Down
10 changes: 5 additions & 5 deletions supervisor/medusa/asyncore_25.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,23 @@ def read(obj):
obj.handle_read_event()
except ExitNow:
raise
except:
except Exception:
obj.handle_error()

def write(obj):
try:
obj.handle_write_event()
except ExitNow:
raise
except:
except Exception:
obj.handle_error()

def _exception (obj):
try:
obj.handle_expt_event()
except ExitNow:
raise
except:
except Exception:
obj.handle_error()

def readwrite(obj, flags):
Expand All @@ -99,7 +99,7 @@ def readwrite(obj, flags):
obj.handle_expt_event()
except ExitNow:
raise
except:
except Exception:
obj.handle_error()

def poll(timeout=0.0, map=None):
Expand Down Expand Up @@ -415,7 +415,7 @@ def handle_error(self):
# sometimes a user repr method will crash.
try:
self_repr = repr(self)
except:
except Exception:
self_repr = '<__repr__(self) failed for object at %0x>' % id(self)

self.log_info(
Expand Down
2 changes: 1 addition & 1 deletion supervisor/medusa/auth_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def handle_request (self, request):
cookie = get_header (AUTHORIZATION, request.header, 2)
try:
decoded = as_string(decodestring(as_bytes(cookie)))
except:
except Exception:
sys.stderr.write('malformed authorization info <%s>\n' % cookie)
request.error (400)
return
Expand Down
4 changes: 2 additions & 2 deletions supervisor/medusa/default_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def handle_request (self, request):
length = int(length)
if length != file_length:
length_match = 0
except:
except Exception:
pass

ims_date = 0
Expand All @@ -142,7 +142,7 @@ def handle_request (self, request):

try:
mtime = self.filesystem.stat (path)[stat.ST_MTIME]
except:
except Exception:
request.error (404)
return

Expand Down
8 changes: 4 additions & 4 deletions supervisor/medusa/filesys.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def longify (self, path):
def safe_stat (path):
try:
return path, os.stat (path)
except:
except Exception:
return None

class os_filesystem:
Expand Down Expand Up @@ -118,7 +118,7 @@ def cwd (self, path):
os.chdir (translated_path)
can = 1
self.wd = p
except:
except Exception:
pass
finally:
if can:
Expand Down Expand Up @@ -295,7 +295,7 @@ def msdos_longify (file, stat_info):
def msdos_date (t):
try:
info = time.gmtime (t)
except:
except Exception:
info = time.gmtime (0)
# year, month, day, hour, minute, second, ...
hour = info[3]
Expand Down Expand Up @@ -359,7 +359,7 @@ def unix_longify (file, stat_info):
def ls_date (now, t):
try:
info = time.gmtime (t)
except:
except Exception:
info = time.gmtime (0)
# 15,600,000 == 86,400 * 180
if (now - t) > 15600000:
Expand Down
4 changes: 2 additions & 2 deletions supervisor/medusa/http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,15 +616,15 @@ def found_terminator (self):
# This isn't used anywhere.
# r.handler = h # CYCLE
h.handle_request (r)
except:
except Exception:
self.server.exceptions.increment()
(file, fun, line), t, v, tbinfo = asyncore.compact_traceback()
self.log_info(
'Server Error: %s, %s: file: %s line: %s' % (t,v,file,line),
'error')
try:
r.error (500)
except:
except Exception:
pass
return

Expand Down
2 changes: 1 addition & 1 deletion supervisor/medusa/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def rotate (self):
pass
os.rename(self.filename, newname)
self.file = open(self.filename, self.mode)
except:
except Exception:
pass

# log to a stream socket, asynchronously
Expand Down
6 changes: 3 additions & 3 deletions supervisor/medusa/xmlrpc_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import supervisor.medusa.http_server as http_server
try:
import xmlrpclib
except:
except Exception:
import xmlrpc.client as xmlrpclib

import sys
Expand Down Expand Up @@ -40,14 +40,14 @@ def continue_request (self, data, request):
response = self.call (method, params)
if type(response) != type(()):
response = (response,)
except:
except Exception:
# report exception back to server
response = xmlrpclib.dumps (
xmlrpclib.Fault (1, "%s:%s" % (sys.exc_info()[0], sys.exc_info()[1]))
)
else:
response = xmlrpclib.dumps (response, methodresponse=1)
except:
except Exception:
# internal error, report as HTTP server error
request.error (500)
else:
Expand Down
2 changes: 1 addition & 1 deletion supervisor/pidproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def passtochild(self, sig, frame):
try:
with open(self.pidfile, 'r') as f:
pid = int(f.read().strip())
except:
except Exception:
print("Can't read child pidfile %s!" % self.pidfile)
return
os.kill(pid, sig)
Expand Down
6 changes: 3 additions & 3 deletions supervisor/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def _spawn_as_child(self, filename, argv):
code = errno.errorcode.get(why.args[0], why.args[0])
msg = "couldn't exec %s: %s\n" % (argv[0], code)
options.write(2, "supervisor: " + msg)
except:
except Exception:
(file, fun, line), t,v,tbinfo = asyncore.compact_traceback()
error = '%s, %s: file: %s line: %s' % (t, v, file, line)
msg = "couldn't exec %s: %s\n" % (filename, error)
Expand Down Expand Up @@ -474,7 +474,7 @@ def kill(self, sig):
# not. we will do it during normal SIGCHLD processing.
return None
raise
except:
except Exception:
tb = traceback.format_exc()
msg = 'unknown problem killing %s (%s):%s' % (processname,
self.pid, tb)
Expand Down Expand Up @@ -523,7 +523,7 @@ def signal(self, sig):
# not. we will do it during normal SIGCHLD processing.
return None
raise
except:
except Exception:
tb = traceback.format_exc()
msg = 'unknown problem sending sig %s (%s):%s' % (
processname, self.pid, tb)
Expand Down
4 changes: 2 additions & 2 deletions supervisor/supervisorctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ def do_tail(self, arg):
else:
try:
bytes = int(what)
except:
except Exception:
self.ctl.output('Error: bad argument %s' % modifier)
self.ctl.exitstatus = LSBInitExitStatuses.GENERIC
return
Expand Down Expand Up @@ -590,7 +590,7 @@ def do_maintail(self, arg):
return self._tailf(path)
try:
what = int(what)
except:
except Exception:
self.ctl.output('Error: bad argument %s' % args[0])
self.ctl.exitstatus = LSBInitExitStatuses.GENERIC
return
Expand Down
8 changes: 4 additions & 4 deletions supervisor/supervisord.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,15 @@ def runforever(self):
self.options.poller.unregister_readable(fd)
except asyncore.ExitNow:
raise
except:
except Exception:
combined_map[fd].handle_error()
else:
# if the fd is not in combined_map, we should unregister it. otherwise,
# it will be polled every time, which may cause 100% cpu usage
self.options.logger.blather('unexpected read event from fd %r' % fd)
try:
self.options.poller.unregister_readable(fd)
except:
except Exception:
pass

for fd in w:
Expand All @@ -249,13 +249,13 @@ def runforever(self):
self.options.poller.unregister_writable(fd)
except asyncore.ExitNow:
raise
except:
except Exception:
combined_map[fd].handle_error()
else:
self.options.logger.blather('unexpected write event from fd %r' % fd)
try:
self.options.poller.unregister_writable(fd)
except:
except Exception:
pass

for group in pgroups:
Expand Down
6 changes: 3 additions & 3 deletions supervisor/tests/test_dispatchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def test_handle_error(self):
dispatcher = self._makeOne(process)
try:
raise ValueError('foo')
except:
except Exception:
dispatcher.handle_error()
result = options.logger.data[0]
self.assertTrue(result.startswith(
Expand Down Expand Up @@ -680,7 +680,7 @@ def test_handle_error(self):
dispatcher = self._makeOne(process)
try:
raise ValueError('foo')
except:
except Exception:
dispatcher.handle_error()
result = options.logger.data[0]
self.assertTrue(result.startswith(
Expand Down Expand Up @@ -1119,7 +1119,7 @@ def test_handle_error(self):
dispatcher = self._makeOne(process)
try:
raise ValueError('foo')
except:
except Exception:
dispatcher.handle_error()
result = options.logger.data[0]
self.assertTrue(result.startswith(
Expand Down
Loading