Only log insecure key manager warning once

We currently log a warning message every time the key manager
is instantiated. This changes that to log a warning only one
time.

Change-Id: Ia24808396eb0e2d43c6dc6631384a254b2ee2472
This commit is contained in:
Sean McGinnis 2016-12-28 18:53:13 -06:00
parent 5bb68e49d3
commit 0df3d7a9d9
1 changed files with 7 additions and 2 deletions

View File

@ -63,9 +63,14 @@ class ConfKeyManager(key_manager.KeyManager):
for each method are handled as specified by the key manager interface.
"""
warning_logged = False
def __init__(self, configuration):
LOG.warning(_LW('This key manager is insecure and is not recommended '
'for production deployments'))
if not ConfKeyManager.warning_logged:
LOG.warning(_LW('This key manager is insecure and is not '
'recommended for production deployments'))
ConfKeyManager.warning_logged = True
super(ConfKeyManager, self).__init__(configuration)
self.conf = configuration