aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/plugins/podman.py41
1 files changed, 29 insertions, 12 deletions
diff --git a/sos/plugins/podman.py b/sos/plugins/podman.py
index 80c1878b..27a8eb1a 100644
--- a/sos/plugins/podman.py
+++ b/sos/plugins/podman.py
@@ -44,8 +44,9 @@ class Podman(Plugin, RedHatPlugin, UbuntuPlugin):
'port --all',
'ps',
'ps -a',
- 'stats --no-stream',
+ 'stats --no-stream --all',
'version',
+ 'volume ls'
]
self.add_cmd_output(["podman %s" % s for s in subcmds])
@@ -54,26 +55,42 @@ class Podman(Plugin, RedHatPlugin, UbuntuPlugin):
if self.get_option('size'):
self.add_cmd_output('podman ps -as')
- self.add_journal(units="podman")
self.add_cmd_output("ls -alhR /etc/cni")
ps_cmd = 'podman ps -q'
if self.get_option('all'):
ps_cmd = "%s -a" % ps_cmd
- img_cmd = 'podman images -q'
- insp = set()
+ fmt = '{{lower .Repository}}:{{lower .Tag}} {{lower .ID}}'
+ img_cmd = "podman images --format='%s'" % fmt
+ vol_cmd = 'podman volume ls -q'
- for icmd in [ps_cmd, img_cmd]:
- result = self.get_command_output(icmd)
- if result['status'] == 0:
- for con in result['output'].splitlines():
- insp.add(con)
+ containers = self._get_podman_list(ps_cmd)
+ images = self._get_podman_list(img_cmd)
+ volumes = self._get_podman_list(vol_cmd)
- for container in insp:
+ for container in containers:
self.add_cmd_output("podman inspect %s" % container)
- if self.get_option('logs'):
- self.add_cmd_output("podman logs -t %s" % container)
+
+ for img in images:
+ name, img_id = img.strip().split()
+ insp = name if 'none' not in name else img_id
+ self.add_cmd_output("podman inspect %s" % insp)
+
+ for vol in volumes:
+ self.add_cmd_output("podman volume inspect %s" % vol)
+
+ if self.get_option('logs'):
+ for con in containers:
+ self.add_cmd_output("podman logs -t %s" % con)
+
+ def _get_podman_list(self, cmd):
+ ret = []
+ result = self.get_command_output(cmd)
+ if result['status'] == 0:
+ for ent in result['output'].splitlines():
+ ret.append(ent)
+ return ret
def postproc(self):
# Attempts to match key=value pairs inside container inspect output