From fce7756c4af482aa27ed77c5ef4b93d7d687d1f7 Mon Sep 17 00:00:00 2001 From: Brad Bishop Date: Mon, 28 Nov 2016 15:44:18 -0500 Subject: Return HTTP 503 when mapper is busy Suppress traceback and provide an informative error message when the mapper cannot respond to a query. Resolves openbmc/openbmc#812 Change-Id: I85d4e59c5a25dc8a19fbdb1d1cf8c2a0f4350991 --- module/obmc/wsgi/apps/rest_dbus.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'module/obmc/wsgi/apps') diff --git a/module/obmc/wsgi/apps/rest_dbus.py b/module/obmc/wsgi/apps/rest_dbus.py index b1da97d..93f0895 100644 --- a/module/obmc/wsgi/apps/rest_dbus.py +++ b/module/obmc/wsgi/apps/rest_dbus.py @@ -96,6 +96,9 @@ class RouteHandler(object): try: return f(**kw) except dbus.exceptions.DBusException, e: + if e.get_dbus_name() == \ + 'org.freedesktop.DBus.Error.ObjectPathInUse': + abort(503, str(e)) if e.get_dbus_name() != obmc.mapper.MAPPER_NOT_FOUND: raise if callback is None: -- cgit v1.2.1