Log config options with oslo.config

This removes some custom code inherited from Cinder which was handling
the output of secret options in a bad way. This patch utilizes Oslo's
existing utilities to output the Manila configuration options securely.

Filtering will be done with the "secret=True" option flag.

Major thanks to Eric Harney for introducing this fix to Cinder.

Change-Id: I894e011680661c0b73b9592f70a6457e403f18c6
Related-Bug: #1750074
(cherry picked from commit 3d7909deb2)
This commit is contained in:
Dustin Schoenbrun 2018-02-21 17:02:31 -05:00 committed by Tom Barron
parent 902b1b72f1
commit 1949b403e9
2 changed files with 6 additions and 12 deletions

View File

@ -387,18 +387,7 @@ def serve(server, workers=None):
def wait():
LOG.debug('Full set of CONF:')
for flag in CONF:
flag_get = CONF.get(flag, None)
# hide flag contents from log if contains a password
# should use secret flag when switch over to openstack-common
if ("_password" in flag or "_key" in flag or
(flag == "transport_url" and "rabbit:" in flag_get) or
(flag == "sql_connection" and "mysql:" in flag_get)):
LOG.debug('%(flag)s : FLAG SET ', {"flag": flag})
else:
LOG.debug('%(flag)s : %(flag_get)s',
{"flag": flag, "flag_get": flag_get})
CONF.log_opt_values(LOG, log.DEBUG)
try:
_launcher.wait()
except KeyboardInterrupt:

View File

@ -0,0 +1,5 @@
---
fixes:
- Use Oslo's logging features to securely output the configuration options
for Manila.