operation_log: Log mask_fields only when exists in request

Previously mask_fields are always output even when they are
not included in a user request. It is confusing.

Change-Id: Ia207bfbc61246bc722a2ced544a8955f52025c0c
Closes-Bug: #1675191
This commit is contained in:
Akihiro Motoki 2017-03-22 21:41:50 +00:00
parent da3abf8d0a
commit d04f164ab2

@ -156,9 +156,9 @@ class OperationLogMiddleware(object):
params = json.loads(request.body)
except Exception:
pass
for key in params.items():
for key in params:
# replace a value to a masked characters
for key in self.mask_fields:
if key in self.mask_fields:
params[key] = '*' * 8
# when a file uploaded (E.g create image)