]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Make command log in neutron utils.execute() a single line
authorAkihiro Motoki <motoki@da.jp.nec.com>
Sat, 7 Nov 2015 18:07:02 +0000 (03:07 +0900)
committerAkihiro Motoki <motoki@da.jp.nec.com>
Sat, 7 Nov 2015 18:08:14 +0000 (03:08 +0900)
command execution log from neutron.agent.linux.utils.execute()
consists of multiple lines, and the first line has less information
and it is hard to analyze logs.

Closes-Bug: #1460379
Change-Id: Idca38f26321394596245c9c59b8a9a78c7190423

neutron/agent/linux/utils.py
neutron/agent/windows/utils.py

index 8d78a7d6308fae3af21ea8a9bc5e24321ca49b94..f05df1c30b145c72584c439302e20198697b2421 100644 (file)
@@ -149,9 +149,11 @@ def execute(cmd, process_input=None, addl_env=None,
             m += _("Stdin: %(stdin)s\n"
                   "Stdout: %(stdout)s\n"
                   "Stderr: %(stderr)s") % command_str
-            LOG.error(m)
+            log_msg = m.strip().replace('\n', '; ')
+            LOG.error(log_msg)
         else:
-            LOG.debug(m)
+            log_msg = m.strip().replace('\n', '; ')
+            LOG.debug(log_msg)
 
         if returncode and check_exit_code:
             raise RuntimeError(m)
index bcbccd3bcd12bc15098136f23419ed830b684961..8c44493e00335fdca5e58f4acb7b7390e1fdf657 100644 (file)
@@ -81,10 +81,11 @@ def execute(cmd, process_input=None, addl_env=None,
         if obj.returncode and obj.returncode in extra_ok_codes:
             obj.returncode = None
 
+        log_msg = m.strip().replace('\n', '; ')
         if obj.returncode and log_fail_as_error:
-            LOG.error(m)
+            LOG.error(log_msg)
         else:
-            LOG.debug(m)
+            LOG.debug(log_msg)
 
         if obj.returncode and check_exit_code:
             raise RuntimeError(m)