Merge "Fix UnicodeEncodeError error when log messge in poll_and_notify"

This commit is contained in:
Jenkins 2017-06-27 20:43:07 +00:00 committed by Gerrit Code Review
commit f53ab18125
2 changed files with 11 additions and 10 deletions

View File

@ -209,9 +209,10 @@ class PollingTask(object):
except plugin_base.PollsterPermanentError as err: except plugin_base.PollsterPermanentError as err:
LOG.error( LOG.error(
'Prevent pollster %(name)s from ' 'Prevent pollster %(name)s from '
'polling %(res_list)s on source %(source)s anymore!' 'polling %(res_list)s on source %(source)s anymore!',
% ({'name': pollster.name, 'source': source_name, dict(name=pollster.name,
'res_list': err.fail_res_list})) res_list=str(err.fail_res_list),
source=source_name))
self.resources[key].blacklist.extend(err.fail_res_list) self.resources[key].blacklist.extend(err.fail_res_list)
except Exception as err: except Exception as err:
LOG.error( LOG.error(

View File

@ -389,9 +389,9 @@ class TestRunTasks(agentbase.BaseAgentManagerTestCase):
self.assertEqual(2, len(samples)) self.assertEqual(2, len(samples))
LOG.error.assert_called_once_with(( LOG.error.assert_called_once_with((
'Prevent pollster %(name)s from ' 'Prevent pollster %(name)s from '
'polling %(res_list)s on source %(source)s anymore!') 'polling %(res_list)s on source %(source)s anymore!'),
% ({'name': pollster.name, 'res_list': res_list, dict(name=pollster.name, res_list=str(res_list),
'source': source_name})) source=source_name))
@mock.patch('ceilometer.agent.manager.LOG') @mock.patch('ceilometer.agent.manager.LOG')
def test_polling_novalike_exception(self, LOG): def test_polling_novalike_exception(self, LOG):
@ -420,10 +420,10 @@ class TestRunTasks(agentbase.BaseAgentManagerTestCase):
self.mgr.interval_task(polling_task) self.mgr.interval_task(polling_task)
LOG.error.assert_called_once_with(( LOG.error.assert_called_once_with((
'Prevent pollster %(name)s from ' 'Prevent pollster %(name)s from '
'polling %(res_list)s on source %(source)s anymore!') 'polling %(res_list)s on source %(source)s anymore!'),
% ({'name': pollster.name, dict(name=pollster.name,
'res_list': '[<NovaLikeServer: unknown-name>]', res_list="[<NovaLikeServer: unknown-name>]",
'source': source_name})) source=source_name))
def test_batching_polled_samples_false(self): def test_batching_polled_samples_false(self):
self.CONF.set_override('batch_polled_samples', False) self.CONF.set_override('batch_polled_samples', False)