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.
Closes-Bug:
@@ -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)
