Blame SOURCES/sos-bz1697854-plugopts-default-datatypes.patch

d8dc0d
From c71b41547442d23daf5c3bf88450151d13903214 Mon Sep 17 00:00:00 2001
d8dc0d
From: Pavel Moravec <pmoravec@redhat.com>
d8dc0d
Date: Thu, 4 Apr 2019 13:54:18 +0200
d8dc0d
Subject: [PATCH] [maas,mysql,npm,pacemaker,postgresql] fix plugopts data types
d8dc0d
d8dc0d
With new enforcement of implicit data type for plugin options, the
d8dc0d
plugopts must have proper data types of default values and plugins must work
d8dc0d
with them accordingly (in tests or so).
d8dc0d
d8dc0d
Resolves: #1635
d8dc0d
d8dc0d
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
d8dc0d
---
d8dc0d
 sos/plugins/maas.py       | 6 +++---
d8dc0d
 sos/plugins/mysql.py      | 2 +-
d8dc0d
 sos/plugins/npm.py        | 4 ++--
d8dc0d
 sos/plugins/pacemaker.py  | 4 ++--
d8dc0d
 sos/plugins/postgresql.py | 6 +++---
d8dc0d
 5 files changed, 11 insertions(+), 11 deletions(-)
d8dc0d
d8dc0d
diff --git a/sos/plugins/maas.py b/sos/plugins/maas.py
d8dc0d
index f8305406..ea038e86 100644
d8dc0d
--- a/sos/plugins/maas.py
d8dc0d
+++ b/sos/plugins/maas.py
d8dc0d
@@ -21,10 +21,10 @@ class Maas(Plugin, UbuntuPlugin):
d8dc0d
 
d8dc0d
     option_list = [
d8dc0d
         ('profile-name',
d8dc0d
-         'The name with which you will later refer to this remote', '', False),
d8dc0d
-        ('url', 'The URL of the remote API', '', False),
d8dc0d
+         'The name with which you will later refer to this remote', '', ''),
d8dc0d
+        ('url', 'The URL of the remote API', '', ''),
d8dc0d
         ('credentials',
d8dc0d
-         'The credentials, also known as the API key', '', False)
d8dc0d
+         'The credentials, also known as the API key', '', '')
d8dc0d
     ]
d8dc0d
 
d8dc0d
     def _has_login_options(self):
d8dc0d
diff --git a/sos/plugins/mysql.py b/sos/plugins/mysql.py
d8dc0d
index 49bc4168..411d90b8 100644
d8dc0d
--- a/sos/plugins/mysql.py
d8dc0d
+++ b/sos/plugins/mysql.py
d8dc0d
@@ -22,7 +22,7 @@ class Mysql(Plugin):
d8dc0d
 
d8dc0d
     option_list = [
d8dc0d
         ("dbuser", "username for database dumps", "", "mysql"),
d8dc0d
-        ("dbpass", "password for database dumps" + pw_warn_text, "", False),
d8dc0d
+        ("dbpass", "password for database dumps" + pw_warn_text, "", ""),
d8dc0d
         ("dbdump", "collect a database dump", "", False)
d8dc0d
     ]
d8dc0d
 
d8dc0d
diff --git a/sos/plugins/npm.py b/sos/plugins/npm.py
d8dc0d
index 0fc95801..ca00d0c0 100644
d8dc0d
--- a/sos/plugins/npm.py
d8dc0d
+++ b/sos/plugins/npm.py
d8dc0d
@@ -25,7 +25,7 @@ class Npm(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, SuSEPlugin):
d8dc0d
     option_list = [("project_path",
d8dc0d
                     'List npm modules of a project specified by path',
d8dc0d
                     'fast',
d8dc0d
-                    0)]
d8dc0d
+                    '')]
d8dc0d
 
d8dc0d
     # in Fedora, Debian, Ubuntu and Suse the package is called npm
d8dc0d
     packages = ('npm',)
d8dc0d
@@ -79,7 +79,7 @@ class Npm(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, SuSEPlugin):
d8dc0d
         self.add_string_as_file(json.dumps(output), outfn)
d8dc0d
 
d8dc0d
     def setup(self):
d8dc0d
-        if self.get_option("project_path") != 0:
d8dc0d
+        if self.get_option("project_path"):
d8dc0d
             project_path = os.path.abspath(os.path.expanduser(
d8dc0d
                 self.get_option("project_path")))
d8dc0d
             self._get_npm_output("npm ls --json", "npm_ls_project",
d8dc0d
diff --git a/sos/plugins/pacemaker.py b/sos/plugins/pacemaker.py
d8dc0d
index a1b64ea5..940389ee 100644
d8dc0d
--- a/sos/plugins/pacemaker.py
d8dc0d
+++ b/sos/plugins/pacemaker.py
d8dc0d
@@ -25,7 +25,7 @@ class Pacemaker(Plugin):
d8dc0d
     )
d8dc0d
 
d8dc0d
     option_list = [
d8dc0d
-        ("crm_from", "specify the start time for crm_report", "fast", False),
d8dc0d
+        ("crm_from", "specify the start time for crm_report", "fast", ''),
d8dc0d
         ("crm_scrub", "enable password scrubbing for crm_report", "", True),
d8dc0d
     ]
d8dc0d
 
d8dc0d
@@ -87,7 +87,7 @@ class Pacemaker(Plugin):
d8dc0d
         # time in order to collect data.
d8dc0d
         crm_from = (datetime.today() -
d8dc0d
                     timedelta(hours=72)).strftime("%Y-%m-%d %H:%m:%S")
d8dc0d
-        if self.get_option("crm_from") is not False:
d8dc0d
+        if self.get_option("crm_from"):
d8dc0d
             if re.match(r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}',
d8dc0d
                         str(self.get_option("crm_from"))):
d8dc0d
                 crm_from = self.get_option("crm_from")
d8dc0d
diff --git a/sos/plugins/postgresql.py b/sos/plugins/postgresql.py
d8dc0d
index 1698b62f..a04dca8f 100644
d8dc0d
--- a/sos/plugins/postgresql.py
d8dc0d
+++ b/sos/plugins/postgresql.py
d8dc0d
@@ -31,7 +31,7 @@ class PostgreSQL(Plugin):
d8dc0d
     option_list = [
d8dc0d
         ('pghome', 'PostgreSQL server home directory.', '', '/var/lib/pgsql'),
d8dc0d
         ('username', 'username for pg_dump', '', 'postgres'),
d8dc0d
-        ('password', 'password for pg_dump' + password_warn_text, '', False),
d8dc0d
+        ('password', 'password for pg_dump' + password_warn_text, '', ''),
d8dc0d
         ('dbname', 'database name to dump for pg_dump', '', ''),
d8dc0d
         ('dbhost', 'database hostname/IP (do not use unix socket)', '', ''),
d8dc0d
         ('dbport', 'database server port number', '', '5432')
d8dc0d
@@ -43,8 +43,8 @@ class PostgreSQL(Plugin):
d8dc0d
                 # We're only modifying this for ourself and our children so
d8dc0d
                 # there is no need to save and restore environment variables if
d8dc0d
                 # the user decided to pass the password on the command line.
d8dc0d
-                if self.get_option("password") is not False:
d8dc0d
-                    os.environ["PGPASSWORD"] = str(self.get_option("password"))
d8dc0d
+                if self.get_option("password"):
d8dc0d
+                    os.environ["PGPASSWORD"] = self.get_option("password")
d8dc0d
 
d8dc0d
                 if self.get_option("dbhost"):
d8dc0d
                     cmd = "pg_dump -U %s -h %s -p %s -w -F t %s" % (
d8dc0d
-- 
d8dc0d
2.17.2
d8dc0d