From c3047b988fd7e937bf822a8a54115b4cab452380 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Sat, 4 Aug 2012 15:15:44 -0400 Subject: Only log deprecated config warnings once. Updates Nova's deprecated warn function so that we only log messages about deprecated config options once. The motivation for this change is to cut down the log file noise when deprecated config code gets called more than once. Change-Id: If8919817330dc9461a0472fea982d43c78a86f66 --- nova/tests/test_deprecated.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'nova/tests') diff --git a/nova/tests/test_deprecated.py b/nova/tests/test_deprecated.py index e65baa53e..ebc6fed93 100644 --- a/nova/tests/test_deprecated.py +++ b/nova/tests/test_deprecated.py @@ -38,3 +38,9 @@ class DeprecatedConfigTestCase(test.TestCase): self.assertRaises(exception.DeprecatedConfig, deprecated.warn, "test2") self.assertEqual(self.logbuffer, 'Deprecated Config: test2') + + def test_deprecated_logs_only_once(self): + deprecated.warn('only once!') + deprecated.warn('only once!') + deprecated.warn('only once!') + self.assertEqual(self.logbuffer, 'Deprecated Config: only once!') -- cgit