|
|
dad156 |
From 77c72b415feccd828fd7bc13caebf9841afc40c2 Mon Sep 17 00:00:00 2001
|
|
|
dad156 |
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
|
dad156 |
Date: Mon, 3 Sep 2018 17:11:06 +0100
|
|
|
dad156 |
Subject: [PATCH] [docker] combine docker 'inspect' and 'logs' loops
|
|
|
dad156 |
|
|
|
dad156 |
We're iterating over all the containers: might as well only do it
|
|
|
dad156 |
one time.
|
|
|
dad156 |
|
|
|
dad156 |
Related: #1406, #1407
|
|
|
dad156 |
|
|
|
dad156 |
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
|
dad156 |
---
|
|
|
dad156 |
sos/plugins/docker.py | 4 +---
|
|
|
dad156 |
1 file changed, 1 insertion(+), 3 deletions(-)
|
|
|
dad156 |
|
|
|
dad156 |
diff --git a/sos/plugins/docker.py b/sos/plugins/docker.py
|
|
|
dad156 |
index a44264a4..5b2acff5 100644
|
|
|
dad156 |
--- a/sos/plugins/docker.py
|
|
|
dad156 |
+++ b/sos/plugins/docker.py
|
|
|
dad156 |
@@ -80,9 +80,7 @@ class Docker(Plugin):
|
|
|
dad156 |
if insp:
|
|
|
dad156 |
for container in insp:
|
|
|
dad156 |
self.add_cmd_output("docker inspect %s" % container)
|
|
|
dad156 |
-
|
|
|
dad156 |
- if self.get_option('logs'):
|
|
|
dad156 |
- for container in insp:
|
|
|
dad156 |
+ if self.get_option('logs'):
|
|
|
dad156 |
self.add_cmd_output("docker logs -t %s" % container)
|
|
|
dad156 |
|
|
|
dad156 |
|
|
|
dad156 |
--
|
|
|
dad156 |
2.17.2
|
|
|
dad156 |
|
|
|
dad156 |
From e3cfb1428592390166237e715471bb62d9bd9db6 Mon Sep 17 00:00:00 2001
|
|
|
dad156 |
From: Daniel J Walsh <dwalsh@redhat.com>
|
|
|
dad156 |
Date: Wed, 29 Aug 2018 06:50:10 -0400
|
|
|
dad156 |
Subject: [PATCH] [podman] Add support for gathering information on podman
|
|
|
dad156 |
containers
|
|
|
dad156 |
|
|
|
dad156 |
Resolves: #1407.
|
|
|
dad156 |
|
|
|
dad156 |
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
|
|
|
dad156 |
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
|
dad156 |
---
|
|
|
dad156 |
sos/plugins/podman.py | 79 +++++++++++++++++++++++++++++++++++++++++++
|
|
|
dad156 |
1 file changed, 79 insertions(+)
|
|
|
dad156 |
create mode 100644 sos/plugins/podman.py
|
|
|
dad156 |
|
|
|
dad156 |
diff --git a/sos/plugins/podman.py b/sos/plugins/podman.py
|
|
|
dad156 |
new file mode 100644
|
|
|
dad156 |
index 00000000..c43246fc
|
|
|
dad156 |
--- /dev/null
|
|
|
dad156 |
+++ b/sos/plugins/podman.py
|
|
|
dad156 |
@@ -0,0 +1,79 @@
|
|
|
dad156 |
+# Copyright (C) 2018 Red Hat, Inc. Daniel Walsh <dwalsh@redhat.com>
|
|
|
dad156 |
+
|
|
|
dad156 |
+# This file is part of the sos project: https://github.com/sosreport/sos
|
|
|
dad156 |
+#
|
|
|
dad156 |
+# This copyrighted material is made available to anyone wishing to use,
|
|
|
dad156 |
+# modify, copy, or redistribute it subject to the terms and conditions of
|
|
|
dad156 |
+# version 2 of the GNU General Public License.
|
|
|
dad156 |
+#
|
|
|
dad156 |
+# See the LICENSE file in the source distribution for further information.
|
|
|
dad156 |
+
|
|
|
dad156 |
+from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
|
|
|
dad156 |
+
|
|
|
dad156 |
+
|
|
|
dad156 |
+class Podman(Plugin):
|
|
|
dad156 |
+
|
|
|
dad156 |
+ """Podman containers
|
|
|
dad156 |
+ """
|
|
|
dad156 |
+
|
|
|
dad156 |
+ plugin_name = 'podman'
|
|
|
dad156 |
+ profiles = ('container',)
|
|
|
dad156 |
+ packages = ('podman')
|
|
|
dad156 |
+
|
|
|
dad156 |
+ option_list = [
|
|
|
dad156 |
+ ("all", "enable capture for all containers, even containers "
|
|
|
dad156 |
+ "that have terminated", 'fast', False),
|
|
|
dad156 |
+ ("logs", "capture logs for running containers",
|
|
|
dad156 |
+ 'fast', False),
|
|
|
dad156 |
+ ("size", "capture image sizes for podman ps", 'slow', False)
|
|
|
dad156 |
+ ]
|
|
|
dad156 |
+
|
|
|
dad156 |
+ def setup(self):
|
|
|
dad156 |
+ self.add_copy_spec([
|
|
|
dad156 |
+ "/etc/containers/registries.conf",
|
|
|
dad156 |
+ "/etc/containers/storage.conf",
|
|
|
dad156 |
+ "/etc/containers/mounts.conf",
|
|
|
dad156 |
+ "/etc/containers/policy.json",
|
|
|
dad156 |
+ ])
|
|
|
dad156 |
+
|
|
|
dad156 |
+ subcmds = [
|
|
|
dad156 |
+ 'info',
|
|
|
dad156 |
+ 'images',
|
|
|
dad156 |
+ 'pod ps',
|
|
|
dad156 |
+ 'pod ps -a',
|
|
|
dad156 |
+ 'ps',
|
|
|
dad156 |
+ 'ps -a',
|
|
|
dad156 |
+ 'stats --no-stream',
|
|
|
dad156 |
+ 'version',
|
|
|
dad156 |
+ ]
|
|
|
dad156 |
+
|
|
|
dad156 |
+ self.add_cmd_output(["podman %s" % s for s in subcmds])
|
|
|
dad156 |
+
|
|
|
dad156 |
+ # separately grab ps -s as this can take a *very* long time
|
|
|
dad156 |
+ if self.get_option('size'):
|
|
|
dad156 |
+ self.add_cmd_output('podman ps -as')
|
|
|
dad156 |
+
|
|
|
dad156 |
+ self.add_journal(units="podman")
|
|
|
dad156 |
+ self.add_cmd_output("ls -alhR /etc/cni")
|
|
|
dad156 |
+
|
|
|
dad156 |
+ ps_cmd = 'podman ps -q'
|
|
|
dad156 |
+ if self.get_option('all'):
|
|
|
dad156 |
+ ps_cmd = "%s -a" % ps_cmd
|
|
|
dad156 |
+
|
|
|
dad156 |
+ img_cmd = 'podman images -q'
|
|
|
dad156 |
+ insp = set()
|
|
|
dad156 |
+
|
|
|
dad156 |
+ for icmd in [ps_cmd, img_cmd]:
|
|
|
dad156 |
+ result = self.get_command_output(icmd)
|
|
|
dad156 |
+ if result['status'] == 0:
|
|
|
dad156 |
+ for con in result['output'].splitlines():
|
|
|
dad156 |
+ insp.add(con)
|
|
|
dad156 |
+
|
|
|
dad156 |
+ if insp:
|
|
|
dad156 |
+ for container in insp:
|
|
|
dad156 |
+ self.add_cmd_output("podman inspect %s" % container)
|
|
|
dad156 |
+ if self.get_option('logs'):
|
|
|
dad156 |
+ self.add_cmd_output("podman logs -t %s" % container)
|
|
|
dad156 |
+
|
|
|
dad156 |
+
|
|
|
dad156 |
+# vim: set et ts=4 sw=4 :
|
|
|
dad156 |
--
|
|
|
dad156 |
2.17.2
|
|
|
dad156 |
|
|
|
dad156 |
From 1401c7153dda9bd0558035ba0692cf05a93ca419 Mon Sep 17 00:00:00 2001
|
|
|
dad156 |
From: Pavel Moravec <pmoravec@redhat.com>
|
|
|
dad156 |
Date: Tue, 6 Nov 2018 08:13:52 +0100
|
|
|
dad156 |
Subject: [PATCH] [podman] allow the plugin for RedHatPlugin and UbuntuPlugin
|
|
|
dad156 |
|
|
|
dad156 |
Until Podman inherits RedHatPlugin and/or UbuntuPlugin, the plugin
|
|
|
dad156 |
can not be executed on underlying distros.
|
|
|
dad156 |
|
|
|
dad156 |
Further, remove one redundant test as "for container in insp" will
|
|
|
dad156 |
work properly also for empty "insp".
|
|
|
dad156 |
|
|
|
dad156 |
Resolves: #1473
|
|
|
dad156 |
|
|
|
dad156 |
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
|
|
|
dad156 |
---
|
|
|
dad156 |
sos/plugins/podman.py | 11 +++++------
|
|
|
dad156 |
1 file changed, 5 insertions(+), 6 deletions(-)
|
|
|
dad156 |
|
|
|
dad156 |
diff --git a/sos/plugins/podman.py b/sos/plugins/podman.py
|
|
|
dad156 |
index c43246fc..72e22558 100644
|
|
|
dad156 |
--- a/sos/plugins/podman.py
|
|
|
dad156 |
+++ b/sos/plugins/podman.py
|
|
|
dad156 |
@@ -11,7 +11,7 @@
|
|
|
dad156 |
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
|
|
|
dad156 |
|
|
|
dad156 |
|
|
|
dad156 |
-class Podman(Plugin):
|
|
|
dad156 |
+class Podman(Plugin, RedHatPlugin, UbuntuPlugin):
|
|
|
dad156 |
|
|
|
dad156 |
"""Podman containers
|
|
|
dad156 |
"""
|
|
|
dad156 |
@@ -69,11 +69,10 @@ class Podman(Plugin):
|
|
|
dad156 |
for con in result['output'].splitlines():
|
|
|
dad156 |
insp.add(con)
|
|
|
dad156 |
|
|
|
dad156 |
- if insp:
|
|
|
dad156 |
- for container in insp:
|
|
|
dad156 |
- self.add_cmd_output("podman inspect %s" % container)
|
|
|
dad156 |
- if self.get_option('logs'):
|
|
|
dad156 |
- self.add_cmd_output("podman logs -t %s" % container)
|
|
|
dad156 |
+ for container in insp:
|
|
|
dad156 |
+ self.add_cmd_output("podman inspect %s" % container)
|
|
|
dad156 |
+ if self.get_option('logs'):
|
|
|
dad156 |
+ self.add_cmd_output("podman logs -t %s" % container)
|
|
|
dad156 |
|
|
|
dad156 |
|
|
|
dad156 |
# vim: set et ts=4 sw=4 :
|
|
|
dad156 |
--
|
|
|
dad156 |
2.17.2
|
|
|
dad156 |
|