aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2015-01-19 21:40:27 +0000
committerBryn M. Reeves <bmr@redhat.com>2015-01-19 21:40:27 +0000
commitce6cd3ae9dc89dd1de5122add016ce2df60b6cee (patch)
tree4f21a78996d4b7b2ba8de92e3c2d7f18af1d9f01
parent370f58d3e9ec141ab4b0c49521c79cc90fab6c00 (diff)
downloadsos-ce6cd3ae9dc89dd1de5122add016ce2df60b6cee.tar.gz
[docker] use splitelines() for command output
Let's not reinvent splitlines(); the handrolled version docker was using fails to ignore the last newline: [plugin:docker] collecting output of 'docker logs 9b8f61c09dba' [plugin:docker] collecting output of 'docker logs 6f46267c91d6' [plugin:docker] collecting output of 'docker logs ' Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/docker.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/sos/plugins/docker.py b/sos/plugins/docker.py
index d8851a0a..ef4ede02 100644
--- a/sos/plugins/docker.py
+++ b/sos/plugins/docker.py
@@ -45,8 +45,7 @@ class Docker(Plugin):
result = self.get_command_output(ps_cmd)
if result['status'] == 0:
- result['output'] = result['output'].split("\n")
- for line in result['output'][1:]:
+ for line in result['output'].splitlines()[1:]:
container_id = line.split(" ")[0]
self.add_cmd_output([
"{0} logs {1}".format(self.docker_bin, container_id)