strutils: mask_password: TypeError: cannot concatenate 'str' and 'Request' objects
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack DBaaS (Trove) |
Fix Released
|
High
|
Amrith Kumar |
Bug Description
Seen in trove gate as part of change https:/
to resync oslo-incubator code.
2015-01-22 15:33:12.887 | trove.common.wsgi: DEBUG: Getting schema for type:create
2015-01-22 15:33:12.887 | trove.common.wsgi: DEBUG: Found Schema: none
2015-01-22 15:33:12.888 | trove.instance.
2015-01-22 15:33:12.888 | trove.common.wsgi: ERROR: 3d2cd540-
2015-01-22 15:33:12.888 | 2015-01-22 15:33:10.439 4738 TRACE trove.common.wsgi Traceback (most recent call last):
2015-01-22 15:33:12.888 | 2015-01-22 15:33:10.439 4738 TRACE trove.common.wsgi File "/home/
2015-01-22 15:33:12.888 | 2015-01-22 15:33:10.439 4738 TRACE trove.common.wsgi **action_args)
2015-01-22 15:33:12.888 | 2015-01-22 15:33:10.439 4738 TRACE trove.common.wsgi File "/home/
2015-01-22 15:33:12.888 | 2015-01-22 15:33:10.439 4738 TRACE trove.common.wsgi return self.dispatch(
2015-01-22 15:33:12.888 | 2015-01-22 15:33:10.439 4738 TRACE trove.common.wsgi File "/home/
2015-01-22 15:33:12.888 | 2015-01-22 15:33:10.439 4738 TRACE trove.common.wsgi return method(*args, **kwargs)
2015-01-22 15:33:12.888 | 2015-01-22 15:33:10.439 4738 TRACE trove.common.wsgi File "/home/
2015-01-22 15:33:12.888 | 2015-01-22 15:33:10.439 4738 TRACE trove.common.wsgi LOG.debug(
2015-01-22 15:33:12.889 | 2015-01-22 15:33:10.439 4738 TRACE trove.common.wsgi File "/home/
2015-01-22 15:33:12.889 | 2015-01-22 15:33:10.439 4738 TRACE trove.common.wsgi substitute1 = r'\g<1>' + secret
2015-01-22 15:33:12.889 | 2015-01-22 15:33:10.439 4738 TRACE trove.common.wsgi TypeError: cannot concatenate 'str' and 'Request' objects
2015-01-22 15:33:12.889 | 2015-01-22 15:33:10.439 4738 TRACE trove.common.wsgi
2015-01-22 15:33:12.889 | troveclient.
2015-01-22 15:33:12.889 |
2015-01-22 15:33:12.889 | troveclient.
2015-01-22 15:33:12.889 |
2015-01-22 15:33:12.889 | troveclient.
Changed in oslo.utils: | |
assignee: | nobody → Amrith (amrith) |
Changed in trove: | |
importance: | Undecided → High |
milestone: | none → kilo-2 |
Changed in trove: | |
status: | Fix Committed → Fix Released |
Changed in trove: | |
milestone: | kilo-2 → 2015.1.0 |
The call causing the exception is this:
LOG.debug( logging. mask_password( "req : '%s'\n\n", req))
Which is not the correct way to call mask_password. This happened to "work" before due to some implementation details in mask_password, but after some recent refactoring that is no longer true. Note that when I say "work", I mean complete without exception. It wasn't actually masking any passwords because the string it was working on was the format string for the log message, not the content.
The correct code to do this looks like:
LOG.debug("req : '%s'\n\n", logging. mask_password( req))
That will mask any passwords in req, then pass it as a parameter to the logging function.