Fixed Admin Auth Token in Notification

before notifications are sent - admin auth token is
   set to None to ensure it is not logged

Fixes: Bug 1218028
Change-Id: Ib53244f14d8e2e8c77e0bb67e2156e2eb0165866
(cherry picked from commit 52d892fe54)
This commit is contained in:
justin-hopper 2013-09-11 14:09:49 -07:00 committed by Michael Basnight
parent 7f337fb6d0
commit 59a12fe3cf
2 changed files with 5 additions and 0 deletions

View File

@ -156,6 +156,8 @@ def _load_servers(instances, find_server):
def publish_exist_events(transformer, admin_context):
notifications = transformer()
# clear out admin_context.auth_token so it does not get logged
admin_context.auth_token = None
for notification in notifications:
notifier.notify(admin_context,
CONF.host,

View File

@ -41,6 +41,7 @@ class MockMgmtInstanceTest(TestCase):
def setUp(self):
super(MockMgmtInstanceTest, self).setUp()
self.context = TroveContext()
self.context.auth_token = 'some_secret_password'
self.client = mock(Client)
self.server_mgr = mock(ServerManager)
self.client.servers = self.server_mgr
@ -277,6 +278,7 @@ class TestMgmtInstanceTasks(MockMgmtInstanceTest):
flavor = mock(Flavor)
flavor.name = 'db.small'
when(self.flavor_mgr).get('flavor_1').thenReturn(flavor)
self.assertThat(self.context.auth_token, Is('some_secret_password'))
when(notifier).notify(self.context,
any(str),
'trove.instance.exists',
@ -291,3 +293,4 @@ class TestMgmtInstanceTasks(MockMgmtInstanceTest):
'trove.instance.exists',
'INFO',
any(dict))
self.assertThat(self.context.auth_token, Is(None))