Bug 2065551

Summary: SAP NW Plugin exception "IndexError: list index out of range"
Product: Red Hat Enterprise Linux 9 Reporter: Pavel Moravec <pmoravec>
Component: sosAssignee: Pavel Moravec <pmoravec>
Status: CLOSED ERRATA QA Contact: Miroslav HradĂ­lek <mhradile>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.0CC: agk, bmr, mhradile, mkluson, plambri, rdulhani, sbradley, theute
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: sos-4.3-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 11:12:24 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 2022-03-18 07:57:34 UTC
This bug was initially created as a copy of Bug #1992938

I am copying this bug because: 

to be in par 8.7 / 9.1

Description of problem:


Please enter the case id that you are generating this report for []:

 Setting up archive ...
 Setting up plugins ...
[plugin:firewalld] skipped command 'nft list ruleset': required kmods missing: nfnetlink, nf                                                                                 _tables.  Use '--allow-system-changes' to enable collection.
[plugin:ipa] skipped command 'getcert list': required services missing: certmonger.
[plugin:networking] skipped command 'ip6tables -t nat -nvL': required kmods missing: ip6tabl                                                                                 e_nat.
[plugin:networking] skipped command 'ip6tables -t mangle -nvL': required kmods missing: ip6t                                                                                 able_mangle.
[plugin:networking] skipped command 'ip6tables -t filter -nvL': required kmods missing: ip6t                                                                                 able_filter.
[plugin:networking] skipped command 'nft list ruleset': required kmods missing: nf_tables.
[plugin:networking] skipped command 'ip -s macsec show': required kmods missing: macsec.  Us                                                                                 e '--allow-system-changes' to enable collection.
[plugin:networking] skipped command 'ss -peaonmi': required kmods missing: inet_diag, udp_di                                                                                 ag, tcp_diag, netlink_diag, af_packet_diag, unix_diag.  Use '--allow-system-changes' to enab                                                                                 le collection.
[plugin:networking] skipped command 'ip6tables -vnxL': required kmods missing: ip6table_filt                                                                                 er.
caught exception in plugin method "sapnw.setup()"
caught exception in plugin method "sapnw.setup()"
writing traceback to sos_logs/sapnw-plugin-errors.txt
writing traceback to sos_logs/sapnw-plugin-errors.txt
 Running plugins. Please wait ...

  Finishing plugins              [Running: yum]                                           ]
  Finished running plugins
Creating compressed archive...

Your sosreport has been generated and saved in:
  /var/tmp/sosreport-li-lc-1437-2021-08-04-rtskgnq.tar.xz

 Size   14.97MiB
 Owner  root
 md5    1557e9faf61fa030cc9304c982b7b5c8

Please send this file to your support representative.
~~~

sos_logs/sapnw-plugin-errors.txt contains:
~~~
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 981, in setup
    plug.setup()
  File "/usr/lib/python2.7/site-packages/sos/plugins/sapnw.py", line 135, in setup
    self.collect_list_instances()
  File "/usr/lib/python2.7/site-packages/sos/plugins/sapnw.py", line 44, in collect_list_instances
    sid = fields[3]
IndexError: list index out of range
~~~


Version-Release number of selected component (if applicable):

  SAPHostAgent.x86_64 0:721.51-0
  Package - sos-3.9-5.el7_9.6.noarch.rpm



How reproducible:


Steps to Reproduce:
 
Reproducer is simple:
- Install SAPHostAgent RPM
- Run  'sudo sosreport -o sapnw'

See below the proof on a system where the plugin first works and then after intsalling SAPHostAgent rpm it gives an exception:

~~~
[Azure] vrempet-admin@li-lc-2622 ~
$ sudo sosreport -o sapnw

sosreport (version 3.9)

This command will collect diagnostic and configuration information from
this Red Hat Enterprise Linux system and installed applications.

An archive containing the collected information will be generated in
/var/tmp/sos.lQPoFe and may be provided to a Red Hat support
representative.

Any information provided to Red Hat will be treated in accordance with
the published support policies at:

  https://access.redhat.com/support/

The generated archive may contain data considered sensitive and its
content should be reviewed by the originating organization before being
passed to any third party.

No changes will be made to system configuration.

Press ENTER to continue, or CTRL-C to quit.

Please enter the case id that you are generating this report for []:

 Setting up archive ...
 Setting up plugins ...
 Running plugins. Please wait ...

  Starting 1/1   sapnw           [Running: sapnw]
  Finished running plugins
Creating compressed archive...

Your sosreport has been generated and saved in:
  /var/tmp/sosreport-li-lc-2622-2021-08-05-cezxrru.tar.xz

 Size   1.08KiB
 Owner  root
 md5    d402734ea2b06a22bef72ded95bf1b4a

Please send this file to your support representative.


[Azure] vrempet-admin@li-lc-2622 ~
$ sudo yum install SAPHostAgent
Loaded plugins: changelog, enabled_repos_upload, package_upload, product-id, search-disabled-repos, subscription-manager
Hilti_HOICI_HOICI-2_1_99-ci                                                                                            | 2.1 kB  00:00:00
Hilti_HOIOS_HOIOS-7_9_99-ci                                                                                            | 2.1 kB  00:00:00
Hilti_HOIPRODUCTS_HOIPRODUCTS-2_0_99-ci                                                                                | 2.1 kB  00:00:00
Hilti_HOIRHEL_HOIRHEL-7_9-d20210801                                                                                    | 2.1 kB  00:00:00
rhel-7-server-optional-rpms                                                                                            | 1.8 kB  00:00:00
rhel-7-server-rpms                                                                                                     | 2.0 kB  00:00:00
rhel-7-server-satellite-tools-6.9-rpms                                                                                 | 2.1 kB  00:00:00
rhel-sap-for-rhel-7-server-rpms                                                                                        | 2.0 kB  00:00:00
rhel-server-rhscl-7-rpms                                                                                               | 2.0 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package SAPHostAgent.x86_64 0:721.51-0 will be installed
y--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================
 Package                      Arch                   Version                    Repository                                               Size
==============================================================================================================================================
Installing:
 SAPHostAgent                 x86_64                 721.51-0                   Hilti_HOIPRODUCTS_HOIPRODUCTS-2_0_99-ci                  73 M

Transaction Summary
==============================================================================================================================================
Install  1 Package

Total download size: 73 M
Installed size: 225 M
Is this ok [y/d/N]: y
Downloading packages:
SAPHostAgent-721.51-0.x86_64.rpm                                                                                       |  73 MB  00:00:05
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
You should set a password for the new user "sapadm" after the package has been installed.
  Installing : SAPHostAgent-721.51-0.x86_64                                                                                               1/1
-> Start /usr/sap/hostctrl/exe/saphostexec pf=/usr/sap/hostctrl/exe/host_profile <-
start hostcontrol using profile /usr/sap/hostctrl/exe/host_profile
Uploading Package Profile
Loaded plugins: product-id, subscription-manager
  Verifying  : SAPHostAgent-721.51-0.x86_64                                                                                               1/1

Installed:
  SAPHostAgent.x86_64 0:721.51-0

Complete!
Uploading Enabled Repositories Report
Loaded plugins: product-id, subscription-manager

[Azure] vrempet-admin@li-lc-2622 ~
$ sudo sosreport -o sapnw

sosreport (version 3.9)

This command will collect diagnostic and configuration information from
this Red Hat Enterprise Linux system and installed applications.

An archive containing the collected information will be generated in
/var/tmp/sos.0IiEVm and may be provided to a Red Hat support
representative.

Any information provided to Red Hat will be treated in accordance with
the published support policies at:

  https://access.redhat.com/support/

The generated archive may contain data considered sensitive and its
content should be reviewed by the originating organization before being
passed to any third party.

No changes will be made to system configuration.

Press ENTER to continue, or CTRL-C to quit.

Please enter the case id that you are generating this report for []:

 Setting up archive ...
 Setting up plugins ...
caught exception in plugin method "sapnw.setup()"
caught exception in plugin method "sapnw.setup()"
writing traceback to sos_logs/sapnw-plugin-errors.txt
writing traceback to sos_logs/sapnw-plugin-errors.txt
 Running plugins. Please wait ...

  Starting 1/1   sapnw           [Running: sapnw]
  Finished running plugins
Creating compressed archive...

Your sosreport has been generated and saved in:
  /var/tmp/sosreport-li-lc-2622-2021-08-05-vyhyjcd.tar.xz

 Size   1.49KiB
 Owner  root
 md5    b90b69edd7734468352fd69fc8cb8553

Please send this file to your support representative.

[crash/Azure] root@li-lc-2622:~#
~~~

Actual results:

sos_logs/sapnw-plugin-errors.txt contains:
~~~
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 981, in setup
    plug.setup()
  File "/usr/lib/python2.7/site-packages/sos/plugins/sapnw.py", line 135, in setup
    self.collect_list_instances()
  File "/usr/lib/python2.7/site-packages/sos/plugins/sapnw.py", line 44, in collect_list_instances
    sid = fields[3]
IndexError: list index out of range
~~~


Expected results:

Should not throw the exception.


Additional info:

Comment 1 Pavel Moravec 2022-03-18 10:58:16 UTC
Hello,
(same applies here on cloned 9.1 bug)

as our QE might not have available systems for testing the fix, would you be able to verify the fix once available (as a candidate package for 9.1)?

Comment 2 Pavel Moravec 2022-03-24 11:12:45 UTC
How to test this:

mock /usr/sap/hostctrl/exe/saphostctrl to *either* (test both options)

- print "No instances found" and return nonzero (#2643)
- print a line with less than 7 words (i.e. the same) and return zero (#2647)

Comment 10 errata-xmlrpc 2022-11-15 11:12:24 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-2022:8275

Comment 11 Red Hat Bugzilla 2023-09-18 04:33:45 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days