Blame SOURCES/sos-bz1695583-postgres-mysql-incorrect-defaults.patch

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