aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Stokes <adam.stokes@ubuntu.com>2014-09-16 09:40:53 -0400
committerAdam Stokes <adam.stokes@ubuntu.com>2014-09-16 09:40:53 -0400
commit8ace503f4e59582213812a7631183b253e8c8ca6 (patch)
treeacc10bb0f5f01cc9ebccde4e07f86d61df3fc803
parent342cb7be3836d885616b53aa56dee48bbe7439fa (diff)
downloadsos-8ace503f4e59582213812a7631183b253e8c8ca6.tar.gz
[docker] optional log capturing for all containers
This options provides the user the ability to pull logs from all containers including the terminated/stopped. Fixes #360 Fixes #365 Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
-rw-r--r--sos/plugins/docker.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/sos/plugins/docker.py b/sos/plugins/docker.py
index 0a023736..0c5c976e 100644
--- a/sos/plugins/docker.py
+++ b/sos/plugins/docker.py
@@ -17,6 +17,7 @@ from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
class Docker(Plugin):
+
"""Docker containers
"""
@@ -24,6 +25,9 @@ class Docker(Plugin):
profiles = ('virt',)
docker_bin = "docker"
+ option_list = [("all", "capture all container logs even the "
+ "terminated ones", 'fast', False)]
+
def setup(self):
self.add_copy_specs([
"/var/lib/docker/repositories-*"
@@ -35,8 +39,11 @@ class Docker(Plugin):
"{0} images".format(self.docker_bin)
])
- result = self.get_command_output("{0} ps".format(
- self.docker_bin))
+ ps_cmd = "{0} ps".format(self.docker_bin)
+ if self.get_option('all'):
+ ps_cmd = "{0} -a".format(ps_cmd)
+
+ result = self.get_command_output(ps_cmd)
if result['status'] == 0:
result['output'] = result['output'].split("\n")
for line in result['output'][1:]: