aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2015-01-20 16:16:17 +0000
committerBryn M. Reeves <bmr@redhat.com>2015-01-20 16:16:17 +0000
commit05466cd6d9d70321fc7a0097334ef36af8dfeb43 (patch)
treed4d251b81aef435a913bbced13dc78e87f2eb33d
parent70d026420fe4eacfddb4abb544ded60c2a055dae (diff)
downloadsos-05466cd6d9d70321fc7a0097334ef36af8dfeb43.tar.gz
[mysql] test for boolean values in user and password options
If sosreport is run with '-a' all options will be set to boolean True. This causes an exception if an attempt is made to set an environment variable to the option value: Traceback (most recent call last): File "/usr/sbin/sosreport", line 25, in <module> main(sys.argv[1:]) File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1435, in main sos.execute() TypeError: must be string, not bool > /usr/lib64/python2.7/os.py(471)__setitem__() -> putenv(key, item) Test both values with isinstance(val, bool) and do not attempt to collect a database dump if either is a boolean. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/mysql.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/sos/plugins/mysql.py b/sos/plugins/mysql.py
index edab6d01..dd899a36 100644
--- a/sos/plugins/mysql.py
+++ b/sos/plugins/mysql.py
@@ -45,6 +45,9 @@ class Mysql(Plugin):
if self.get_option("dbdump"):
dbuser = self.get_option("dbuser")
dbpass = self.get_option("dbpass")
+ if isinstance(dbuser, bool) or isinstance(dbpass, bool):
+ # sosreport -a
+ return
if 'MYSQL_PWD' in os.environ:
dbpass = os.environ['MYSQL_PWD']
if not dbpass or dbpass is False: