Merge "Syslog support for neutron metadata proxy"
This commit is contained in:
commit
fe3d5d6368
@ -56,7 +56,11 @@ def get_log_args(conf, log_file_name):
|
||||
if log_dir:
|
||||
cmd_args.append('--log-dir=%s' % log_dir)
|
||||
else:
|
||||
cmd_args.append('--use-syslog')
|
||||
if conf.use_syslog:
|
||||
cmd_args.append('--use-syslog')
|
||||
if conf.syslog_log_facility:
|
||||
cmd_args.append(
|
||||
'--syslog-log-facility=%s' % conf.syslog_log_facility)
|
||||
return cmd_args
|
||||
|
||||
|
||||
|
@ -348,9 +348,13 @@ class TestLogArgs(base.BaseTestCase):
|
||||
conf_dict = {'debug': True,
|
||||
'verbose': False,
|
||||
'log_dir': None,
|
||||
'log_file': None}
|
||||
'log_file': None,
|
||||
'use_syslog': True,
|
||||
'syslog_log_facility': 'LOG_USER'}
|
||||
conf = dhcp_agent.DictModel(conf_dict)
|
||||
expected_args = ['--debug', '--use-syslog']
|
||||
expected_args = ['--debug',
|
||||
'--use-syslog',
|
||||
'--syslog-log-facility=LOG_USER']
|
||||
args = config.get_log_args(conf, 'log_file_name')
|
||||
self.assertEqual(expected_args, args)
|
||||
|
||||
@ -358,9 +362,12 @@ class TestLogArgs(base.BaseTestCase):
|
||||
conf_dict = {'debug': True,
|
||||
'verbose': True,
|
||||
'log_dir': '/etc/tests',
|
||||
'log_file': None}
|
||||
'log_file': None,
|
||||
'use_syslog': False,
|
||||
'syslog_log_facility': 'LOG_USER'}
|
||||
conf = dhcp_agent.DictModel(conf_dict)
|
||||
expected_args = ['--debug', '--verbose',
|
||||
expected_args = ['--debug',
|
||||
'--verbose',
|
||||
'--log-file=log_file_name',
|
||||
'--log-dir=/etc/tests']
|
||||
args = config.get_log_args(conf, 'log_file_name')
|
||||
@ -370,7 +377,9 @@ class TestLogArgs(base.BaseTestCase):
|
||||
conf_dict = {'debug': True,
|
||||
'verbose': False,
|
||||
'log_dir': '/etc/tests',
|
||||
'log_file': 'tests/filelog'}
|
||||
'log_file': 'tests/filelog',
|
||||
'use_syslog': False,
|
||||
'syslog_log_facility': 'LOG_USER'}
|
||||
conf = dhcp_agent.DictModel(conf_dict)
|
||||
expected_args = ['--debug',
|
||||
'--log-file=log_file_name',
|
||||
@ -382,7 +391,9 @@ class TestLogArgs(base.BaseTestCase):
|
||||
conf_dict = {'debug': True,
|
||||
'verbose': False,
|
||||
'log_file': 'tests/filelog',
|
||||
'log_dir': None}
|
||||
'log_dir': None,
|
||||
'use_syslog': False,
|
||||
'syslog_log_facility': 'LOG_USER'}
|
||||
conf = dhcp_agent.DictModel(conf_dict)
|
||||
expected_args = ['--debug',
|
||||
'--log-file=log_file_name',
|
||||
@ -390,6 +401,21 @@ class TestLogArgs(base.BaseTestCase):
|
||||
args = config.get_log_args(conf, 'log_file_name')
|
||||
self.assertEqual(expected_args, args)
|
||||
|
||||
def test_log_args_with_filelog_and_syslog(self):
|
||||
conf_dict = {'debug': True,
|
||||
'verbose': True,
|
||||
'log_file': 'tests/filelog',
|
||||
'log_dir': '/etc/tests',
|
||||
'use_syslog': True,
|
||||
'syslog_log_facility': 'LOG_USER'}
|
||||
conf = dhcp_agent.DictModel(conf_dict)
|
||||
expected_args = ['--debug',
|
||||
'--verbose',
|
||||
'--log-file=log_file_name',
|
||||
'--log-dir=/etc/tests/tests']
|
||||
args = config.get_log_args(conf, 'log_file_name')
|
||||
self.assertEqual(expected_args, args)
|
||||
|
||||
|
||||
class TestDhcpAgentEventHandler(base.BaseTestCase):
|
||||
def setUp(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user