Skip to content

Commit

Permalink
[collect|ocp] Fix backtrace in ocp collector
Browse files Browse the repository at this point in the history
While runnng sos collector in an ocp cluster
we got the following trace:

Traceback (most recent call last):
  File "/usr/sbin/sos", line 22, in <module>
    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 <[email protected]>

Signed-off-by: Jose Castillo <[email protected]>
  • Loading branch information
jcastill committed Feb 9, 2024
1 parent 4a75051 commit a11cba6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sos/collector/clusters/ocp.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,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', need_root=True
)
if _oc_path['status'] == 0:
self._oc_cmd = os.path.join(
Expand Down

0 comments on commit a11cba6

Please sign in to comment.