summaryrefslogtreecommitdiffstats
path: root/module/obmc/wsgi/apps
diff options
context:
space:
mode:
authorMarri Devender Rao <devenrao@in.ibm.com>2017-11-20 00:15:47 -0600
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2017-12-12 00:56:57 +0000
commitbc0c67380072ad3461cd9a0dfdb71dc37f54918d (patch)
treeadac35e8207077e8241349cb1135023743931ba2 /module/obmc/wsgi/apps
parent8cc1a034b264d8771648840f3bc57f07ccad72fa (diff)
downloadphosphor-rest-server-bc0c67380072ad3461cd9a0dfdb71dc37f54918d.tar.gz
phosphor-rest-server-bc0c67380072ad3461cd9a0dfdb71dc37f54918d.zip
Fix infinite do_put recursive call with retry only once
For failure in do-put method call REST server computes the argument types based on the signature and makes a recursive call with the modified argument types. Without proper exit clause recursive call is falling into an infinite loop, modified to retry only once. Also fixed do_post which has similar retry logic. Fixes openbmc/openbmc#2653 Change-Id: I150464de5585ebdfab4ae2da2083a62bd63caca1 Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
Diffstat (limited to 'module/obmc/wsgi/apps')
-rw-r--r--module/obmc/wsgi/apps/rest_dbus.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/module/obmc/wsgi/apps/rest_dbus.py b/module/obmc/wsgi/apps/rest_dbus.py
index e0c2edf..b47ea4e 100644
--- a/module/obmc/wsgi/apps/rest_dbus.py
+++ b/module/obmc/wsgi/apps/rest_dbus.py
@@ -343,7 +343,7 @@ class MethodHandler(RouteHandler):
def setup(self, path, method):
request.route_data['map'] = self.find(path, method)
- def do_post(self, path, method):
+ def do_post(self, path, method, retry=True):
try:
args = []
if request.parameter_list:
@@ -371,7 +371,7 @@ class MethodHandler(RouteHandler):
except dbus.exceptions.DBusException, e:
paramlist = []
- if e.get_dbus_name() == DBUS_INVALID_ARGS:
+ if e.get_dbus_name() == DBUS_INVALID_ARGS and retry == True:
signature_list = get_method_signature(self.bus, self.service,
path, self.interface,
@@ -387,7 +387,7 @@ class MethodHandler(RouteHandler):
converted_value = convert_type(expected_type, value)
paramlist.append(converted_value)
request.parameter_list = paramlist
- self.do_post(path, method)
+ self.do_post(path, method, False)
return
except Exception as ex:
abort(400, "Failed to convert the types")
@@ -454,7 +454,7 @@ class PropertyHandler(RouteHandler):
name = request.route_data['name']
return request.route_data['obj'][path][name]
- def do_put(self, path, prop, value=None):
+ def do_put(self, path, prop, value=None, retry=True):
if value is None:
value = request.parameter_list
@@ -465,7 +465,7 @@ class PropertyHandler(RouteHandler):
except ValueError, e:
abort(400, str(e))
except dbus.exceptions.DBusException, e:
- if e.get_dbus_name() == DBUS_INVALID_ARGS:
+ if e.get_dbus_name() == DBUS_INVALID_ARGS and retry == True:
bus_name = properties_iface.bus_name
expected_type = get_type_signature_by_introspection(self.bus,
bus_name,
@@ -476,7 +476,7 @@ class PropertyHandler(RouteHandler):
converted_value = None
try:
converted_value = convert_type(expected_type, value)
- self.do_put(path, prop, converted_value)
+ self.do_put(path, prop, converted_value, False)
return
except Exception as ex:
abort(403, "Failed to convert %s to type %s" %
OpenPOWER on IntegriCloud