Bug 1959413

Summary: saphana plugin missing argument traceback
Product: Red Hat Enterprise Linux 8 Reporter: Miroslav Hradílek <mhradile>
Component: sosAssignee: Pavel Moravec <pmoravec>
Status: CLOSED ERRATA QA Contact: Miroslav Hradílek <mhradile>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.5CC: agk, bmr, plambri, sbradley, theute
Target Milestone: betaKeywords: Triaged
Target Release: 8.5   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: sos-4.1-2.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 19:36:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Miroslav Hradílek 2021-05-11 13:38:24 UTC
Description of problem:
Plugin saphana crashes on missing argument when get_inst_info() is called.

Version-Release number of selected component (if applicable):
sos-4.1-1.el8.noarch (unreleased)

How reproducible:
100%

Steps to Reproduce:
# mkdir -p /hana/shared/A01/HDB01/
# mkdir -p /hana/shared/A02/HDB02/

# sos report -o saphana --batch
. . .
 Setting up archive ...
 Setting up plugins ...
caught exception in plugin method "saphana.setup()"
writing traceback to sos_logs/saphana-plugin-errors.txt
 Running plugins. Please wait ...
. . .

# tar -tf /var/tmp/sosreport-hostname-vbmsorx.tar.xz | grep saphana
sosreport-hostname-vbmsorx/sos_commands/saphana/
sosreport-hostname-vbmsorx/sos_commands/saphana/A01_HDB_info
sosreport-hostname-vbmsorx/sos_commands/saphana/A01_version
sosreport-hostname-vbmsorx/sos_commands/saphana/A01_memusage
sosreport-hostname-vbmsorx/sos_commands/saphana/A01_replicainfo
sosreport-hostname-vbmsorx/sos_logs/saphana-plugin-errors.txt

# tar -xf /var/tmp/sosreport-hostname-vbmsorx.tar.xz
# cat sosreport-hostname-vbmsorx/sos_logs/saphana-plugin-errors.txt
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/sos/report/__init__.py", line 906, in setup
    plug.setup()
  File "/usr/lib/python3.6/site-packages/sos/report/plugins/saphana.py", line 52, in setup
    self.get_inst_info(sid, sidadm, inst)
TypeError: get_inst_info() missing 1 required positional argument: 'inst'


Expected results:
No traceback collect info for both dirs like in 4.0.

# tar -tf /var/tmp/sosreport-hostname-nsugfzu.tar.xz | grep saphana
sosreport-hostname-nsugfzu/sos_commands/saphana/
sosreport-hostname-nsugfzu/sos_commands/saphana/A01_HDB_info
sosreport-hostname-nsugfzu/sos_commands/saphana/A01_version
sosreport-hostname-nsugfzu/sos_commands/saphana/A01_memusage
sosreport-hostname-nsugfzu/sos_commands/saphana/A01_replicainfo
sosreport-hostname-nsugfzu/sos_commands/saphana/A01_01_status
sosreport-hostname-nsugfzu/sos_commands/saphana/A02_HDB_info
sosreport-hostname-nsugfzu/sos_commands/saphana/A02_version
sosreport-hostname-nsugfzu/sos_commands/saphana/A02_memusage
sosreport-hostname-nsugfzu/sos_commands/saphana/A02_replicainfo
sosreport-hostname-nsugfzu/sos_commands/saphana/A02_02_status

Additional info:
I believe the issue comes after refactor in
https://github.com/sosreport/sos/commit/e6c65495c7d6efba9a12e44956443ce5aea013f2

and argument was omitted unintentionally. The following change seems to fix it.

--- saphana.bak	2021-05-11 09:19:50.617219406 -0400
+++ /usr/lib/python3.6/site-packages/sos/report/plugins/saphana.py	2021-05-11 09:20:39.017260540 -0400
@@ -49,7 +49,7 @@
                     for inst in os.listdir("/hana/shared/%s/" % sid):
                         if "HDB" in inst:
                             inst = inst.strip()[-2:]
-                            self.get_inst_info(sid, sidadm, inst)
+                            self.get_inst_info(prefix, sid, sidadm, inst)
 
     def get_inst_info(self, prefix, sid, sidadm, inst):
         proc_cmd = 'su - %s -c "sapcontrol -nr %s -function GetProcessList"'

Comment 1 Pavel Moravec 2021-05-11 14:03:48 UTC
A nice catch.

Comment 5 errata-xmlrpc 2021-11-09 19:36:31 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (sos bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2021:4388