diff options
author | Saqib Khan <khansa@us.ibm.com> | 2017-11-04 15:56:21 -0500 |
---|---|---|
committer | Saqib Khan <khansa@us.ibm.com> | 2017-11-08 07:37:25 -0600 |
commit | 3a00b1fd769320ee4a0e95e26c0f688e30a920bc (patch) | |
tree | 22906f4473d031a0506476669d22330dd2caad01 /module/obmc | |
parent | f01d0ba3e2da4944a811fc4f57815ac97ee062ed (diff) | |
download | phosphor-rest-server-3a00b1fd769320ee4a0e95e26c0f688e30a920bc.tar.gz phosphor-rest-server-3a00b1fd769320ee4a0e95e26c0f688e30a920bc.zip |
Call all instances of an objectPath when executing "POST"
- For example "DeleteAll" exists in both bmc updater and host updater.
Therefore when a user executes DeleteAll using REST, both the two
instances should be called upon.
Resolves openbmc/openbmc#2490
Change-Id: Ic38b00de137593bc344ff9d743d3144a48bd5f13
Signed-off-by: Saqib Khan <khansa@us.ibm.com>
Diffstat (limited to 'module/obmc')
-rw-r--r-- | module/obmc/wsgi/apps/rest_dbus.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/module/obmc/wsgi/apps/rest_dbus.py b/module/obmc/wsgi/apps/rest_dbus.py index 3f84ddd..c44a45d 100644 --- a/module/obmc/wsgi/apps/rest_dbus.py +++ b/module/obmc/wsgi/apps/rest_dbus.py @@ -328,24 +328,28 @@ class MethodHandler(RouteHandler): self.interface = '' def find(self, path, method): + method_list = [] busses = self.try_mapper_call( self.mapper.get_object, path=path) for items in busses.iteritems(): m = self.find_method_on_bus(path, method, *items) if m: - return m + method_list.append(m) + return method_list abort(404, _4034_msg % ('method', 'found', method)) def setup(self, path, method): - request.route_data['method'] = self.find(path, method) + request.route_data['map'] = self.find(path, method) def do_post(self, path, method): try: - if request.parameter_list: - return request.route_data['method'](*request.parameter_list) - else: - return request.route_data['method']() + for item in request.route_data['map']: + if request.parameter_list: + item(*request.parameter_list) + else: + item() + return except dbus.exceptions.DBusException, e: paramlist = [] |