diff options
author | Pavel Moravec <pmoravec@redhat.com> | 2020-07-09 15:38:47 +0200 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2020-07-16 13:23:48 -0400 |
commit | 2b158a5c2a963c52cf5a96b27cc07c73b5829d59 (patch) | |
tree | b07136c5c344bfa4b582ba3c9c8433302a9bbbc3 | |
parent | 43b4a9ab8f3b9ff9666f377ffce08e64688855e5 (diff) | |
download | sos-2b158a5c2a963c52cf5a96b27cc07c73b5829d59.tar.gz |
[containers_common] collect user-related commands outputs
podman and buildah commands should be collected on per-user basis,
as declared by rootlessusers plugin option.
Resolves: #2145
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r-- | sos/report/plugins/containers_common.py | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/sos/report/plugins/containers_common.py b/sos/report/plugins/containers_common.py index 92c2e9e8..08962a94 100644 --- a/sos/report/plugins/containers_common.py +++ b/sos/report/plugins/containers_common.py @@ -30,7 +30,6 @@ class ContainersCommon(Plugin, RedHatPlugin, UbuntuPlugin): '/etc/subuid', '/etc/subgid', ]) - self.add_cmd_output(['loginctl user-status']) users_opt = self.get_option('rootlessusers') users_list = [] @@ -38,19 +37,36 @@ class ContainersCommon(Plugin, RedHatPlugin, UbuntuPlugin): users_list = [x for x in users_opt.split(':') if x] user_subcmds = [ - 'info', - 'unshare cat /proc/self/uid_map', - 'unshare cat /proc/self/gid_map' + 'podman info', + 'podman unshare cat /proc/self/uid_map', + 'podman unshare cat /proc/self/gid_map', + 'podman images', + 'podman pod ps', + 'podman port --all', + 'podman ps', + 'podman ps -a', + 'podman stats --no-stream --all', + 'podman version', + 'podman volume ls', + 'buildah info', + 'buildah unshare cat /proc/self/uid_map', + 'buildah unshare cat /proc/self/gid_map', + 'buildah containers', + 'buildah containers --all', + 'buildah images', + 'buildah images --all', + 'buildah version', ] for user in users_list: # collect user's containers' config self.add_copy_spec( '%s/.config/containers/' % (os.path.expanduser('~%s' % user))) - # collect the user's podman/buildah info and uid/guid maps - for binary in ['/usr/bin/podman', '/usr/bin/buildah']: - for cmd in user_subcmds: - self.add_cmd_output([ - 'machinectl -q shell %s@ %s %s' % (user, binary, cmd) - ], foreground=True) + # collect user-status + self.add_cmd_output('loginctl user-status %s' % user) + # collect the user's related commands + self.add_cmd_output([ + 'machinectl -q shell %s@ /usr/bin/%s' % (user, cmd) + for cmd in user_subcmds + ], foreground=True) # vim: set et ts=4 sw=4 : |