|
|
fc05a2 |
From 05466cd6d9d70321fc7a0097334ef36af8dfeb43 Mon Sep 17 00:00:00 2001
|
|
|
fc05a2 |
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
|
fc05a2 |
Date: Tue, 20 Jan 2015 16:16:17 +0000
|
|
|
fc05a2 |
Subject: [PATCH] [mysql] test for boolean values in user and password options
|
|
|
fc05a2 |
|
|
|
fc05a2 |
If sosreport is run with '-a' all options will be set to boolean
|
|
|
fc05a2 |
True. This causes an exception if an attempt is made to set an
|
|
|
fc05a2 |
environment variable to the option value:
|
|
|
fc05a2 |
|
|
|
fc05a2 |
Traceback (most recent call last):
|
|
|
fc05a2 |
File "/usr/sbin/sosreport", line 25, in <module>
|
|
|
fc05a2 |
main(sys.argv[1:])
|
|
|
fc05a2 |
File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1435, in main
|
|
|
fc05a2 |
sos.execute()
|
|
|
fc05a2 |
TypeError: must be string, not bool
|
|
|
fc05a2 |
|
|
|
fc05a2 |
> /usr/lib64/python2.7/os.py(471)__setitem__()
|
|
|
fc05a2 |
-> putenv(key, item)
|
|
|
fc05a2 |
|
|
|
fc05a2 |
Test both values with isinstance(val, bool) and do not attempt to
|
|
|
fc05a2 |
collect a database dump if either is a boolean.
|
|
|
fc05a2 |
|
|
|
fc05a2 |
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
|
fc05a2 |
---
|
|
|
fc05a2 |
sos/plugins/mysql.py | 3 +++
|
|
|
fc05a2 |
1 file changed, 3 insertions(+)
|
|
|
fc05a2 |
|
|
|
fc05a2 |
diff --git a/sos/plugins/mysql.py b/sos/plugins/mysql.py
|
|
|
fc05a2 |
index edab6d0..dd899a3 100644
|
|
|
fc05a2 |
--- a/sos/plugins/mysql.py
|
|
|
fc05a2 |
+++ b/sos/plugins/mysql.py
|
|
|
fc05a2 |
@@ -44,6 +44,9 @@ class Mysql(Plugin):
|
|
|
fc05a2 |
if self.get_option("dbdump"):
|
|
|
fc05a2 |
dbuser = self.get_option("dbuser")
|
|
|
fc05a2 |
dbpass = self.get_option("dbpass")
|
|
|
fc05a2 |
+ if isinstance(dbuser, bool) or isinstance(dbpass, bool):
|
|
|
fc05a2 |
+ # sosreport -a
|
|
|
fc05a2 |
+ return
|
|
|
fc05a2 |
if 'MYSQL_PWD' in os.environ:
|
|
|
fc05a2 |
dbpass = os.environ['MYSQL_PWD']
|
|
|
fc05a2 |
if not dbpass or dbpass is False:
|
|
|
fc05a2 |
--
|
|
|
fc05a2 |
1.9.3
|
|
|
fc05a2 |
|