]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
metadata proxy will use syslog as default log
authorgongysh <gongysh@linux.vnet.ibm.com>
Fri, 24 May 2013 01:49:33 +0000 (09:49 +0800)
committergongysh <gongysh@linux.vnet.ibm.com>
Fri, 24 May 2013 01:49:33 +0000 (09:49 +0800)
Bug #1183614

Change-Id: I39f07fc7d232148c50cf85fbc4ca6ca7cde8fdfa

quantum/agent/common/config.py
quantum/tests/unit/test_dhcp_agent.py

index 691ff1ecd4790a9662d6359999955f169aa0e761..05a5f01bc9e978895d0a801cd7346f6578cdfb10 100644 (file)
@@ -45,16 +45,18 @@ def get_log_args(conf, log_file_name):
         cmd_args.append('--verbose')
     if (conf.log_dir or conf.log_file):
         cmd_args.append('--log-file=%s' % log_file_name)
-    log_dir = None
-    if conf.log_dir and conf.log_file:
-        log_dir = os.path.dirname(
-            os.path.join(conf.log_dir, conf.log_file))
-    elif conf.log_dir:
-        log_dir = conf.log_dir
-    elif conf.log_file:
-        log_dir = os.path.dirname(conf.log_file)
-    if log_dir:
-        cmd_args.append('--log-dir=%s' % log_dir)
+        log_dir = None
+        if conf.log_dir and conf.log_file:
+            log_dir = os.path.dirname(
+                os.path.join(conf.log_dir, conf.log_file))
+        elif conf.log_dir:
+            log_dir = conf.log_dir
+        elif conf.log_file:
+            log_dir = os.path.dirname(conf.log_file)
+        if log_dir:
+            cmd_args.append('--log-dir=%s' % log_dir)
+    else:
+        cmd_args.append('--use-syslog')
     return cmd_args
 
 
index 92be06c787c7fd65724ce3840a89a3a4bb183506..cf31483584546f0bdf160185f9f3da656caf1b1d 100644 (file)
@@ -362,7 +362,7 @@ class TestLogArgs(base.BaseTestCase):
                      'log_dir': None,
                      'log_file': None}
         conf = dhcp_agent.DictModel(conf_dict)
-        expected_args = ['--debug']
+        expected_args = ['--debug', '--use-syslog']
         args = config.get_log_args(conf, 'log_file_name')
         self.assertEqual(expected_args, args)