From fc8da6ab3b35f9764db02e26dc38f4a9e14e7881 Mon Sep 17 00:00:00 2001 From: Jose Castillo Date: Thu, 8 Feb 2024 14:17:13 +0000 Subject: [PATCH] [collect|ocp] Fix backtrace in ocp collector While runnig sos collector in an ocp cluster we got the following trace: Traceback (most recent call last): File "/usr/sbin/sos", line 22, in sos.execute() File "/usr/lib/python3.6/site-packages/sos/__init__.py", line 193, in execute self._component.execute() File "/usr/lib/python3.6/site-packages/sos/collector/__init__.py", line 1175, in execute self.prep() File "/usr/lib/python3.6/site-packages/sos/collector/__init__.py", line 896, in prep self.cluster.setup() File "/usr/lib/python3.6/site-packages/sos/collector/clusters/ocp.py", line 132, in setup out = self.exec_primary_cmd(self.fmt_oc_cmd("auth can-i '*' '*'")) File "/usr/lib/python3.6/site-packages/sos/collector/clusters/ocp.py", line 104, in fmt_oc_cmd return "%s %s" % (self.oc_cmd, cmd) File "/usr/lib/python3.6/site-packages/sos/collector/clusters/ocp.py", line 81, in oc_cmd 'which oc', chroot=self.primary.host.sysroot TypeError: run_command() got an unexpected keyword argument 'chroot' This patch changes the unused option 'chroot' that was undefined in run_command() to the option need_root that was in use in other commands in ocp.py. Related: RH: RHEL-24351 Co-authored-by: Alberto Losada Grande Signed-off-by: Jose Castillo --- sos/collector/clusters/ocp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sos/collector/clusters/ocp.py b/sos/collector/clusters/ocp.py index e0db93d365..61785ab6a9 100644 --- a/sos/collector/clusters/ocp.py +++ b/sos/collector/clusters/ocp.py @@ -79,7 +79,7 @@ def oc_cmd(self): self._oc_cmd = 'oc' if self.primary.host.in_container(): _oc_path = self.primary.run_command( - 'which oc', chroot=self.primary.host.sysroot + 'which oc' ) if _oc_path['status'] == 0: self._oc_cmd = os.path.join(