Bug 1967119

Summary: saphana plugin missing argument traceback
Product: Red Hat Enterprise Linux 9 Reporter: Pavel Moravec <pmoravec>
Component: sosAssignee: Pavel Moravec <pmoravec>
Status: CLOSED CURRENTRELEASE QA Contact: Miroslav HradĂ­lek <mhradile>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: agk, bmr, mhradile, plambri, sbradley, theute
Target Milestone: beta   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: sos-4.1-5.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-07 21:44:43 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 Pavel Moravec 2021-06-02 12:56:33 UTC
This bug was initially created as a copy of Bug #1959413

I am copying this bug because: 

to have rhel 8.5 in par with 9.0 beta



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"'