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