Skip to content

Commit

Permalink
[aap_containerized] Check podman command for errors before using it
Browse files Browse the repository at this point in the history
This commit checks that the output of the command:

'podman ps -a --format {{{{.Names}}}}'

Ran without errors, so the container names returned
is correct.

Resolves: RHEL-77339

Signed-off-by: Jose Castillo <[email protected]>
  • Loading branch information
jcastill authored and TurboTurtle committed Feb 4, 2025
1 parent efa9ed2 commit 4305ba2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sos/report/plugins/aap_containerized.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ def _get_aap_container_names(self, username):
try:
cmd = f"su - {username} -c 'podman ps -a --format {{{{.Names}}}}'"
cmd_out = self.exec_cmd(cmd)
return cmd_out['output'].strip().split("\n")
if cmd_out['status'] == 0:
return cmd_out['output'].strip().split("\n")
return []
except Exception:
self._log_error("Error retrieving Podman containers")
return []
Expand Down

0 comments on commit 4305ba2

Please sign in to comment.