Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1697854

Summary: sos: Incorrect default variables in postgresql and mysql plugins
Product: Red Hat Enterprise Linux 7 Reporter: Pavel Moravec <pmoravec>
Component: sosAssignee: Pavel Moravec <pmoravec>
Status: CLOSED ERRATA QA Contact: Miroslav Hradílek <mhradile>
Severity: high Docs Contact:
Priority: high    
Version: 7.7CC: agk, bmr, gavin, mhradile, mkluson, ovasik, plambri, sbradley
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: sos-3.7-2.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1695583 Environment:
Last Closed: 2019-08-06 13:15:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1695583    
Bug Blocks:    

Description Pavel Moravec 2019-04-09 08:06:47 UTC
+++ This bug was initially created as a clone of Bug #1695583 +++

Description of problem:

There are options with incorrect defaults in plugins 'postgresql', 'mysql' and possibly others. These defaults worked correctly despite this in previous versions of sosreport now it causes empty dumps because database access can not be authorized.

Example from postgresql.py:
    option_list = [
        ('pghome', 'PostgreSQL server home directory.', '', '/var/lib/pgsql'),
        ('username', 'username for pg_dump', '', 'postgres'),
        ('password', 'password for pg_dump' + password_warn_text, '', False),
        ('dbname', 'database name to dump for pg_dump', '', ''),
        ('dbhost', 'database hostname/IP (do not use unix socket)', '', ''),
        ('dbport', 'database server port number', '', '5432')
]

the password option expects string to be defined but in the current version in ends up using 'True' when called with '-k postgresql.password=mysecretpassword' instead of using 'mysecretpassword' when calling pg_dump.

Version-Release number of selected component (if applicable):
new unreleased sos-3.7-1.el7.noarch

Additional info:
Other plugins might be affected by this.

--- Additional comment from Pavel Moravec on 2019-04-04 10:47:56 UTC ---

Simple fix here: replace False by ''.

Ant-work fix: to review all plugins for the same: where expected data type does not match the data type of the default value.

--- Additional comment from Miroslav Hradílek on 2019-04-04 10:53:29 UTC ---

With Pavel, we found out that npm.py plugin is also affected

    option_list = [("project_path", 'List npm modules of a project specified by path', 'fast', 0)]

results in

# sosreport -v -v -v -o npm -k npm.project_path=/tmp/tmp.oe3TnQawRH/fake-project --batch < /dev/null 2>&1 | tee /tmp/tmp.acyAUsysyI
set sysroot to '/' (default)
 sosreport (version 3.6)
 Traceback (most recent call last):
   File "/usr/sbin/sosreport", line 19, in <module>
     main(sys.argv[1:])
   File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1384, in main
     sos.execute()
   File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1334, in execute
     self._set_tunables()
   File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 659, in _set_tunables
     if not plug.set_option(opt, val):
   File "/usr/lib/python2.7/site-packages/sos/plugins/__init__.py", line 712, in set_option
     value = (defaulttype)(value)
 ValueError: invalid literal for int() with base 10: '/tmp/tmp.oe3TnQawRH/fake-project'

Comment 4 errata-xmlrpc 2019-08-06 13:15:47 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, 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-2019:2295