optimization: Remove needless json.loads from middleware

This patchset removes a needless json.loads from middleware
which only adds needless overhead to Deckhand.

Change-Id: I0e2a329c25198e80b42ca8b821baf6032509eec7
This commit is contained in:
Felipe Monteiro 2018-06-29 18:31:33 -04:00
parent dbcc03776d
commit cca44ac36a

View File

@ -17,7 +17,6 @@ import yaml
import falcon import falcon
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from oslo_serialization import jsonutils as json
import six import six
import deckhand.context import deckhand.context
@ -170,11 +169,6 @@ class YAMLTranslator(HookableMiddlewareMixin, object):
resp_attr = getattr(resp, attr) resp_attr = getattr(resp, attr)
try:
resp_attr = json.loads(resp_attr)
except (TypeError, ValueError):
pass
if isinstance(resp_attr, dict): if isinstance(resp_attr, dict):
setattr(resp, attr, yaml.safe_dump(resp_attr)) setattr(resp, attr, yaml.safe_dump(resp_attr))
elif isinstance(resp_attr, (list, tuple)): elif isinstance(resp_attr, (list, tuple)):