summaryrefslogtreecommitdiffstats
path: root/module/obmc
diff options
context:
space:
mode:
authorNagaraju Goruganti <ngorugan@in.ibm.com>2017-11-13 06:17:13 -0600
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2017-11-17 13:14:36 +0000
commit765c2c8ba8c3d88f4d00bd769516809c88e57674 (patch)
treee96ff48ce0dd75e0ac338c2b7fbc2005cffb1754 /module/obmc
parentfb515796675ccd387e31866fb5e452357eff90c4 (diff)
downloadphosphor-rest-server-765c2c8ba8c3d88f4d00bd769516809c88e57674.tar.gz
phosphor-rest-server-765c2c8ba8c3d88f4d00bd769516809c88e57674.zip
Fix missing return value from do_post
- For example user-initiated dump REST request has to respond with dump ID. This is not happening, the dump-manager is returning the ID, but rest-bus is not passing the ID to caller. - These changes will fix the issue. Fixes openbmc/openbmc#2592 Change-Id: I7ff3f24236249a4ca58ac6ce90cc9dec6fbe0341 Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
Diffstat (limited to 'module/obmc')
-rw-r--r--module/obmc/wsgi/apps/rest_dbus.py32
1 files changed, 25 insertions, 7 deletions
diff --git a/module/obmc/wsgi/apps/rest_dbus.py b/module/obmc/wsgi/apps/rest_dbus.py
index 540322b..e0c2edf 100644
--- a/module/obmc/wsgi/apps/rest_dbus.py
+++ b/module/obmc/wsgi/apps/rest_dbus.py
@@ -335,7 +335,8 @@ class MethodHandler(RouteHandler):
m = self.find_method_on_bus(path, method, *items)
if m:
method_list.append(m)
- return method_list
+ if method_list:
+ return method_list
abort(404, _4034_msg % ('method', 'found', method))
@@ -344,12 +345,29 @@ class MethodHandler(RouteHandler):
def do_post(self, path, method):
try:
- for item in request.route_data['map']:
- if request.parameter_list:
- item(*request.parameter_list)
- else:
- item()
- return
+ args = []
+ if request.parameter_list:
+ args = request.parameter_list
+ # To see if the return type is capable of being merged
+ if len(request.route_data['map']) > 1:
+ results = None
+ for item in request.route_data['map']:
+ tmp = item(*args)
+ if not results:
+ if tmp is not None:
+ results = type(tmp)()
+ if isinstance(results, dict):
+ results = results.update(tmp)
+ elif isinstance(results, list):
+ results = results + tmp
+ elif isinstance(results, type(None)):
+ results = None
+ else:
+ abort(501, 'Don\'t know how to merge method call '
+ 'results of {}'.format(type(tmp)))
+ return results
+ # There is only one method
+ return request.route_data['map'][0](*args)
except dbus.exceptions.DBusException, e:
paramlist = []
OpenPOWER on IntegriCloud