Update to upstream sos-3.2alpha1
Update to 3.2a1 and make specfile source URL handling comply with the Fedora packaging guidelines for github projects.
This commit is contained in:
parent
d98e444937
commit
88f20830bd
@ -1,81 +0,0 @@
|
|||||||
From 4ab4b086c1011997246c40d4c97079c3c001031c Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Fri, 31 Jan 2014 15:08:28 +0000
|
|
||||||
Subject: [PATCH 01/61] Fix cluster module crm_report support
|
|
||||||
|
|
||||||
The cluster plugin used an obsolete sos-2.2 method to determine
|
|
||||||
the command output directory. This causes an excaption at runtime
|
|
||||||
since the referenced properties no longer exist.
|
|
||||||
|
|
||||||
The crm_report script also expects a --from date and will not
|
|
||||||
collect data unless this is passed. Default to passing a value 72
|
|
||||||
hours before the current time and add a 'crm_from' option to the
|
|
||||||
cluster module to allow the user to override this.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/cluster.py | 27 +++++++++++++++++++--------
|
|
||||||
1 file changed, 19 insertions(+), 8 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/cluster.py b/sos/plugins/cluster.py
|
|
||||||
index 50e0e0b..c2ce42b 100644
|
|
||||||
--- a/sos/plugins/cluster.py
|
|
||||||
+++ b/sos/plugins/cluster.py
|
|
||||||
@@ -13,16 +13,17 @@
|
|
||||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
|
|
||||||
from sos.plugins import Plugin, RedHatPlugin
|
|
||||||
-import re
|
|
||||||
+import re, os
|
|
||||||
from glob import glob
|
|
||||||
+from datetime import datetime, timedelta
|
|
||||||
|
|
||||||
class Cluster(Plugin, RedHatPlugin):
|
|
||||||
"""cluster suite and GFS related information
|
|
||||||
"""
|
|
||||||
|
|
||||||
plugin_name = 'cluster'
|
|
||||||
- option_list = [("gfslockdump",
|
|
||||||
- 'gather output of gfs lockdumps', 'slow', False),
|
|
||||||
+ option_list = [("gfslockdump", 'gather output of gfs lockdumps', 'slow', False),
|
|
||||||
+ ("crm_from", 'specify the --from parameter passed to crm_report', 'fast', False),
|
|
||||||
('lockdump', 'gather dlm lockdumps', 'slow', False)]
|
|
||||||
|
|
||||||
packages = [
|
|
||||||
@@ -83,9 +84,21 @@ class Cluster(Plugin, RedHatPlugin):
|
|
||||||
self.add_cmd_output("dlm_tool dump")
|
|
||||||
self.add_cmd_output("dlm_tool ls -n")
|
|
||||||
self.add_cmd_output("mkqdisk -L")
|
|
||||||
- crm_dest = os.path.join(self.cInfo['cmddir'],
|
|
||||||
- self.name(), 'crm_report')
|
|
||||||
- self.collectExtOutput("crm_report -S --dest %s" % crm_dest)
|
|
||||||
+ # crm_report needs to be given a --from "YYYY-MM-DD HH:MM:SS" start
|
|
||||||
+ # time in order to collect data.
|
|
||||||
+ crm_from = (datetime.today()
|
|
||||||
+ - timedelta(hours=72)).strftime("%Y-%m-%d %H:%m:%S")
|
|
||||||
+ if self.get_option('crm_from') != False:
|
|
||||||
+ if re.match(r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}',
|
|
||||||
+ str(self.getOption('crm_from'))):
|
|
||||||
+ crm_from = self.getOption('crm_from')
|
|
||||||
+ else:
|
|
||||||
+ self.soslog.error("crm_from parameter '%s' is not a valid date"
|
|
||||||
+ % self.getOption('crm_from'))
|
|
||||||
+
|
|
||||||
+ crm_dest = os.path.join(self.get_cmd_dir(), 'crm_report')
|
|
||||||
+ self.add_cmd_output('crm_report -S -d --dest %s --from "%s"'
|
|
||||||
+ % (crm_dest, crm_from))
|
|
||||||
|
|
||||||
def do_lockdump(self):
|
|
||||||
status, output, time = self.call_ext_prog("dlm_tool ls")
|
|
||||||
@@ -106,8 +119,6 @@ class Cluster(Plugin, RedHatPlugin):
|
|
||||||
self.do_file_sub(cluster_conf,
|
|
||||||
r"(\s*\<fencedevice\s*.*\s*passwd\s*=\s*)\S+(\")",
|
|
||||||
r"\1%s" %('"***"'))
|
|
||||||
- for luci_cfg in glob("/var/lib/luci/etc/*.ini*"):
|
|
||||||
- self.do_file_sub(luci_cfg, r"(.*secret\s*=\s*)\S+", r"\1******")
|
|
||||||
self.do_cmd_output_sub("corosync-objctl",
|
|
||||||
r"(.*fence.*\.passwd=)(.*)",
|
|
||||||
r"\1******")
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
|||||||
From c344b0396b4ef4435860eb6e3954972e028e3491 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Fri, 31 Jan 2014 15:25:15 +0000
|
|
||||||
Subject: [PATCH 02/61] Remove obsolete diagnostics code from ldap plugin
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/ldap.py | 12 ------------
|
|
||||||
1 file changed, 12 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/ldap.py b/sos/plugins/ldap.py
|
|
||||||
index 361de73..f1032a9 100644
|
|
||||||
--- a/sos/plugins/ldap.py
|
|
||||||
+++ b/sos/plugins/ldap.py
|
|
||||||
@@ -22,18 +22,6 @@ class Ldap(Plugin):
|
|
||||||
plugin_name = "ldap"
|
|
||||||
ldap_conf = "/etc/openldap/ldap.conf"
|
|
||||||
|
|
||||||
- def get_ldap_opts(self):
|
|
||||||
- # capture /etc/openldap/ldap.conf options in dict
|
|
||||||
- # FIXME: possibly not hardcode these options in?
|
|
||||||
- ldapopts=["URI","BASE","TLS_CACERTDIR"]
|
|
||||||
- results={}
|
|
||||||
- tmplist=[]
|
|
||||||
- for i in ldapopts:
|
|
||||||
- t=self.do_regex_find_all(r"^(%s)\s+(.*)" % i,self.ldap_conf)
|
|
||||||
- for x in t:
|
|
||||||
- results[x[0]]=x[1].rstrip("\n")
|
|
||||||
- return results
|
|
||||||
-
|
|
||||||
def setup(self):
|
|
||||||
super(Ldap, self).setup()
|
|
||||||
self.add_copy_spec("/etc/ldap.conf")
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
|||||||
From 3c52bbd14c881748998c0edfb328c8c0ca92842f Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Fri, 31 Jan 2014 15:43:44 +0000
|
|
||||||
Subject: [PATCH 03/61] Ensure superclass postproc method is called in ldap
|
|
||||||
plugin
|
|
||||||
|
|
||||||
Since the ldap plugins add files and post-processing methods at
|
|
||||||
multiple class levels (Ldap, RedHatLdap etc.) derived classes
|
|
||||||
must explicitly call their parent class's postproc() method to
|
|
||||||
apply all substitutions to collected data.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/ldap.py | 2 ++
|
|
||||||
1 file changed, 2 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/ldap.py b/sos/plugins/ldap.py
|
|
||||||
index f1032a9..79d8394 100644
|
|
||||||
--- a/sos/plugins/ldap.py
|
|
||||||
+++ b/sos/plugins/ldap.py
|
|
||||||
@@ -45,6 +45,7 @@ class RedHatLdap(Ldap, RedHatPlugin):
|
|
||||||
])
|
|
||||||
|
|
||||||
def postproc(self):
|
|
||||||
+ super(RedHatLdap, self).postproc()
|
|
||||||
self.do_file_sub("/etc/nslcd.conf",
|
|
||||||
r"(\s*bindpw\s*)\S+", r"\1********")
|
|
||||||
self.do_file_sub("/etc/pam_ldap.conf",
|
|
||||||
@@ -77,6 +78,7 @@ class DebianLdap(Ldap, DebianPlugin, UbuntuPlugin):
|
|
||||||
suggest_filename="access_control_lists")
|
|
||||||
|
|
||||||
def postproc(self):
|
|
||||||
+ super(RedHatLdap, self).postproc()
|
|
||||||
self.do_cmd_output_sub(
|
|
||||||
"ldapsearch -Q -LLL -Y EXTERNAL -H ldapi:/// -b cn=config '(!(objectClass=olcSchemaConfig))'",
|
|
||||||
r"(olcRootPW\: \s*)\S+", r"\1********")
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
|||||||
From 43268795e09c91ef7cc8dbef3cb1ddfc5c2bf686 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Fri, 31 Jan 2014 16:03:31 +0000
|
|
||||||
Subject: [PATCH 04/61] Fix cluster postproc regression
|
|
||||||
|
|
||||||
Commit 4ab4b08 inadvertently removed the postprocessing rules for
|
|
||||||
luci configuration. Revert that part of the commit.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/cluster.py | 2 ++
|
|
||||||
1 file changed, 2 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/cluster.py b/sos/plugins/cluster.py
|
|
||||||
index c2ce42b..0fc4ded 100644
|
|
||||||
--- a/sos/plugins/cluster.py
|
|
||||||
+++ b/sos/plugins/cluster.py
|
|
||||||
@@ -119,6 +119,8 @@ class Cluster(Plugin, RedHatPlugin):
|
|
||||||
self.do_file_sub(cluster_conf,
|
|
||||||
r"(\s*\<fencedevice\s*.*\s*passwd\s*=\s*)\S+(\")",
|
|
||||||
r"\1%s" %('"***"'))
|
|
||||||
+ for luci_cfg in glob("/var/lib/luci/etc/*.ini*"):
|
|
||||||
+ self.do_file_sub(luci_cfg, r"(.*secret\s*=\s*)\S+", r"\1******")
|
|
||||||
self.do_cmd_output_sub("corosync-objctl",
|
|
||||||
r"(.*fence.*\.passwd=)(.*)",
|
|
||||||
r"\1******")
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
From c73207037d86a96550b1e0aca9fb8172f4e68754 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Mon, 3 Feb 2014 11:48:46 +0000
|
|
||||||
Subject: [PATCH 05/61] Fix get_option() use in cluster plugin
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/cluster.py | 6 +++---
|
|
||||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/cluster.py b/sos/plugins/cluster.py
|
|
||||||
index 0fc4ded..eeacdab 100644
|
|
||||||
--- a/sos/plugins/cluster.py
|
|
||||||
+++ b/sos/plugins/cluster.py
|
|
||||||
@@ -90,11 +90,11 @@ class Cluster(Plugin, RedHatPlugin):
|
|
||||||
- timedelta(hours=72)).strftime("%Y-%m-%d %H:%m:%S")
|
|
||||||
if self.get_option('crm_from') != False:
|
|
||||||
if re.match(r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}',
|
|
||||||
- str(self.getOption('crm_from'))):
|
|
||||||
- crm_from = self.getOption('crm_from')
|
|
||||||
+ str(self.get_option('crm_from'))):
|
|
||||||
+ crm_from = self.get_option('crm_from')
|
|
||||||
else:
|
|
||||||
self.soslog.error("crm_from parameter '%s' is not a valid date"
|
|
||||||
- % self.getOption('crm_from'))
|
|
||||||
+ % self.get_option('crm_from'))
|
|
||||||
|
|
||||||
crm_dest = os.path.join(self.get_cmd_dir(), 'crm_report')
|
|
||||||
self.add_cmd_output('crm_report -S -d --dest %s --from "%s"'
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
|||||||
From 0338a955a930286beaa7b66c5167be9b15d34d78 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Mon, 3 Feb 2014 12:09:57 +0000
|
|
||||||
Subject: [PATCH 06/61] Fix verbose file logging
|
|
||||||
|
|
||||||
Prior versions of sos enable debug logging to the embedded log
|
|
||||||
file (sos_logs/sos.log) when a single '-v' is given. Restore this
|
|
||||||
behaviour and ensure that command-not-found messages are reported
|
|
||||||
at 'info' rather than 'warning' level.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/__init__.py | 2 +-
|
|
||||||
sos/sosreport.py | 1 +
|
|
||||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
|
|
||||||
index 7c63631..8df430d 100644
|
|
||||||
--- a/sos/plugins/__init__.py
|
|
||||||
+++ b/sos/plugins/__init__.py
|
|
||||||
@@ -488,7 +488,7 @@ class Plugin(object):
|
|
||||||
self.soslog.warning("command '%s' timed out after %ds"
|
|
||||||
% (prog, timeout))
|
|
||||||
if status == 127:
|
|
||||||
- self.soslog.warning("could not run '%s': command not found" % prog)
|
|
||||||
+ self.soslog.info("could not run '%s': command not found" % prog)
|
|
||||||
return (status, output, runtime)
|
|
||||||
|
|
||||||
def call_ext_prog(self, prog, timeout=300):
|
|
||||||
diff --git a/sos/sosreport.py b/sos/sosreport.py
|
|
||||||
index 4b52572..0faa364 100644
|
|
||||||
--- a/sos/sosreport.py
|
|
||||||
+++ b/sos/sosreport.py
|
|
||||||
@@ -659,6 +659,7 @@ class SoSReport(object):
|
|
||||||
flog.setLevel(logging.DEBUG)
|
|
||||||
elif self.opts.verbosity and self.opts.verbosity > 0:
|
|
||||||
console.setLevel(logging.INFO)
|
|
||||||
+ flog.setLevel(logging.DEBUG)
|
|
||||||
else:
|
|
||||||
console.setLevel(logging.WARNING)
|
|
||||||
self.soslog.addHandler(console)
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
From 03662edf4405ab66c0284a76bf68662c1657d5ab Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Mon, 3 Feb 2014 12:26:45 +0000
|
|
||||||
Subject: [PATCH 07/61] Always treat rhevm vdsmlogs option as string
|
|
||||||
|
|
||||||
The rhevm plugin has a 'vdsmlogs' option to pass in a set of log
|
|
||||||
files to be collected. When run with '-a' (or with
|
|
||||||
'-krhevm.vdsmlogs) this evaluates to 'True' (a bool) and causes
|
|
||||||
an exception when this is passed to add_copy_specs().
|
|
||||||
|
|
||||||
Always treat the value as a string.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/rhevm.py | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/rhevm.py b/sos/plugins/rhevm.py
|
|
||||||
index 39b32f4..8068e05 100644
|
|
||||||
--- a/sos/plugins/rhevm.py
|
|
||||||
+++ b/sos/plugins/rhevm.py
|
|
||||||
@@ -13,7 +13,7 @@ class RhevM(Plugin, RedHatPlugin):
|
|
||||||
self.add_copy_spec("/etc/rhevm")
|
|
||||||
self.add_copy_spec("/var/log/rhevm")
|
|
||||||
if self.get_option("vdsmlogs"):
|
|
||||||
- self.add_copy_spec(self.get_option("vdsmlogs"))
|
|
||||||
+ self.add_copy_spec(str(self.get_option("vdsmlogs")))
|
|
||||||
|
|
||||||
def postproc(self):
|
|
||||||
"""
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
From 3b727c296b86172a64dae83cb02a42fe4c5c6af9 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Mon, 3 Feb 2014 13:03:04 +0000
|
|
||||||
Subject: [PATCH 08/61] Add rhsm-debug collection to yum plugin
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/yum.py | 2 ++
|
|
||||||
1 file changed, 2 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/yum.py b/sos/plugins/yum.py
|
|
||||||
index 867302c..a9ae4e4 100644
|
|
||||||
--- a/sos/plugins/yum.py
|
|
||||||
+++ b/sos/plugins/yum.py
|
|
||||||
@@ -48,6 +48,8 @@ class Yum(Plugin, RedHatPlugin):
|
|
||||||
"/var/log/rhsm/rhsmcertd.log"])
|
|
||||||
self.add_cmd_output("subscription-manager list --installed")
|
|
||||||
self.add_cmd_output("subscription-manager list --consumed")
|
|
||||||
+ self.add_cmd_output("rhsm-debug system --destination %s"
|
|
||||||
+ % self.get_cmd_dir())
|
|
||||||
|
|
||||||
if self.get_option("yumlist"):
|
|
||||||
# List various information about available packages
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
|||||||
From a9bf294a6898bb1defb396c0c0bca29234855db6 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Mon, 3 Feb 2014 14:36:46 +0000
|
|
||||||
Subject: [PATCH 09/61] Make get_cmd_output_now() behaviour match 2.2
|
|
||||||
|
|
||||||
The equivalent method in sos-2.2, collectOutputNow() returned an
|
|
||||||
absolute path to the collected file. Since the archive changes in
|
|
||||||
3.0 this now returns a path relative to the root of the archive.
|
|
||||||
|
|
||||||
This breaks existing users of the interface that try to open and
|
|
||||||
process the content of the collected file (e.g. gluster).
|
|
||||||
|
|
||||||
Return a join of the archive path and file path to the caller.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/__init__.py | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
|
|
||||||
index 8df430d..7130c7a 100644
|
|
||||||
--- a/sos/plugins/__init__.py
|
|
||||||
+++ b/sos/plugins/__init__.py
|
|
||||||
@@ -593,7 +593,7 @@ class Plugin(object):
|
|
||||||
time_passed = time() - start_time
|
|
||||||
self.proflog.debug("output: %-75s time: %f" % (exe, time_passed))
|
|
||||||
|
|
||||||
- return outfn
|
|
||||||
+ return os.path.join(self.archive.get_archive_path(), outfn)
|
|
||||||
|
|
||||||
# For adding output
|
|
||||||
def add_alert(self, alertstring):
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
|||||||
From 722f87787eaf8b50d16a3964892b16880c8bdbbb Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Mon, 3 Feb 2014 15:17:55 +0000
|
|
||||||
Subject: [PATCH 10/61] Include geo-replication status in gluster plugin
|
|
||||||
|
|
||||||
Add the output of 'gluster volume geo-replication status' for
|
|
||||||
each discovered gluster volume to the report.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/gluster.py | 7 +++++++
|
|
||||||
1 file changed, 7 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/gluster.py b/sos/plugins/gluster.py
|
|
||||||
index 7c54fa0..02dbac3 100644
|
|
||||||
--- a/sos/plugins/gluster.py
|
|
||||||
+++ b/sos/plugins/gluster.py
|
|
||||||
@@ -102,6 +102,13 @@ class Gluster(Plugin, RedHatPlugin):
|
|
||||||
self.add_copy_spec('/tmp/glusterdump.options')
|
|
||||||
self.add_copy_spec(self.statedump_dir)
|
|
||||||
|
|
||||||
+ volume_file = self.get_cmd_output_now("gluster volume info",
|
|
||||||
+ "gluster_volume_info")
|
|
||||||
+ if volume_file:
|
|
||||||
+ for volname in self.get_volume_names(volume_file):
|
|
||||||
+ self.add_cmd_output("gluster volume geo-replication %s status"
|
|
||||||
+ % volname)
|
|
||||||
+
|
|
||||||
self.add_cmd_output("gluster volume status")
|
|
||||||
# collect this last as some of the other actions create log entries
|
|
||||||
self.add_copy_spec("/var/log/glusterfs")
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,132 +0,0 @@
|
|||||||
From ec82bf842d2c8537bf020909cfd406ec0ec3f023 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sandro Bonazzola <sbonazzo@redhat.com>
|
|
||||||
Date: Tue, 4 Feb 2014 15:15:10 +0000
|
|
||||||
Subject: [PATCH 11/61] postgresql: minor fixes
|
|
||||||
|
|
||||||
- pep8 / style fixes
|
|
||||||
- Avoid redefining built-in 'file'
|
|
||||||
|
|
||||||
Signed-off-by: Sandro Bonazzola <sbonazzo@redhat.com>
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/postgresql.py | 60 ++++++++++++++++++++++++++++++-----------------
|
|
||||||
1 file changed, 39 insertions(+), 21 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/postgresql.py b/sos/plugins/postgresql.py
|
|
||||||
index 0a8e5ac..478faff 100644
|
|
||||||
--- a/sos/plugins/postgresql.py
|
|
||||||
+++ b/sos/plugins/postgresql.py
|
|
||||||
@@ -4,6 +4,7 @@ import tempfile
|
|
||||||
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
|
|
||||||
from sos.utilities import find
|
|
||||||
|
|
||||||
+
|
|
||||||
class PostgreSQL(Plugin):
|
|
||||||
"""PostgreSQL related information"""
|
|
||||||
|
|
||||||
@@ -14,26 +15,31 @@ class PostgreSQL(Plugin):
|
|
||||||
tmp_dir = None
|
|
||||||
|
|
||||||
option_list = [
|
|
||||||
- ("pghome", 'PostgreSQL server home directory.', '', '/var/lib/pgsql'),
|
|
||||||
- ("username", 'username for pg_dump', '', 'postgres'),
|
|
||||||
- ("password", 'password for pg_dump', '', ''),
|
|
||||||
- ("dbname", 'database name to dump for pg_dump', '', ''),
|
|
||||||
+ ('pghome', 'PostgreSQL server home directory.', '', '/var/lib/pgsql'),
|
|
||||||
+ ('username', 'username for pg_dump', '', 'postgres'),
|
|
||||||
+ ('password', 'password for pg_dump', '', ''),
|
|
||||||
+ ('dbname', 'database name to dump for pg_dump', '', ''),
|
|
||||||
]
|
|
||||||
|
|
||||||
def pg_dump(self):
|
|
||||||
dest_file = os.path.join(self.tmp_dir, "sos_pgdump.tar")
|
|
||||||
old_env_pgpassword = os.environ.get("PGPASSWORD")
|
|
||||||
os.environ["PGPASSWORD"] = self.get_option("password")
|
|
||||||
- (status, output, rtime) = self.call_ext_prog("pg_dump %s -U %s -w -f %s -F t" %
|
|
||||||
- (self.get_option("dbname"),
|
|
||||||
- self.get_option("username"),
|
|
||||||
- dest_file))
|
|
||||||
+ (status, output, rtime) = self.call_ext_prog(
|
|
||||||
+ "pg_dump %s -U %s -w -f %s -F t" % (
|
|
||||||
+ self.get_option("dbname"),
|
|
||||||
+ self.get_option("username"),
|
|
||||||
+ dest_file
|
|
||||||
+ )
|
|
||||||
+ )
|
|
||||||
if old_env_pgpassword is not None:
|
|
||||||
os.environ["PGPASSWORD"] = old_env_pgpassword
|
|
||||||
if (status == 0):
|
|
||||||
self.add_copy_spec(dest_file)
|
|
||||||
else:
|
|
||||||
- self.add_alert("ERROR: Unable to execute pg_dump. Error(%s)" % (output))
|
|
||||||
+ self.add_alert(
|
|
||||||
+ "ERROR: Unable to execute pg_dump. Error(%s)" % (output)
|
|
||||||
+ )
|
|
||||||
|
|
||||||
def setup(self):
|
|
||||||
if self.get_option("dbname"):
|
|
||||||
@@ -41,13 +47,16 @@ class PostgreSQL(Plugin):
|
|
||||||
self.tmp_dir = tempfile.mkdtemp()
|
|
||||||
self.pg_dump()
|
|
||||||
else:
|
|
||||||
- self.add_alert("WARN: password must be supplied to dump a database.")
|
|
||||||
+ self.add_alert(
|
|
||||||
+ "WARN: password must be supplied to dump a database."
|
|
||||||
+ )
|
|
||||||
|
|
||||||
def postproc(self):
|
|
||||||
import shutil
|
|
||||||
if self.tmp_dir:
|
|
||||||
shutil.rmtree(self.tmp_dir)
|
|
||||||
|
|
||||||
+
|
|
||||||
class RedHatPostgreSQL(PostgreSQL, RedHatPlugin):
|
|
||||||
"""PostgreSQL related information for Red Hat distributions"""
|
|
||||||
|
|
||||||
@@ -55,14 +64,27 @@ class RedHatPostgreSQL(PostgreSQL, RedHatPlugin):
|
|
||||||
super(RedHatPostgreSQL, self).setup()
|
|
||||||
|
|
||||||
# Copy PostgreSQL log files.
|
|
||||||
- for file in find("*.log", self.get_option("pghome")):
|
|
||||||
- self.add_copy_spec(file)
|
|
||||||
+ for filename in find("*.log", self.get_option("pghome")):
|
|
||||||
+ self.add_copy_spec(filename)
|
|
||||||
# Copy PostgreSQL config files.
|
|
||||||
- for file in find("*.conf", self.get_option("pghome")):
|
|
||||||
- self.add_copy_spec(file)
|
|
||||||
+ for filename in find("*.conf", self.get_option("pghome")):
|
|
||||||
+ self.add_copy_spec(filename)
|
|
||||||
+
|
|
||||||
+ self.add_copy_spec(
|
|
||||||
+ os.path.join(
|
|
||||||
+ self.get_option("pghome"),
|
|
||||||
+ "data",
|
|
||||||
+ "PG_VERSION"
|
|
||||||
+ )
|
|
||||||
+ )
|
|
||||||
+ self.add_copy_spec(
|
|
||||||
+ os.path.join(
|
|
||||||
+ self.get_option("pghome"),
|
|
||||||
+ "data",
|
|
||||||
+ "postmaster.opts"
|
|
||||||
+ )
|
|
||||||
+ )
|
|
||||||
|
|
||||||
- self.add_copy_spec(os.path.join(self.get_option("pghome"), "data" , "PG_VERSION"))
|
|
||||||
- self.add_copy_spec(os.path.join(self.get_option("pghome"), "data" , "postmaster.opts"))
|
|
||||||
|
|
||||||
class DebianPostgreSQL(PostgreSQL, DebianPlugin, UbuntuPlugin):
|
|
||||||
"""PostgreSQL related information for Debian/Ubuntu distributions"""
|
|
||||||
@@ -78,8 +100,4 @@ class DebianPostgreSQL(PostgreSQL, DebianPlugin, UbuntuPlugin):
|
|
||||||
self.add_copy_spec("/var/lib/postgresql/*/main/PG_VERSION")
|
|
||||||
self.add_copy_spec("/var/lib/postgresql/*/main/postmaster.opts")
|
|
||||||
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
+# vim: expandtab tabstop=4 shiftwidth=4
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
|||||||
From 7c53bbe37e1841777a95331ccaf6a43f39e23f86 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sandro Bonazzola <sbonazzo@redhat.com>
|
|
||||||
Date: Tue, 4 Feb 2014 15:15:51 +0000
|
|
||||||
Subject: [PATCH 12/61] postgresql: add logs about errors / warnings
|
|
||||||
|
|
||||||
give more info to support about what happened while
|
|
||||||
collecting the report.
|
|
||||||
|
|
||||||
Signed-off-by: Sandro Bonazzola <sbonazzo@redhat.com>
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/postgresql.py | 23 +++++++++++++++++++++--
|
|
||||||
1 file changed, 21 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/postgresql.py b/sos/plugins/postgresql.py
|
|
||||||
index 478faff..0aa67a1 100644
|
|
||||||
--- a/sos/plugins/postgresql.py
|
|
||||||
+++ b/sos/plugins/postgresql.py
|
|
||||||
@@ -33,10 +33,13 @@ class PostgreSQL(Plugin):
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if old_env_pgpassword is not None:
|
|
||||||
- os.environ["PGPASSWORD"] = old_env_pgpassword
|
|
||||||
+ os.environ["PGPASSWORD"] = str(old_env_pgpassword)
|
|
||||||
if (status == 0):
|
|
||||||
self.add_copy_spec(dest_file)
|
|
||||||
else:
|
|
||||||
+ self.soslog.error(
|
|
||||||
+ "Unable to execute pg_dump. Error(%s)" % (output)
|
|
||||||
+ )
|
|
||||||
self.add_alert(
|
|
||||||
"ERROR: Unable to execute pg_dump. Error(%s)" % (output)
|
|
||||||
)
|
|
||||||
@@ -47,14 +50,30 @@ class PostgreSQL(Plugin):
|
|
||||||
self.tmp_dir = tempfile.mkdtemp()
|
|
||||||
self.pg_dump()
|
|
||||||
else:
|
|
||||||
+ self.soslog.warning(
|
|
||||||
+ "password must be supplied to dump a database."
|
|
||||||
+ )
|
|
||||||
self.add_alert(
|
|
||||||
"WARN: password must be supplied to dump a database."
|
|
||||||
)
|
|
||||||
+ else:
|
|
||||||
+ self.soslog.warning(
|
|
||||||
+ "dbname must be supplied to dump a database."
|
|
||||||
+ )
|
|
||||||
+ self.add_alert(
|
|
||||||
+ "WARN: dbname must be supplied to dump a database."
|
|
||||||
+ )
|
|
||||||
|
|
||||||
def postproc(self):
|
|
||||||
import shutil
|
|
||||||
if self.tmp_dir:
|
|
||||||
- shutil.rmtree(self.tmp_dir)
|
|
||||||
+ try:
|
|
||||||
+ shutil.rmtree(self.tmp_dir)
|
|
||||||
+ except shutil.Error:
|
|
||||||
+ self.soslog.exception(
|
|
||||||
+ "Unable to remove %s." % (self.tmp_dir)
|
|
||||||
+ )
|
|
||||||
+ self.add_alert("ERROR: Unable to remove %s." % (self.tmp_dir))
|
|
||||||
|
|
||||||
|
|
||||||
class RedHatPostgreSQL(PostgreSQL, RedHatPlugin):
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
|||||||
From b2cc567aa3c6671de9992375032dedeec9d2d4bd Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sandro Bonazzola <sbonazzo@redhat.com>
|
|
||||||
Date: Tue, 4 Feb 2014 15:18:24 +0000
|
|
||||||
Subject: [PATCH 13/61] postgresql: added license and copyright
|
|
||||||
|
|
||||||
Signed-off-by: Sandro Bonazzola <sbonazzo@redhat.com>
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/postgresql.py | 19 +++++++++++++++++++
|
|
||||||
1 file changed, 19 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/postgresql.py b/sos/plugins/postgresql.py
|
|
||||||
index 0aa67a1..df14f86 100644
|
|
||||||
--- a/sos/plugins/postgresql.py
|
|
||||||
+++ b/sos/plugins/postgresql.py
|
|
||||||
@@ -1,3 +1,22 @@
|
|
||||||
+## Copyright (C) 2014 Red Hat, Inc., Sandro Bonazzola <sbonazzo@redhat.com>
|
|
||||||
+## Copyright (C) 2013 Chris J Arges <chris.j.arges@canonical.com>
|
|
||||||
+## Copyright (C) 2012-2013 Red Hat, Inc., Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
+## Copyright (C) 2011 Red Hat, Inc., Jesse Jaggars <jjaggars@redhat.com>
|
|
||||||
+
|
|
||||||
+### This program is free software; you can redistribute it and/or modify
|
|
||||||
+## it under the terms of the GNU General Public License as published by
|
|
||||||
+## the Free Software Foundation; either version 2 of the License, or
|
|
||||||
+## (at your option) any later version.
|
|
||||||
+
|
|
||||||
+## This program is distributed in the hope that it will be useful,
|
|
||||||
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
+## GNU General Public License for more details.
|
|
||||||
+
|
|
||||||
+## You should have received a copy of the GNU General Public License
|
|
||||||
+## along with this program; if not, write to the Free Software
|
|
||||||
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
+
|
|
||||||
import os
|
|
||||||
import tempfile
|
|
||||||
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
|||||||
From cfef4d7ee758bffe6242c0d342261300a0e8194c Mon Sep 17 00:00:00 2001
|
|
||||||
From: Sandro Bonazzola <sbonazzo@redhat.com>
|
|
||||||
Date: Tue, 4 Feb 2014 15:19:19 +0000
|
|
||||||
Subject: [PATCH 14/61] postgresql: allow use TCP socket
|
|
||||||
|
|
||||||
allow to use TCP socket and not only UNIX socket
|
|
||||||
for connecting to postgresql database
|
|
||||||
|
|
||||||
Signed-off-by: Sandro Bonazzola <sbonazzo@redhat.com>
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/postgresql.py | 20 +++++++++++++++-----
|
|
||||||
1 file changed, 15 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/postgresql.py b/sos/plugins/postgresql.py
|
|
||||||
index df14f86..cc51195 100644
|
|
||||||
--- a/sos/plugins/postgresql.py
|
|
||||||
+++ b/sos/plugins/postgresql.py
|
|
||||||
@@ -38,19 +38,29 @@ class PostgreSQL(Plugin):
|
|
||||||
('username', 'username for pg_dump', '', 'postgres'),
|
|
||||||
('password', 'password for pg_dump', '', ''),
|
|
||||||
('dbname', 'database name to dump for pg_dump', '', ''),
|
|
||||||
+ ('dbhost', 'database hostname/IP (do not use unix socket)', '', ''),
|
|
||||||
+ ('dbport', 'database server port number', '', '5432')
|
|
||||||
]
|
|
||||||
|
|
||||||
def pg_dump(self):
|
|
||||||
dest_file = os.path.join(self.tmp_dir, "sos_pgdump.tar")
|
|
||||||
old_env_pgpassword = os.environ.get("PGPASSWORD")
|
|
||||||
os.environ["PGPASSWORD"] = self.get_option("password")
|
|
||||||
- (status, output, rtime) = self.call_ext_prog(
|
|
||||||
- "pg_dump %s -U %s -w -f %s -F t" % (
|
|
||||||
- self.get_option("dbname"),
|
|
||||||
+ if self.get_option("dbhost"):
|
|
||||||
+ cmd = "pg_dump -U %s -h %s -p %s -w -f %s -F t %s" % (
|
|
||||||
self.get_option("username"),
|
|
||||||
- dest_file
|
|
||||||
+ self.get_option("dbhost"),
|
|
||||||
+ self.get_option("dbport"),
|
|
||||||
+ dest_file,
|
|
||||||
+ self.get_option("dbname")
|
|
||||||
)
|
|
||||||
- )
|
|
||||||
+ else:
|
|
||||||
+ cmd = "pg_dump -C -U %s -w -f %s -F t %s " % (
|
|
||||||
+ self.get_option("username"),
|
|
||||||
+ dest_file,
|
|
||||||
+ self.get_option("dbname")
|
|
||||||
+ )
|
|
||||||
+ (status, output, rtime) = self.call_ext_prog(cmd)
|
|
||||||
if old_env_pgpassword is not None:
|
|
||||||
os.environ["PGPASSWORD"] = str(old_env_pgpassword)
|
|
||||||
if (status == 0):
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
From f57c793a07e86c1659b2f5c6b49b93f5007c139c Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Tue, 4 Feb 2014 15:43:56 +0000
|
|
||||||
Subject: [PATCH 15/61] Pass --no-archive to rhsm-debug script
|
|
||||||
|
|
||||||
Versions of subscription-manager since 1.10.11-2.el7 support the
|
|
||||||
--no-archive option to disable creation of a zip archive. Pass
|
|
||||||
this to the script to have the output stored in a directory in
|
|
||||||
the archive.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/yum.py | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/yum.py b/sos/plugins/yum.py
|
|
||||||
index a9ae4e4..81788f1 100644
|
|
||||||
--- a/sos/plugins/yum.py
|
|
||||||
+++ b/sos/plugins/yum.py
|
|
||||||
@@ -48,7 +48,7 @@ class Yum(Plugin, RedHatPlugin):
|
|
||||||
"/var/log/rhsm/rhsmcertd.log"])
|
|
||||||
self.add_cmd_output("subscription-manager list --installed")
|
|
||||||
self.add_cmd_output("subscription-manager list --consumed")
|
|
||||||
- self.add_cmd_output("rhsm-debug system --destination %s"
|
|
||||||
+ self.add_cmd_output("rhsm-debug system --no-archive --destination %s"
|
|
||||||
% self.get_cmd_dir())
|
|
||||||
|
|
||||||
if self.get_option("yumlist"):
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,81 +0,0 @@
|
|||||||
From a96a5e8397b465f556c5a10274a4c7248e737fbf Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Tue, 4 Feb 2014 11:37:15 +0000
|
|
||||||
Subject: [PATCH 16/61] Ensure unused fds are closed when calling subprocesses
|
|
||||||
via Popen
|
|
||||||
|
|
||||||
When sos communicates with a child process using Popen all IO
|
|
||||||
takes place on stdin/stdout/stderr (or a subset). No other open
|
|
||||||
file descriptors should be inherited by the child.
|
|
||||||
|
|
||||||
Make all calls to Popen set close_fds=True.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/archive.py | 6 +++++-
|
|
||||||
sos/plugins/emc.py | 3 ++-
|
|
||||||
sos/policies/redhat.py | 3 ++-
|
|
||||||
sos/utilities.py | 2 +-
|
|
||||||
4 files changed, 10 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/archive.py b/sos/archive.py
|
|
||||||
index f1d4d1f..9e6029b 100644
|
|
||||||
--- a/sos/archive.py
|
|
||||||
+++ b/sos/archive.py
|
|
||||||
@@ -252,7 +252,11 @@ class TarFileArchive(FileCacheArchive):
|
|
||||||
cmd = "%s -1" % cmd
|
|
||||||
try:
|
|
||||||
command = shlex.split("%s %s" % (cmd, self.name()))
|
|
||||||
- p = Popen(command, stdout=PIPE, stderr=PIPE, bufsize=-1)
|
|
||||||
+ p = Popen(command,
|
|
||||||
+ stdout=PIPE,
|
|
||||||
+ stderr=PIPE,
|
|
||||||
+ bufsize=-1,
|
|
||||||
+ close_fds=True)
|
|
||||||
stdout, stderr = p.communicate()
|
|
||||||
if stdout:
|
|
||||||
log.info(stdout.decode('utf-8'))
|
|
||||||
diff --git a/sos/plugins/emc.py b/sos/plugins/emc.py
|
|
||||||
index 6eac7d0..5a2495e 100644
|
|
||||||
--- a/sos/plugins/emc.py
|
|
||||||
+++ b/sos/plugins/emc.py
|
|
||||||
@@ -196,7 +196,8 @@ class Emc(Plugin, RedHatPlugin):
|
|
||||||
while CLARiiON_IP_loop == "stay_in":
|
|
||||||
ans = raw_input("CLARiiON SP IP Address or [Enter] to exit: ")
|
|
||||||
## Check to make sure the CLARiiON SP IP address provided is valid
|
|
||||||
- p = Popen("navicli -h %s getsptime" % (ans,), shell=True, stdout=PIPE, stderr=PIPE)
|
|
||||||
+ p = Popen("navicli -h %s getsptime" % (ans,),
|
|
||||||
+ shell=True, stdout=PIPE, stderr=PIPE, close_fds=True)
|
|
||||||
out, err = p.communicate()
|
|
||||||
if p.returncode == 0:
|
|
||||||
CLARiiON_IP_address_list.append(ans)
|
|
||||||
diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py
|
|
||||||
index 5b3a446..4e5b363 100644
|
|
||||||
--- a/sos/policies/redhat.py
|
|
||||||
+++ b/sos/policies/redhat.py
|
|
||||||
@@ -68,7 +68,8 @@ class RedHatPolicy(LinuxPolicy):
|
|
||||||
shell=True,
|
|
||||||
stdout=PIPE,
|
|
||||||
stderr=PIPE,
|
|
||||||
- bufsize=-1)
|
|
||||||
+ bufsize=-1,
|
|
||||||
+ close_fds=True)
|
|
||||||
out, err = p.communicate()
|
|
||||||
if err:
|
|
||||||
return ret
|
|
||||||
diff --git a/sos/utilities.py b/sos/utilities.py
|
|
||||||
index 7a8674a..a9aca74 100644
|
|
||||||
--- a/sos/utilities.py
|
|
||||||
+++ b/sos/utilities.py
|
|
||||||
@@ -159,7 +159,7 @@ def sos_get_command_output(command, timeout=300):
|
|
||||||
|
|
||||||
p = Popen(command, shell=True,
|
|
||||||
stdout=PIPE, stderr=STDOUT,
|
|
||||||
- bufsize=-1, env = cmd_env)
|
|
||||||
+ bufsize=-1, env = cmd_env, close_fds = True)
|
|
||||||
stdout, stderr = p.communicate()
|
|
||||||
return (p.returncode, stdout.decode('utf-8'), 0)
|
|
||||||
else:
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
From aa0a14db011c59116beb51413ee9a0b253e04f1a Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Mon, 10 Feb 2014 15:07:36 +0000
|
|
||||||
Subject: [PATCH 17/61] Fix gluster volume name extraction
|
|
||||||
|
|
||||||
The get_volume_names() function in the gluster plugin tries to
|
|
||||||
extract volume names from the output of the "gluster volume info"
|
|
||||||
command using a slice range. The range start should be 12 to
|
|
||||||
account for the "Volume Name:" label at the start of the line.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/gluster.py | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/gluster.py b/sos/plugins/gluster.py
|
|
||||||
index 02dbac3..4286b59 100644
|
|
||||||
--- a/sos/plugins/gluster.py
|
|
||||||
+++ b/sos/plugins/gluster.py
|
|
||||||
@@ -39,7 +39,7 @@ class Gluster(Plugin, RedHatPlugin):
|
|
||||||
for line in fp.readlines():
|
|
||||||
if not line.startswith("Volume Name:"):
|
|
||||||
continue
|
|
||||||
- volname = line[14:-1]
|
|
||||||
+ volname = line[12:-1]
|
|
||||||
out.append(volname)
|
|
||||||
fp.close()
|
|
||||||
return out
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
|||||||
From 7f6d34d154b9fe110c168a5b44083d8e35bb2068 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Mon, 10 Feb 2014 15:27:24 +0000
|
|
||||||
Subject: [PATCH 18/61] Add distupgrade plugin
|
|
||||||
|
|
||||||
Add a new plugin to collect data relating to completed or
|
|
||||||
attempted distribution upgrades. Currently supports the Red Hat
|
|
||||||
set of tools and files but other distributions can supply their
|
|
||||||
own filelists or override setup() to perform other distribution
|
|
||||||
specific actions.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/distupgrade.py | 39 +++++++++++++++++++++++++++++++++++++++
|
|
||||||
1 file changed, 39 insertions(+)
|
|
||||||
create mode 100644 sos/plugins/distupgrade.py
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/distupgrade.py b/sos/plugins/distupgrade.py
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..b45d099
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/sos/plugins/distupgrade.py
|
|
||||||
@@ -0,0 +1,39 @@
|
|
||||||
+## Copyright (C) 2014 Red Hat, Inc., Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
+
|
|
||||||
+### This program is free software; you can redistribute it and/or modify
|
|
||||||
+## it under the terms of the GNU General Public License as published by
|
|
||||||
+## the Free Software Foundation; either version 2 of the License, or
|
|
||||||
+## (at your option) any later version.
|
|
||||||
+
|
|
||||||
+## This program is distributed in the hope that it will be useful,
|
|
||||||
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
+## GNU General Public License for more details.
|
|
||||||
+
|
|
||||||
+## You should have received a copy of the GNU General Public License
|
|
||||||
+## along with this program; if not, write to the Free Software
|
|
||||||
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
+
|
|
||||||
+import os
|
|
||||||
+from sos.plugins import Plugin, RedHatPlugin
|
|
||||||
+
|
|
||||||
+class DistUpgrade(Plugin):
|
|
||||||
+ """ Distribution upgrade data """
|
|
||||||
+
|
|
||||||
+ plugin_name = "distupgrade"
|
|
||||||
+
|
|
||||||
+ files = None
|
|
||||||
+
|
|
||||||
+ def setup(self):
|
|
||||||
+ self.add_copy_specs(list(self.files))
|
|
||||||
+
|
|
||||||
+class RedHatDistUpgrade(DistUpgrade, RedHatPlugin):
|
|
||||||
+
|
|
||||||
+ files = (
|
|
||||||
+ "/var/log/upgrade.log",
|
|
||||||
+ "/var/log/redhat_update_tool.log",
|
|
||||||
+ "/root/preupgrade/all-xccdf*",
|
|
||||||
+ "/root/preupgrade/kickstart"
|
|
||||||
+ )
|
|
||||||
+
|
|
||||||
+
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
|||||||
From c48b762c2e98ee05a17375af7427af702f9c9925 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Tue, 11 Feb 2014 16:53:16 +0000
|
|
||||||
Subject: [PATCH 19/61] Fix command output substitution exception
|
|
||||||
|
|
||||||
If a comand has a substitution registered via do_cmd_output_sub()
|
|
||||||
but no data was collected (e.g. command not found) the postproc
|
|
||||||
code will throw an exception as the return value ('replacements')
|
|
||||||
is never assigned.
|
|
||||||
|
|
||||||
Initialise replacements to None before scanning the list of run
|
|
||||||
commands and return this if no substitutions were made.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/__init__.py | 7 ++++---
|
|
||||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
|
|
||||||
index 7130c7a..9b643ab 100644
|
|
||||||
--- a/sos/plugins/__init__.py
|
|
||||||
+++ b/sos/plugins/__init__.py
|
|
||||||
@@ -181,6 +181,7 @@ class Plugin(object):
|
|
||||||
if not self.executed_commands:
|
|
||||||
return 0
|
|
||||||
|
|
||||||
+ replacements = None
|
|
||||||
try:
|
|
||||||
for called in self.executed_commands:
|
|
||||||
# was anything collected?
|
|
||||||
@@ -194,12 +195,12 @@ class Plugin(object):
|
|
||||||
regexp, subst, readable.read())
|
|
||||||
if replacements:
|
|
||||||
self.archive.add_string(result, path)
|
|
||||||
- else:
|
|
||||||
- replacements = 0
|
|
||||||
+
|
|
||||||
except Exception as e:
|
|
||||||
msg = 'regex substitution failed for %s in plugin %s with: "%s"'
|
|
||||||
self.soslog.error(msg % (called['exe'], self.name(), e))
|
|
||||||
- replacements = 0
|
|
||||||
+ replacements = None
|
|
||||||
+
|
|
||||||
if self.commons['cmdlineopts'].profiler:
|
|
||||||
time_passed = time() - start_time
|
|
||||||
self.proflog.debug("subst: %-75s time: %f"
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
|||||||
From 61e8147e436533c5ccb75a6061a4fcc7368970b6 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Tue, 11 Feb 2014 16:56:37 +0000
|
|
||||||
Subject: [PATCH 20/61] Improve error message when cluster.crm_from is invalid
|
|
||||||
|
|
||||||
If a user passes a non-date string value as the crm_from parameter
|
|
||||||
of the cluster plugin an error message is logged:
|
|
||||||
|
|
||||||
crm_from parameter 'True' is not a valid date
|
|
||||||
|
|
||||||
The plugin continues to run and uses the default value (T-72hrs)
|
|
||||||
as the value of crm_from. Make this clear in the message displayed
|
|
||||||
to users:
|
|
||||||
|
|
||||||
crm_from parameter 'True' is not a valid date: using default
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/cluster.py | 3 ++-
|
|
||||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/cluster.py b/sos/plugins/cluster.py
|
|
||||||
index eeacdab..8d73dc1 100644
|
|
||||||
--- a/sos/plugins/cluster.py
|
|
||||||
+++ b/sos/plugins/cluster.py
|
|
||||||
@@ -93,7 +93,8 @@ class Cluster(Plugin, RedHatPlugin):
|
|
||||||
str(self.get_option('crm_from'))):
|
|
||||||
crm_from = self.get_option('crm_from')
|
|
||||||
else:
|
|
||||||
- self.soslog.error("crm_from parameter '%s' is not a valid date"
|
|
||||||
+ self.soslog.error(
|
|
||||||
+ "crm_from parameter '%s' is not a valid date: using default"
|
|
||||||
% self.get_option('crm_from'))
|
|
||||||
|
|
||||||
crm_dest = os.path.join(self.get_cmd_dir(), 'crm_report')
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
|||||||
From 2591ac0719c256af3ed3b392f5bc5972ed3a1104 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Fri, 14 Feb 2014 16:54:15 +0000
|
|
||||||
Subject: [PATCH 21/61] Remove useless check_enabled() from sar plugin
|
|
||||||
|
|
||||||
The sar plugin implemented a check_enabled() to catch cases where
|
|
||||||
the plugin is force-enabled on a system with no sar installation.
|
|
||||||
|
|
||||||
This is better handled by runtime checking in setup() which the
|
|
||||||
plugin also does. Kill the check and its annoying error message.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/sar.py | 8 --------
|
|
||||||
1 file changed, 8 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/sar.py b/sos/plugins/sar.py
|
|
||||||
index 1086208..cf53d5b 100644
|
|
||||||
--- a/sos/plugins/sar.py
|
|
||||||
+++ b/sos/plugins/sar.py
|
|
||||||
@@ -28,14 +28,6 @@ class Sar(Plugin,):
|
|
||||||
# size-limit SAR data collected by default (MB)
|
|
||||||
sa_size = 20
|
|
||||||
|
|
||||||
- def check_enabled(self):
|
|
||||||
- # check to see if we are force-enabled with no sar installation
|
|
||||||
- if not os.path.exists(self.sa_path) or not os.path.isdir(self.sa_path):
|
|
||||||
- self.soslog.info("sar directory %s does not exist" % self.sa_path
|
|
||||||
- + " or is not a directory")
|
|
||||||
- return False
|
|
||||||
- return True
|
|
||||||
-
|
|
||||||
def setup(self):
|
|
||||||
if self.get_option("all_sar"):
|
|
||||||
self.sa_size = 0
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
|||||||
From 80e251f4c30d9f8263c472e07d18a4b0b21ebf4e Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Fri, 14 Feb 2014 17:20:25 +0000
|
|
||||||
Subject: [PATCH 22/61] Eliminate hard-coded /var/log/sa paths in sar plugin
|
|
||||||
|
|
||||||
The Sar plugin classes define a self.sa_path - use it consistently
|
|
||||||
throughout the plugin when generating strings containing the path.
|
|
||||||
|
|
||||||
Suggested by David Kutalek.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/sar.py | 6 +++---
|
|
||||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/sar.py b/sos/plugins/sar.py
|
|
||||||
index cf53d5b..470d82f 100644
|
|
||||||
--- a/sos/plugins/sar.py
|
|
||||||
+++ b/sos/plugins/sar.py
|
|
||||||
@@ -32,14 +32,14 @@ class Sar(Plugin,):
|
|
||||||
if self.get_option("all_sar"):
|
|
||||||
self.sa_size = 0
|
|
||||||
|
|
||||||
- self.add_copy_spec_limit("/var/log/sa/sar[0-9]*",
|
|
||||||
+ self.add_copy_spec_limit("%s/sar[0-9]*" % self.sa_path,
|
|
||||||
sizelimit = self.sa_size)
|
|
||||||
- self.add_copy_spec_limit("/var/log/sa/sa[0-9]*",
|
|
||||||
+ self.add_copy_spec_limit("%s/sa[0-9]*" % self.sa_path,
|
|
||||||
sizelimit = self.sa_size)
|
|
||||||
try:
|
|
||||||
dirList = os.listdir(self.sa_path)
|
|
||||||
except:
|
|
||||||
- self.soslog.warning("sar: could not list /var/log/sa")
|
|
||||||
+ self.soslog.warning("sar: could not list %s" % self.sa_path)
|
|
||||||
return
|
|
||||||
# find all the sa file that don't have an existing sar file
|
|
||||||
for fname in dirList:
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
|||||||
From fec14d2d9e0114e959d9626ca1457cd578c1d029 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Fri, 14 Feb 2014 20:12:14 +0000
|
|
||||||
Subject: [PATCH 23/61] Scrub ldap_default_authtok password in sssd plugin
|
|
||||||
|
|
||||||
The file sssd.conf collected by the sssd plugin may contain an
|
|
||||||
ldap password. Add a postproc() method to replace the string with
|
|
||||||
blanks.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/sssd.py | 10 +++++++++-
|
|
||||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/sssd.py b/sos/plugins/sssd.py
|
|
||||||
index b28f4b4..0d201f4 100644
|
|
||||||
--- a/sos/plugins/sssd.py
|
|
||||||
+++ b/sos/plugins/sssd.py
|
|
||||||
@@ -24,7 +24,15 @@ class Sssd(Plugin):
|
|
||||||
packages = ('sssd',)
|
|
||||||
|
|
||||||
def setup(self):
|
|
||||||
- self.add_copy_specs(["/etc/sssd", "/var/log/sssd/*"])
|
|
||||||
+ self.add_copy_specs([
|
|
||||||
+ "/etc/sssd/sssd.conf",
|
|
||||||
+ "/var/log/sssd/*"
|
|
||||||
+ ])
|
|
||||||
+
|
|
||||||
+ def postproc(self):
|
|
||||||
+ self.do_file_sub("/etc/sssd/sssd.conf",
|
|
||||||
+ r"(\s*ldap_default_authtok\s*=\s*)\S+",
|
|
||||||
+ r"\1********")
|
|
||||||
|
|
||||||
class RedHatSssd(Sssd, RedHatPlugin):
|
|
||||||
"""sssd-related Diagnostic Information on Red Hat based distributions
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
From 3dac227dde7af1168fa3c668836d7dde711981bd Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Mon, 3 Mar 2014 13:56:23 +0000
|
|
||||||
Subject: [PATCH 24/61] Replace package check with file check in anacron
|
|
||||||
|
|
||||||
The anacron facility may be provided by packages named 'anacron',
|
|
||||||
'chronie-anacron' etc. They all use a common /etc/anacrontab file
|
|
||||||
so check for this instead.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/anacron.py | 6 ++++--
|
|
||||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/anacron.py b/sos/plugins/anacron.py
|
|
||||||
index a60c85e..e9595a8 100644
|
|
||||||
--- a/sos/plugins/anacron.py
|
|
||||||
+++ b/sos/plugins/anacron.py
|
|
||||||
@@ -21,7 +21,9 @@ class Anacron(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
|
|
||||||
|
|
||||||
plugin_name = 'anacron'
|
|
||||||
|
|
||||||
- packages = ('anacron',)
|
|
||||||
+ # anacron may be provided by anacron, cronie-anacron etc.
|
|
||||||
+ # just look for the configuration file which is common
|
|
||||||
+ files = ('/etc/anacrontab',)
|
|
||||||
|
|
||||||
def setup(self):
|
|
||||||
- self.add_copy_spec("/etc/anacrontab")
|
|
||||||
+ self.add_copy_specs(list(self.files))
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
|||||||
From 3758b10e367117945148c797b4b709d77277b84b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Lee Yarwood <lyarwood@redhat.com>
|
|
||||||
Date: Tue, 4 Mar 2014 16:18:00 +0000
|
|
||||||
Subject: [PATCH 25/61] Remove the rhevm plugin.
|
|
||||||
|
|
||||||
This functionality is now provided by the ovirt-log-collector project [1] and independently shipped
|
|
||||||
VDSM sos plugin [2].
|
|
||||||
|
|
||||||
[1] http://gerrit.ovirt.org/gitweb?p=ovirt-log-collector.git
|
|
||||||
[2] http://gerrit.ovirt.org/gitweb?p=vdsm.git;a=tree;f=vdsm/sos;hb=HEAD
|
|
||||||
|
|
||||||
Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/rhevm.py | 25 -------------------------
|
|
||||||
1 file changed, 25 deletions(-)
|
|
||||||
delete mode 100644 sos/plugins/rhevm.py
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/rhevm.py b/sos/plugins/rhevm.py
|
|
||||||
deleted file mode 100644
|
|
||||||
index 8068e05..0000000
|
|
||||||
--- a/sos/plugins/rhevm.py
|
|
||||||
+++ /dev/null
|
|
||||||
@@ -1,25 +0,0 @@
|
|
||||||
-from sos.plugins import Plugin, RedHatPlugin
|
|
||||||
-
|
|
||||||
-# Class name must be the same as file name and method names must not change
|
|
||||||
-class RhevM(Plugin, RedHatPlugin):
|
|
||||||
- """RHEV-Manager related information"""
|
|
||||||
-
|
|
||||||
- plugin_name = 'rhevm'
|
|
||||||
-
|
|
||||||
- option_list = [("vdsmlogs", 'Directory containing all of the SOS logs from the RHEV hypervisor(s)', '', False)]
|
|
||||||
-
|
|
||||||
- def setup(self):
|
|
||||||
- # Copy rhevm config files.
|
|
||||||
- self.add_copy_spec("/etc/rhevm")
|
|
||||||
- self.add_copy_spec("/var/log/rhevm")
|
|
||||||
- if self.get_option("vdsmlogs"):
|
|
||||||
- self.add_copy_spec(str(self.get_option("vdsmlogs")))
|
|
||||||
-
|
|
||||||
- def postproc(self):
|
|
||||||
- """
|
|
||||||
- Obfuscate passwords.
|
|
||||||
- """
|
|
||||||
-
|
|
||||||
- self.do_file_sub("/etc/rhevm/rhevm-config/rhevm-config.properties",
|
|
||||||
- r"Password.type=(.*)",
|
|
||||||
- r'Password.type=********')
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
|||||||
From 6fb9d5df14b3b0e21db458fd5fcd10691bb9fd0e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
|
|
||||||
Date: Tue, 11 Mar 2014 11:07:51 +0000
|
|
||||||
Subject: [PATCH 26/61] powerpc: Move VPD related tool under common code
|
|
||||||
|
|
||||||
VPD related tools (lsvpd, lscfg, lsmcode) is supported on both
|
|
||||||
pSeries and PowerNV platform. Hence moving these commands under
|
|
||||||
common code.
|
|
||||||
|
|
||||||
Also added support to grab vpd database (/var/lib/lsvpd).
|
|
||||||
|
|
||||||
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
|
|
||||||
---
|
|
||||||
sos/plugins/powerpc.py | 7 ++++---
|
|
||||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
||||||
---
|
|
||||||
sos/plugins/powerpc.py | 7 ++++---
|
|
||||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/powerpc.py b/sos/plugins/powerpc.py
|
|
||||||
index dfaacb9..8fd6b4f 100644
|
|
||||||
--- a/sos/plugins/powerpc.py
|
|
||||||
+++ b/sos/plugins/powerpc.py
|
|
||||||
@@ -52,14 +52,15 @@ class PowerPC(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
|
|
||||||
self.add_cmd_output("ppc64_cpu --run-mode")
|
|
||||||
self.add_cmd_output("ppc64_cpu --frequency")
|
|
||||||
self.add_cmd_output("ppc64_cpu --dscr")
|
|
||||||
+ self.add_cmd_output("lscfg -vp")
|
|
||||||
+ self.add_cmd_output("lsmcode -A")
|
|
||||||
+ self.add_cmd_output("lsvpd --debug")
|
|
||||||
+ self.add_copy_spec("/var/lib/lsvpd/")
|
|
||||||
|
|
||||||
if ispSeries:
|
|
||||||
self.add_copy_spec("/proc/ppc64/lparcfg")
|
|
||||||
self.add_copy_spec("/proc/ppc64/eeh")
|
|
||||||
self.add_copy_spec("/proc/ppc64/systemcfg")
|
|
||||||
- self.add_cmd_output("lscfg -vp")
|
|
||||||
- self.add_cmd_output("lsmcode -A")
|
|
||||||
- self.add_cmd_output("lsvpd --debug")
|
|
||||||
self.add_cmd_output("lsvio -des")
|
|
||||||
self.add_cmd_output("servicelog --dump")
|
|
||||||
self.add_cmd_output("servicelog_notify --list")
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
From a66d4fccfe093dfa29dfaa4808f361bc7063c742 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
|
|
||||||
Date: Tue, 11 Mar 2014 12:18:26 +0000
|
|
||||||
Subject: [PATCH 27/61] Add PowerNV specific debug data
|
|
||||||
|
|
||||||
This patch adds support to collect more debug files on
|
|
||||||
PowerNV platform.
|
|
||||||
|
|
||||||
Signed-off-by: Vasant Hegde <hegdevasant linux vnet ibm com>
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/powerpc.py | 5 ++++-
|
|
||||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
||||||
---
|
|
||||||
sos/plugins/powerpc.py | 5 ++++-
|
|
||||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/powerpc.py b/sos/plugins/powerpc.py
|
|
||||||
index 8fd6b4f..9681094 100644
|
|
||||||
--- a/sos/plugins/powerpc.py
|
|
||||||
+++ b/sos/plugins/powerpc.py
|
|
||||||
@@ -72,4 +72,7 @@ class PowerPC(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
|
|
||||||
|
|
||||||
if isPowerNV:
|
|
||||||
self.add_copy_spec("/proc/ppc64/")
|
|
||||||
-
|
|
||||||
+ self.add_copy_spec("/sys/kernel/debug/powerpc/")
|
|
||||||
+ if os.path.isdir("/var/log/dump"):
|
|
||||||
+ self.add_cmd_output("ls -l /var/log/dump")
|
|
||||||
+
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
|||||||
From 877f93bcd469b939ec044539b9ea4a0d33e9f177 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Tue, 11 Mar 2014 15:27:31 +0000
|
|
||||||
Subject: [PATCH 28/61] Fix remaining use of obsolete 'get_cmd_dir()' in
|
|
||||||
plugins
|
|
||||||
|
|
||||||
The get_cmd_dir() method was renamed to get_cmd_path(). Fix the
|
|
||||||
two remaining uses in yum and cluster plugins.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/cluster.py | 2 +-
|
|
||||||
sos/plugins/yum.py | 2 +-
|
|
||||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/cluster.py b/sos/plugins/cluster.py
|
|
||||||
index 8d73dc1..7957498 100644
|
|
||||||
--- a/sos/plugins/cluster.py
|
|
||||||
+++ b/sos/plugins/cluster.py
|
|
||||||
@@ -97,7 +97,7 @@ class Cluster(Plugin, RedHatPlugin):
|
|
||||||
"crm_from parameter '%s' is not a valid date: using default"
|
|
||||||
% self.get_option('crm_from'))
|
|
||||||
|
|
||||||
- crm_dest = os.path.join(self.get_cmd_dir(), 'crm_report')
|
|
||||||
+ crm_dest = os.path.join(self.get_cmd_path(), 'crm_report')
|
|
||||||
self.add_cmd_output('crm_report -S -d --dest %s --from "%s"'
|
|
||||||
% (crm_dest, crm_from))
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/yum.py b/sos/plugins/yum.py
|
|
||||||
index 81788f1..aa8cb18 100644
|
|
||||||
--- a/sos/plugins/yum.py
|
|
||||||
+++ b/sos/plugins/yum.py
|
|
||||||
@@ -49,7 +49,7 @@ class Yum(Plugin, RedHatPlugin):
|
|
||||||
self.add_cmd_output("subscription-manager list --installed")
|
|
||||||
self.add_cmd_output("subscription-manager list --consumed")
|
|
||||||
self.add_cmd_output("rhsm-debug system --no-archive --destination %s"
|
|
||||||
- % self.get_cmd_dir())
|
|
||||||
+ % self.get_cmd_path())
|
|
||||||
|
|
||||||
if self.get_option("yumlist"):
|
|
||||||
# List various information about available packages
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
|||||||
From 7146472eb85bb4ea39a244ca252e66478b3e30dd Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Wed, 12 Mar 2014 13:02:39 +0000
|
|
||||||
Subject: [PATCH 29/61] Update systemd support
|
|
||||||
|
|
||||||
- Drop support for 'systemctl dump' as this no longer exists.
|
|
||||||
- Add 'systemctl list-units' for convenience
|
|
||||||
- add systemctl show-environment
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/systemd.py | 5 +++--
|
|
||||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/systemd.py b/sos/plugins/systemd.py
|
|
||||||
index 915c8fc..38be63e 100644
|
|
||||||
--- a/sos/plugins/systemd.py
|
|
||||||
+++ b/sos/plugins/systemd.py
|
|
||||||
@@ -27,10 +27,11 @@ class Systemd(Plugin, RedHatPlugin):
|
|
||||||
|
|
||||||
def setup(self):
|
|
||||||
self.add_cmd_output("systemctl show --all")
|
|
||||||
+ self.add_cmd_output("systemctl list-units")
|
|
||||||
self.add_cmd_output("systemctl list-units --failed")
|
|
||||||
- self.add_cmd_output("systemctl list-unit-files")
|
|
||||||
self.add_cmd_output("systemctl list-units --all")
|
|
||||||
- self.add_cmd_output("systemctl dump")
|
|
||||||
+ self.add_cmd_output("systemctl list-unit-files")
|
|
||||||
+ self.add_cmd_output("systemctl show-environment")
|
|
||||||
self.add_cmd_output("systemd-delta")
|
|
||||||
self.add_cmd_output("journalctl --verify")
|
|
||||||
self.add_cmd_output("journalctl --all --this-boot --no-pager")
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
|||||||
From c55c58cf2dabf93c924c839c8ed045c18e31ba1c Mon Sep 17 00:00:00 2001
|
|
||||||
From: Peter Portante <peter.portante@redhat.com>
|
|
||||||
Date: Wed, 29 Jan 2014 21:50:27 -0500
|
|
||||||
Subject: [PATCH 30/61] Add tuned plugin
|
|
||||||
|
|
||||||
Resolves Issue #232.
|
|
||||||
|
|
||||||
Signed-off-by: Peter Portante <peter.portante@redhat.com>
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/tuned.py | 30 ++++++++++++++++++++++++++++++
|
|
||||||
1 file changed, 30 insertions(+)
|
|
||||||
create mode 100644 sos/plugins/tuned.py
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/tuned.py b/sos/plugins/tuned.py
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..60c22bc
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/sos/plugins/tuned.py
|
|
||||||
@@ -0,0 +1,30 @@
|
|
||||||
+## Copyright (C) 2014 Red Hat, Inc., Peter Portante <peter.portante@redhat.com>
|
|
||||||
+
|
|
||||||
+### This program is free software; you can redistribute it and/or modify
|
|
||||||
+## it under the terms of the GNU General Public License as published by
|
|
||||||
+## the Free Software Foundation; either version 2 of the License, or
|
|
||||||
+## (at your option) any later version.
|
|
||||||
+
|
|
||||||
+## This program is distributed in the hope that it will be useful,
|
|
||||||
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
+## GNU General Public License for more details.
|
|
||||||
+
|
|
||||||
+## You should have received a copy of the GNU General Public License
|
|
||||||
+## along with this program; if not, write to the Free Software
|
|
||||||
+## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
+
|
|
||||||
+from sos.plugins import Plugin, RedHatPlugin
|
|
||||||
+
|
|
||||||
+class Tuned(Plugin, RedHatPlugin):
|
|
||||||
+ """Tuned related information
|
|
||||||
+ """
|
|
||||||
+ packages = ('tuned',)
|
|
||||||
+ plugin_name = 'tuned'
|
|
||||||
+
|
|
||||||
+ def setup(self):
|
|
||||||
+ self.add_cmd_output("tuned-adm list")
|
|
||||||
+ self.add_cmd_output("tuned-adm active")
|
|
||||||
+ self.add_cmd_output("tuned-adm recommend")
|
|
||||||
+ self.add_copy_spec("/var/log/tuned/tuned.log")
|
|
||||||
+
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,173 +0,0 @@
|
|||||||
From ef4e4b60eeaef33fa5e4ee074c6736cd3412397b Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Wed, 12 Mar 2014 16:27:34 +0000
|
|
||||||
Subject: [PATCH 31/61] Clean up get_cmd_path/make_cmd_path/make_cmd_dirs mess
|
|
||||||
|
|
||||||
Clean up the Plugin helper methods for handling command output
|
|
||||||
paths. This better matches the proposal in Issue #181 and
|
|
||||||
simplifies code for plugins that need to generate their own
|
|
||||||
paths under sos_commands/<plugin>/.
|
|
||||||
|
|
||||||
- Rename get_cmd_path() to get_cmd_output_path()
|
|
||||||
- Add an optional 'name' parameter to specify a subdirectory
|
|
||||||
name in the plugin's sos_commands/<plugin>/ directory.
|
|
||||||
- Default to creating directories if they do not exist
|
|
||||||
|
|
||||||
Finally fix up all existing users of get_cmd_path() to use the
|
|
||||||
new interface and remove handrolled uses of os.path.join(...) for
|
|
||||||
generating these paths.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/__init__.py | 26 +++++++++-----------------
|
|
||||||
sos/plugins/cluster.py | 2 +-
|
|
||||||
sos/plugins/foreman.py | 6 ++----
|
|
||||||
sos/plugins/katello.py | 6 ++----
|
|
||||||
sos/plugins/lvm2.py | 2 +-
|
|
||||||
sos/plugins/rhui.py | 8 +-------
|
|
||||||
sos/plugins/satellite.py | 2 +-
|
|
||||||
sos/plugins/yum.py | 2 +-
|
|
||||||
8 files changed, 18 insertions(+), 36 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
|
|
||||||
index 9b643ab..efb6950 100644
|
|
||||||
--- a/sos/plugins/__init__.py
|
|
||||||
+++ b/sos/plugins/__init__.py
|
|
||||||
@@ -512,26 +512,18 @@ class Plugin(object):
|
|
||||||
"""Run a program and collect the output"""
|
|
||||||
self.collect_cmds.append( (exe, suggest_filename, root_symlink, timeout) )
|
|
||||||
|
|
||||||
- def get_cmd_path(self):
|
|
||||||
+ def get_cmd_output_path(self, name=None, make=True):
|
|
||||||
"""Return a path into which this module should store collected
|
|
||||||
command output
|
|
||||||
"""
|
|
||||||
- return os.path.join(self.archive.get_tmp_dir(),
|
|
||||||
- 'sos_commands', self.name())
|
|
||||||
-
|
|
||||||
- def make_cmd_path(self, path):
|
|
||||||
- """Return a string representing an absolute path within this
|
|
||||||
- plug-in's command output directory by apending the relative path
|
|
||||||
- name 'path'.
|
|
||||||
- """
|
|
||||||
- return os.path.join(self.get_cmd_path(), path)
|
|
||||||
-
|
|
||||||
-
|
|
||||||
- def make_cmd_dirs(self, path):
|
|
||||||
- """Recursively create new subdirectories under this plug-in's
|
|
||||||
- command output path.
|
|
||||||
- """
|
|
||||||
- os.makedirs(self.make_cmd_path(path))
|
|
||||||
+ cmd_output_path = os.path.join(self.archive.get_tmp_dir(),
|
|
||||||
+ 'sos_commands', self.name())
|
|
||||||
+ if name:
|
|
||||||
+ cmd_output_path = os.path.join(cmd_output_path, name)
|
|
||||||
+ if make:
|
|
||||||
+ os.makedirs(cmd_output_path)
|
|
||||||
+
|
|
||||||
+ return cmd_output_path
|
|
||||||
|
|
||||||
def file_grep(self, regexp, *fnames):
|
|
||||||
"""Returns lines matched in fnames, where fnames can either be
|
|
||||||
diff --git a/sos/plugins/cluster.py b/sos/plugins/cluster.py
|
|
||||||
index 7957498..0b839fa 100644
|
|
||||||
--- a/sos/plugins/cluster.py
|
|
||||||
+++ b/sos/plugins/cluster.py
|
|
||||||
@@ -97,7 +97,7 @@ class Cluster(Plugin, RedHatPlugin):
|
|
||||||
"crm_from parameter '%s' is not a valid date: using default"
|
|
||||||
% self.get_option('crm_from'))
|
|
||||||
|
|
||||||
- crm_dest = os.path.join(self.get_cmd_path(), 'crm_report')
|
|
||||||
+ crm_dest = self.get_cmd_output_path(name='crm_report')
|
|
||||||
self.add_cmd_output('crm_report -S -d --dest %s --from "%s"'
|
|
||||||
% (crm_dest, crm_from))
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/foreman.py b/sos/plugins/foreman.py
|
|
||||||
index ab4dfcb..a2f2881 100644
|
|
||||||
--- a/sos/plugins/foreman.py
|
|
||||||
+++ b/sos/plugins/foreman.py
|
|
||||||
@@ -25,7 +25,5 @@ class Foreman(Plugin, RedHatPlugin):
|
|
||||||
packages = ('foreman')
|
|
||||||
|
|
||||||
def setup(self):
|
|
||||||
- foreman_debug_path = os.path.join(
|
|
||||||
- self.get_cmd_path(),"foreman-debug")
|
|
||||||
- self.add_cmd_output("%s -q -a -d %s"
|
|
||||||
- % ("foreman-debug", foreman_debug_path))
|
|
||||||
+ self.add_cmd_output("%s -q -a -d %s" % ("foreman-debug",
|
|
||||||
+ self.get_cmd_output_path(name="foreman-debug")))
|
|
||||||
diff --git a/sos/plugins/katello.py b/sos/plugins/katello.py
|
|
||||||
index 1999388..acf5d90 100644
|
|
||||||
--- a/sos/plugins/katello.py
|
|
||||||
+++ b/sos/plugins/katello.py
|
|
||||||
@@ -25,7 +25,5 @@ class Katello(Plugin, RedHatPlugin):
|
|
||||||
packages = ('katello', 'katello-common', 'katello-headpin')
|
|
||||||
|
|
||||||
def setup(self):
|
|
||||||
- katello_debug_path = os.path.join(
|
|
||||||
- self.get_cmd_path(),"katello-debug")
|
|
||||||
- self.add_cmd_output("%s --notar -d %s"
|
|
||||||
- % ("katello-debug", katello_debug_path))
|
|
||||||
+ self.add_cmd_output("katello-debug --notar -d %s"
|
|
||||||
+ % self.get_cmd_output_path(name="katello-debug"))
|
|
||||||
diff --git a/sos/plugins/lvm2.py b/sos/plugins/lvm2.py
|
|
||||||
index 1a4d589..102df26 100644
|
|
||||||
--- a/sos/plugins/lvm2.py
|
|
||||||
+++ b/sos/plugins/lvm2.py
|
|
||||||
@@ -34,7 +34,7 @@ class Lvm2(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
|
|
||||||
if metadata:
|
|
||||||
lvmdump_opts = "-a -m"
|
|
||||||
cmd = lvmdump_cmd % (lvmdump_opts,
|
|
||||||
- os.path.join(self.get_cmd_path(), "lvmdump"))
|
|
||||||
+ self.get_cmd_output_path(name="lvmdump"))
|
|
||||||
self.add_cmd_output(cmd)
|
|
||||||
|
|
||||||
def setup(self):
|
|
||||||
diff --git a/sos/plugins/rhui.py b/sos/plugins/rhui.py
|
|
||||||
index a291515..f0413b4 100644
|
|
||||||
--- a/sos/plugins/rhui.py
|
|
||||||
+++ b/sos/plugins/rhui.py
|
|
||||||
@@ -32,13 +32,7 @@ class Rhui(Plugin, RedHatPlugin):
|
|
||||||
else:
|
|
||||||
cds = ""
|
|
||||||
|
|
||||||
- rhui_debug_dst_path = os.path.join(self.get_cmd_path(),
|
|
||||||
- self.commons['cmddir'], self.name())
|
|
||||||
- try:
|
|
||||||
- os.mkdir(rhui_debug_dst_path)
|
|
||||||
- except:
|
|
||||||
- return
|
|
||||||
-
|
|
||||||
+ rhui_debug_dst_path = self.get_cmd_output_path()
|
|
||||||
self.add_cmd_output("python %s %s --dir %s"
|
|
||||||
% (self.rhui_debug_path, cds, rhui_debug_dst_path),
|
|
||||||
suggest_filename="rhui-debug")
|
|
||||||
diff --git a/sos/plugins/satellite.py b/sos/plugins/satellite.py
|
|
||||||
index 7f4aafd..474933a 100644
|
|
||||||
--- a/sos/plugins/satellite.py
|
|
||||||
+++ b/sos/plugins/satellite.py
|
|
||||||
@@ -78,7 +78,7 @@ class Satellite(Plugin, RedHatPlugin):
|
|
||||||
"/etc/tomcat6/", "/var/log/tomcat6/"])
|
|
||||||
if os.path.exists("spacewalk-debug"):
|
|
||||||
self.add_cmd_output("spacewalk-debug --dir %s"
|
|
||||||
- % os.path.join(self.get_cmd_path()))
|
|
||||||
+ % self.get_cmd_output_path(name="spacewalk-debug"))
|
|
||||||
|
|
||||||
if self.proxy:
|
|
||||||
self.add_copy_specs(["/etc/squid", "/var/log/squid"])
|
|
||||||
diff --git a/sos/plugins/yum.py b/sos/plugins/yum.py
|
|
||||||
index aa8cb18..c978842 100644
|
|
||||||
--- a/sos/plugins/yum.py
|
|
||||||
+++ b/sos/plugins/yum.py
|
|
||||||
@@ -49,7 +49,7 @@ class Yum(Plugin, RedHatPlugin):
|
|
||||||
self.add_cmd_output("subscription-manager list --installed")
|
|
||||||
self.add_cmd_output("subscription-manager list --consumed")
|
|
||||||
self.add_cmd_output("rhsm-debug system --no-archive --destination %s"
|
|
||||||
- % self.get_cmd_path())
|
|
||||||
+ % self.get_cmd_output_path())
|
|
||||||
|
|
||||||
if self.get_option("yumlist"):
|
|
||||||
# List various information about available packages
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
|||||||
From 15f46d44afa055edc169670303c81fb97dcfd0ae Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Wed, 12 Mar 2014 17:57:34 +0000
|
|
||||||
Subject: [PATCH 32/61] Fix broken binary detection in satellite plugin
|
|
||||||
|
|
||||||
The satellite plugin attempts to check for the existence of the
|
|
||||||
'satellite-debug' binary before running it. This was broken by
|
|
||||||
the mass conversion to PATH for running external commands.
|
|
||||||
|
|
||||||
Remove the check and just attempt to run the command regardless.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/satellite.py | 5 ++---
|
|
||||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/satellite.py b/sos/plugins/satellite.py
|
|
||||||
index 474933a..28c8bca 100644
|
|
||||||
--- a/sos/plugins/satellite.py
|
|
||||||
+++ b/sos/plugins/satellite.py
|
|
||||||
@@ -76,9 +76,8 @@ class Satellite(Plugin, RedHatPlugin):
|
|
||||||
if self.satellite:
|
|
||||||
self.add_copy_specs(["/etc/tnsnames.ora", "/etc/jabberd",
|
|
||||||
"/etc/tomcat6/", "/var/log/tomcat6/"])
|
|
||||||
- if os.path.exists("spacewalk-debug"):
|
|
||||||
- self.add_cmd_output("spacewalk-debug --dir %s"
|
|
||||||
- % self.get_cmd_output_path(name="spacewalk-debug"))
|
|
||||||
+ self.add_cmd_output("spacewalk-debug --dir %s"
|
|
||||||
+ % self.get_cmd_output_path(name="spacewalk-debug"))
|
|
||||||
|
|
||||||
if self.proxy:
|
|
||||||
self.add_copy_specs(["/etc/squid", "/var/log/squid"])
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
|||||||
From db8839351479c60234bb6873394d93b56f0174eb Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Wed, 12 Mar 2014 19:36:02 +0000
|
|
||||||
Subject: [PATCH 33/61] Rename validatePlugin to validate_plugin
|
|
||||||
|
|
||||||
This one somehow didn't get the memo about camelCase not being
|
|
||||||
cool any more in sos. Rename the method to comply with pep8 and
|
|
||||||
not be so ugly.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/policies/__init__.py | 2 +-
|
|
||||||
sos/sosreport.py | 2 +-
|
|
||||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py
|
|
||||||
index c272e5c..b91d0fd 100644
|
|
||||||
--- a/sos/policies/__init__.py
|
|
||||||
+++ b/sos/policies/__init__.py
|
|
||||||
@@ -198,7 +198,7 @@ No changes will be made to system configuration.
|
|
||||||
return tempfile.gettempdir()
|
|
||||||
return opt_tmp_dir
|
|
||||||
|
|
||||||
- def validatePlugin(self, plugin_class):
|
|
||||||
+ def validate_plugin(self, plugin_class):
|
|
||||||
"""
|
|
||||||
Verifies that the plugin_class should execute under this policy
|
|
||||||
"""
|
|
||||||
diff --git a/sos/sosreport.py b/sos/sosreport.py
|
|
||||||
index 0faa364..fe78abd 100644
|
|
||||||
--- a/sos/sosreport.py
|
|
||||||
+++ b/sos/sosreport.py
|
|
||||||
@@ -763,7 +763,7 @@ class SoSReport(object):
|
|
||||||
tuple(self.policy.valid_subclasses))
|
|
||||||
|
|
||||||
for plugin_class in plugin_classes:
|
|
||||||
- if not self.policy.validatePlugin(plugin_class):
|
|
||||||
+ if not self.policy.validate_plugin(plugin_class):
|
|
||||||
self.soslog.warning(_("plugin %s does not validate, skipping") % plug)
|
|
||||||
if self.opts.verbosity > 0:
|
|
||||||
self._skip(plugin_class, _("does not validate"))
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
|||||||
From 3eb24386719ee06c9e726550065c5427f1021c6f Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Thu, 13 Mar 2014 10:48:36 +0000
|
|
||||||
Subject: [PATCH 34/61] Update policy_tests.py for validate_plugin change
|
|
||||||
|
|
||||||
The policy_tests unit tests call validatePlugin(). Update them to
|
|
||||||
use the new name.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
tests/policy_tests.py | 8 ++++----
|
|
||||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/policy_tests.py b/tests/policy_tests.py
|
|
||||||
index aa74da7..764af83 100644
|
|
||||||
--- a/tests/policy_tests.py
|
|
||||||
+++ b/tests/policy_tests.py
|
|
||||||
@@ -21,25 +21,25 @@ class PolicyTests(unittest.TestCase):
|
|
||||||
p = FauxPolicy()
|
|
||||||
p.valid_subclasses = []
|
|
||||||
|
|
||||||
- self.assertTrue(p.validatePlugin(FauxPlugin))
|
|
||||||
+ self.assertTrue(p.validate_plugin(FauxPlugin))
|
|
||||||
|
|
||||||
def test_redhat(self):
|
|
||||||
p = FauxPolicy()
|
|
||||||
p.valid_subclasses = [RedHatPlugin]
|
|
||||||
|
|
||||||
- self.assertTrue(p.validatePlugin(FauxRedHatPlugin))
|
|
||||||
+ self.assertTrue(p.validate_plugin(FauxRedHatPlugin))
|
|
||||||
|
|
||||||
def test_debian(self):
|
|
||||||
p = FauxPolicy()
|
|
||||||
p.valid_subclasses = [DebianPlugin]
|
|
||||||
|
|
||||||
- self.assertTrue(p.validatePlugin(FauxDebianPlugin))
|
|
||||||
+ self.assertTrue(p.validate_plugin(FauxDebianPlugin))
|
|
||||||
|
|
||||||
def test_fails(self):
|
|
||||||
p = FauxPolicy()
|
|
||||||
p.valid_subclasses = []
|
|
||||||
|
|
||||||
- self.assertFalse(p.validatePlugin(FauxDebianPlugin))
|
|
||||||
+ self.assertFalse(p.validate_plugin(FauxDebianPlugin))
|
|
||||||
|
|
||||||
def test_can_import(self):
|
|
||||||
self.assertTrue(import_policy('redhat') is not None)
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,150 +0,0 @@
|
|||||||
From 4d1351efbd09220c36e889e222c40fe3ae68958a Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Wed, 12 Mar 2014 20:25:19 +0000
|
|
||||||
Subject: [PATCH 35/61] Match plugins against policies
|
|
||||||
|
|
||||||
Fixes Issue #238.
|
|
||||||
|
|
||||||
When tagging classes are used to enable plugins on multiple
|
|
||||||
platforms it is possible for there to be more than one valid class
|
|
||||||
instance for a given policy. For e.g.:
|
|
||||||
|
|
||||||
class DebianFooPlugin(Plugin, DebianPlugin):
|
|
||||||
///
|
|
||||||
class UbuntuFooPlugin(Plugin, UbuntuPlugin):
|
|
||||||
///
|
|
||||||
|
|
||||||
Since UbuntuPolicy includes both DebianPlugin and UbuntuPlugin in
|
|
||||||
its valid_subclasses list both classes pass the validity test and
|
|
||||||
both are added to the loaded_plugins list. This causes plugins
|
|
||||||
to run twice:
|
|
||||||
|
|
||||||
2014-03-12 19:57:50,974 DEBUG: copying file /var/log/mail.log to /var/log/mail.log
|
|
||||||
2014-03-12 19:57:50,975 DEBUG: added /var/log/mail.log to FileCacheArchive /tmp/sosreport-u1210-vm1-20140312195750
|
|
||||||
2014-03-12 19:57:51,293 DEBUG: copying file /var/log/mail.log to /var/log/mail.log
|
|
||||||
2014-03-12 19:57:51,294 DEBUG: added /var/log/mail.log to FileCacheArchive /tmp/sosreport-u1210-vm1-20140312195750
|
|
||||||
|
|
||||||
Fix this by adding a match_plugin() method to the policy base
|
|
||||||
class and prefer plugins that are subclasses of the first entry
|
|
||||||
in the list. This patch also reverses the order of the
|
|
||||||
valid_subclasses list for the UbuntuPolicy to ensure preference
|
|
||||||
is given to native plugins:
|
|
||||||
|
|
||||||
self.valid_subclasses = [UbuntuPlugin, DebianPlugin]
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/policies/__init__.py | 10 +++++++++
|
|
||||||
sos/policies/ubuntu.py | 2 +-
|
|
||||||
sos/sosreport.py | 53 +++++++++++++++++++++++++-----------------------
|
|
||||||
3 files changed, 39 insertions(+), 26 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py
|
|
||||||
index b91d0fd..08ce8b4 100644
|
|
||||||
--- a/sos/policies/__init__.py
|
|
||||||
+++ b/sos/policies/__init__.py
|
|
||||||
@@ -198,6 +198,16 @@ No changes will be made to system configuration.
|
|
||||||
return tempfile.gettempdir()
|
|
||||||
return opt_tmp_dir
|
|
||||||
|
|
||||||
+ def match_plugin(self, plugin_classes):
|
|
||||||
+ if len(plugin_classes) > 1:
|
|
||||||
+ for p in plugin_classes:
|
|
||||||
+ # Give preference to the first listed tagging class
|
|
||||||
+ # so that e.g. UbuntuPlugin is chosen over DebianPlugin
|
|
||||||
+ # on an Ubuntu installation.
|
|
||||||
+ if issubclass(p, self.valid_subclasses[0]):
|
|
||||||
+ return p
|
|
||||||
+ return plugin_classes[0]
|
|
||||||
+
|
|
||||||
def validate_plugin(self, plugin_class):
|
|
||||||
"""
|
|
||||||
Verifies that the plugin_class should execute under this policy
|
|
||||||
diff --git a/sos/policies/ubuntu.py b/sos/policies/ubuntu.py
|
|
||||||
index c9a8177..3039f43 100644
|
|
||||||
--- a/sos/policies/ubuntu.py
|
|
||||||
+++ b/sos/policies/ubuntu.py
|
|
||||||
@@ -12,7 +12,7 @@ class UbuntuPolicy(DebianPolicy):
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
super(UbuntuPolicy, self).__init__()
|
|
||||||
- self.valid_subclasses = [DebianPlugin, UbuntuPlugin]
|
|
||||||
+ self.valid_subclasses = [UbuntuPlugin, DebianPlugin]
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def check(self):
|
|
||||||
diff --git a/sos/sosreport.py b/sos/sosreport.py
|
|
||||||
index fe78abd..13a46bf 100644
|
|
||||||
--- a/sos/sosreport.py
|
|
||||||
+++ b/sos/sosreport.py
|
|
||||||
@@ -761,39 +761,42 @@ class SoSReport(object):
|
|
||||||
try:
|
|
||||||
plugin_classes = import_plugin(plugbase,
|
|
||||||
tuple(self.policy.valid_subclasses))
|
|
||||||
-
|
|
||||||
- for plugin_class in plugin_classes:
|
|
||||||
- if not self.policy.validate_plugin(plugin_class):
|
|
||||||
- self.soslog.warning(_("plugin %s does not validate, skipping") % plug)
|
|
||||||
- if self.opts.verbosity > 0:
|
|
||||||
- self._skip(plugin_class, _("does not validate"))
|
|
||||||
+ if not len(plugin_classes):
|
|
||||||
+ # no valid plugin classes for this policy
|
|
||||||
+ continue
|
|
||||||
+
|
|
||||||
+ plugin_class = self.policy.match_plugin(plugin_classes)
|
|
||||||
+ if not self.policy.validate_plugin(plugin_class):
|
|
||||||
+ self.soslog.warning(_("plugin %s does not validate, skipping") % plug)
|
|
||||||
+ if self.opts.verbosity > 0:
|
|
||||||
+ self._skip(plugin_class, _("does not validate"))
|
|
||||||
continue
|
|
||||||
|
|
||||||
- if plugin_class.requires_root and not self._is_root:
|
|
||||||
- self.soslog.info(_("plugin %s requires root permissions to execute, skipping") % plug)
|
|
||||||
- self._skip(plugin_class, _("requires root"))
|
|
||||||
- continue
|
|
||||||
+ if plugin_class.requires_root and not self._is_root:
|
|
||||||
+ self.soslog.info(_("plugin %s requires root permissions to execute, skipping") % plug)
|
|
||||||
+ self._skip(plugin_class, _("requires root"))
|
|
||||||
+ continue
|
|
||||||
|
|
||||||
- # plug-in is valid, let's decide whether run it or not
|
|
||||||
- self.plugin_names.append(plugbase)
|
|
||||||
+ # plug-in is valid, let's decide whether run it or not
|
|
||||||
+ self.plugin_names.append(plugbase)
|
|
||||||
|
|
||||||
- if self._is_skipped(plugbase):
|
|
||||||
- self._skip(plugin_class, _("skipped"))
|
|
||||||
- continue
|
|
||||||
+ if self._is_skipped(plugbase):
|
|
||||||
+ self._skip(plugin_class, _("skipped"))
|
|
||||||
+ continue
|
|
||||||
|
|
||||||
- if self._is_inactive(plugbase, plugin_class):
|
|
||||||
- self._skip(plugin_class, _("inactive"))
|
|
||||||
- continue
|
|
||||||
+ if self._is_inactive(plugbase, plugin_class):
|
|
||||||
+ self._skip(plugin_class, _("inactive"))
|
|
||||||
+ continue
|
|
||||||
|
|
||||||
- if self._is_not_default(plugbase, plugin_class):
|
|
||||||
- self._skip(plugin_class, _("not default"))
|
|
||||||
- continue
|
|
||||||
+ if self._is_not_default(plugbase, plugin_class):
|
|
||||||
+ self._skip(plugin_class, _("not default"))
|
|
||||||
+ continue
|
|
||||||
|
|
||||||
- if self._is_not_specified(plugbase):
|
|
||||||
- self._skip(plugin_class, _("not specified"))
|
|
||||||
- continue
|
|
||||||
+ if self._is_not_specified(plugbase):
|
|
||||||
+ self._skip(plugin_class, _("not specified"))
|
|
||||||
+ continue
|
|
||||||
|
|
||||||
- self._load(plugin_class)
|
|
||||||
+ self._load(plugin_class)
|
|
||||||
except Exception as e:
|
|
||||||
self.soslog.warning(_("plugin %s does not install, skipping: %s") % (plug, e))
|
|
||||||
if self.raise_plugins:
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
|||||||
From 3ff674035d8962bf3ca3320900fccc6619af7a3d Mon Sep 17 00:00:00 2001
|
|
||||||
From: Adam Stokes <adam.stokes@ubuntu.com>
|
|
||||||
Date: Fri, 14 Mar 2014 15:03:29 -0400
|
|
||||||
Subject: [PATCH 36/61] Do not collect isos in cobbler plugin
|
|
||||||
|
|
||||||
In Ubuntu isos are being added to the tarball, do not do that.
|
|
||||||
|
|
||||||
Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
|
|
||||||
---
|
|
||||||
sos/plugins/cobbler.py | 1 +
|
|
||||||
1 file changed, 1 insertion(+)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/cobbler.py b/sos/plugins/cobbler.py
|
|
||||||
index e3d289e..b754813 100644
|
|
||||||
--- a/sos/plugins/cobbler.py
|
|
||||||
+++ b/sos/plugins/cobbler.py
|
|
||||||
@@ -39,3 +39,4 @@ class DebianCobbler(Cobbler, DebianPlugin, UbuntuPlugin):
|
|
||||||
self.add_copy_spec("/etc/cobbler")
|
|
||||||
self.add_copy_spec("/var/log/cobbler")
|
|
||||||
self.add_copy_spec("/var/lib/cobbler")
|
|
||||||
+ self.add_forbidden_path("/var/lib/cobbler/isos")
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
From f617db3b8232c5864726c60b11a91162409d867f Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Thu, 20 Mar 2014 18:56:58 +0000
|
|
||||||
Subject: [PATCH 37/61] Call rhsm-debug with the --sos switch
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/yum.py | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/yum.py b/sos/plugins/yum.py
|
|
||||||
index c978842..b05c0fe 100644
|
|
||||||
--- a/sos/plugins/yum.py
|
|
||||||
+++ b/sos/plugins/yum.py
|
|
||||||
@@ -48,7 +48,7 @@ class Yum(Plugin, RedHatPlugin):
|
|
||||||
"/var/log/rhsm/rhsmcertd.log"])
|
|
||||||
self.add_cmd_output("subscription-manager list --installed")
|
|
||||||
self.add_cmd_output("subscription-manager list --consumed")
|
|
||||||
- self.add_cmd_output("rhsm-debug system --no-archive --destination %s"
|
|
||||||
+ self.add_cmd_output("rhsm-debug system --sos --no-archive --destination %s"
|
|
||||||
% self.get_cmd_output_path())
|
|
||||||
|
|
||||||
if self.get_option("yumlist"):
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
From eb2b77cc38130882db71b73a5a026a454d261684 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Tue, 25 Mar 2014 17:26:11 +0000
|
|
||||||
Subject: [PATCH 38/61] Fix plugin_test exception on six.PY2
|
|
||||||
|
|
||||||
Replace explicit test for six.PY2 with try/exception handling of
|
|
||||||
StringIO import.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
tests/plugin_tests.py | 4 ++--
|
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py
|
|
||||||
index c4b540f..31ffae4 100644
|
|
||||||
--- a/tests/plugin_tests.py
|
|
||||||
+++ b/tests/plugin_tests.py
|
|
||||||
@@ -4,9 +4,9 @@ import tempfile
|
|
||||||
|
|
||||||
# PYCOMPAT
|
|
||||||
import six
|
|
||||||
-if six.PY2:
|
|
||||||
+try:
|
|
||||||
from StringIO import StringIO
|
|
||||||
-else:
|
|
||||||
+except:
|
|
||||||
from io import StringIO
|
|
||||||
|
|
||||||
from sos.plugins import Plugin, regex_findall, sos_relative_path, mangle_command
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,244 +0,0 @@
|
|||||||
From 4553f0942c00b47342deea7fc47bb9822484a65e Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Tue, 25 Mar 2014 17:28:31 +0000
|
|
||||||
Subject: [PATCH 39/61] Remove --profile support
|
|
||||||
|
|
||||||
The handrolled profile logging support in sos hasn't been widely
|
|
||||||
used in a long time and is a problem better solved with external
|
|
||||||
profiling and coverage tools.
|
|
||||||
|
|
||||||
Rip out all the support and documentation. This shortens and
|
|
||||||
simplifies numerous Plugin class methods.
|
|
||||||
|
|
||||||
Fixes Issue #244.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
man/en/sosreport.1 | 5 +----
|
|
||||||
sos/plugins/__init__.py | 30 ------------------------------
|
|
||||||
sos/sosreport.py | 35 +----------------------------------
|
|
||||||
tests/plugin_tests.py | 4 +---
|
|
||||||
4 files changed, 3 insertions(+), 71 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/man/en/sosreport.1 b/man/en/sosreport.1
|
|
||||||
index c800576..e189433 100644
|
|
||||||
--- a/man/en/sosreport.1
|
|
||||||
+++ b/man/en/sosreport.1
|
|
||||||
@@ -11,7 +11,7 @@ sosreport \- Collect and package diagnostic and support data
|
|
||||||
[--report] [--config-file conf] [--batch]\fR
|
|
||||||
[--build] [--name name] [--ticket-number number]
|
|
||||||
[--debug] [--tmp-dir directory]\fR
|
|
||||||
- [--profile] [--help]\fR
|
|
||||||
+ [--help]\fR
|
|
||||||
.SH DESCRIPTION
|
|
||||||
\fBsosreport\fR generates a compressed tar archive of diagnostic
|
|
||||||
information from the running system. The archive may be stored
|
|
||||||
@@ -84,9 +84,6 @@ archive as a temporary file or directory tree.
|
|
||||||
Enable interactive debugging using the python debugger. Exceptions in
|
|
||||||
sos or plug-in code will cause a trap to the pdb shell.
|
|
||||||
.TP
|
|
||||||
-.B \--profile
|
|
||||||
-Enable profiler logging.
|
|
||||||
-.TP
|
|
||||||
.B \--help
|
|
||||||
Display usage message.
|
|
||||||
.SH MAINTAINER
|
|
||||||
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
|
|
||||||
index efb6950..cf2a710 100644
|
|
||||||
--- a/sos/plugins/__init__.py
|
|
||||||
+++ b/sos/plugins/__init__.py
|
|
||||||
@@ -137,7 +137,6 @@ class Plugin(object):
|
|
||||||
self.collect_cmds = []
|
|
||||||
|
|
||||||
self.soslog = self.commons['soslog'] if 'soslog' in self.commons else logging.getLogger('sos')
|
|
||||||
- self.proflog = self.commons['proflog'] if 'proflog' in self.commons else logging.getLogger('sosprofile')
|
|
||||||
|
|
||||||
# get the option list into a dictionary
|
|
||||||
for opt in self.option_list:
|
|
||||||
@@ -171,9 +170,6 @@ class Plugin(object):
|
|
||||||
|
|
||||||
This function returns the number of replacements made.
|
|
||||||
'''
|
|
||||||
- if self.commons['cmdlineopts'].profiler:
|
|
||||||
- start_time = time()
|
|
||||||
-
|
|
||||||
globstr = '*' + cmd + '*'
|
|
||||||
self.soslog.debug("substituting '%s' for '%s' in commands matching %s"
|
|
||||||
% (subst, regexp, globstr))
|
|
||||||
@@ -200,11 +196,6 @@ class Plugin(object):
|
|
||||||
msg = 'regex substitution failed for %s in plugin %s with: "%s"'
|
|
||||||
self.soslog.error(msg % (called['exe'], self.name(), e))
|
|
||||||
replacements = None
|
|
||||||
-
|
|
||||||
- if self.commons['cmdlineopts'].profiler:
|
|
||||||
- time_passed = time() - start_time
|
|
||||||
- self.proflog.debug("subst: %-75s time: %f"
|
|
||||||
- % (globstr, time_passed))
|
|
||||||
return replacements
|
|
||||||
|
|
||||||
def do_file_sub(self, srcpath, regexp, subst):
|
|
||||||
@@ -215,9 +206,6 @@ class Plugin(object):
|
|
||||||
|
|
||||||
This function returns the number of replacements made.
|
|
||||||
'''
|
|
||||||
- if self.commons['cmdlineopts'].profiler:
|
|
||||||
- start_time = time()
|
|
||||||
-
|
|
||||||
try:
|
|
||||||
path = self._get_dest_for_srcpath(srcpath)
|
|
||||||
self.soslog.debug("substituting '%s' for '%s' in %s"
|
|
||||||
@@ -234,10 +222,6 @@ class Plugin(object):
|
|
||||||
msg = 'regex substitution failed for %s in plugin %s with: "%s"'
|
|
||||||
self.soslog.error(msg % (path, self.name(), e))
|
|
||||||
replacements = 0
|
|
||||||
- if self.commons['cmdlineopts'].profiler:
|
|
||||||
- time_passed = time() - start_time
|
|
||||||
- self.proflog.debug("subst : %-75s time: %f"
|
|
||||||
- % (srcpath, time_passed))
|
|
||||||
return replacements
|
|
||||||
|
|
||||||
def do_regex_find_all(self, regex, fname):
|
|
||||||
@@ -314,10 +298,6 @@ class Plugin(object):
|
|
||||||
/etc/my_file.conf the file would end up at
|
|
||||||
/configurations/my_file.conf.
|
|
||||||
'''
|
|
||||||
-
|
|
||||||
- if self.commons['cmdlineopts'].profiler:
|
|
||||||
- start_time = time()
|
|
||||||
-
|
|
||||||
if self._path_in_path_list(srcpath, self.forbidden_paths):
|
|
||||||
self.soslog.debug("%s is in the forbidden path list" % srcpath)
|
|
||||||
return ''
|
|
||||||
@@ -358,9 +338,6 @@ class Plugin(object):
|
|
||||||
'dstpath':dest,
|
|
||||||
'symlink':"no"})
|
|
||||||
|
|
||||||
- if self.commons['cmdlineopts'].profiler:
|
|
||||||
- time_passed = time() - start_time
|
|
||||||
- self.proflog.debug("copied: %-75s time: %f" % (srcpath, time_passed))
|
|
||||||
except Exception as e:
|
|
||||||
self.soslog.error("Unable to copy %s to %s" % (srcpath, dest))
|
|
||||||
self.soslog.error(traceback.format_exc())
|
|
||||||
@@ -560,9 +537,6 @@ class Plugin(object):
|
|
||||||
"""Execute a command and save the output to a file for inclusion in the
|
|
||||||
report.
|
|
||||||
"""
|
|
||||||
- if self.commons['cmdlineopts'].profiler:
|
|
||||||
- start_time = time()
|
|
||||||
-
|
|
||||||
# pylint: disable-msg = W0612
|
|
||||||
status, shout, runtime = self.get_command_output(exe, timeout=timeout)
|
|
||||||
if (status == 127):
|
|
||||||
@@ -582,10 +556,6 @@ class Plugin(object):
|
|
||||||
self.executed_commands.append({'exe': exe, 'file':outfn_strip}) # save in our list
|
|
||||||
self.commons['xmlreport'].add_command(cmdline=exe,exitcode=status,f_stdout=outfn_strip,runtime=runtime)
|
|
||||||
|
|
||||||
- if self.commons['cmdlineopts'].profiler:
|
|
||||||
- time_passed = time() - start_time
|
|
||||||
- self.proflog.debug("output: %-75s time: %f" % (exe, time_passed))
|
|
||||||
-
|
|
||||||
return os.path.join(self.archive.get_archive_path(), outfn)
|
|
||||||
|
|
||||||
# For adding output
|
|
||||||
diff --git a/sos/sosreport.py b/sos/sosreport.py
|
|
||||||
index 13a46bf..afa5371 100644
|
|
||||||
--- a/sos/sosreport.py
|
|
||||||
+++ b/sos/sosreport.py
|
|
||||||
@@ -220,7 +220,6 @@ class SoSOptions(object):
|
|
||||||
_config_file = ""
|
|
||||||
_tmp_dir = ""
|
|
||||||
_report = True
|
|
||||||
- _profiler = False
|
|
||||||
_compression_type = 'auto'
|
|
||||||
|
|
||||||
_options = None
|
|
||||||
@@ -431,19 +430,6 @@ class SoSOptions(object):
|
|
||||||
self._report = value
|
|
||||||
|
|
||||||
@property
|
|
||||||
- def profiler(self):
|
|
||||||
- if self._options != None:
|
|
||||||
- return self._options.profiler
|
|
||||||
- return self._profiler
|
|
||||||
-
|
|
||||||
- @profiler.setter
|
|
||||||
- def profiler(self, value):
|
|
||||||
- self._check_options_initialized()
|
|
||||||
- if not isinstance(value, bool):
|
|
||||||
- raise TypeError("SoSOptions.profiler expects a boolean")
|
|
||||||
- self._profiler = value
|
|
||||||
-
|
|
||||||
- @property
|
|
||||||
def compression_type(self):
|
|
||||||
if self._options != None:
|
|
||||||
return self._options.compression_type
|
|
||||||
@@ -508,9 +494,6 @@ class SoSOptions(object):
|
|
||||||
parser.add_option("--no-report", action="store_true",
|
|
||||||
dest="report",
|
|
||||||
help="Disable HTML/XML reporting", default=False)
|
|
||||||
- parser.add_option("--profile", action="store_true",
|
|
||||||
- dest="profiler",
|
|
||||||
- help="turn on profiling", default=False)
|
|
||||||
parser.add_option("-z", "--compression-type", dest="compression_type",
|
|
||||||
help="compression technology to use [auto, zip, gzip, bzip2, xz] (default=auto)",
|
|
||||||
default="auto")
|
|
||||||
@@ -563,7 +546,6 @@ class SoSReport(object):
|
|
||||||
'rptdir': self.rptdir,
|
|
||||||
'tmpdir': self.tmpdir,
|
|
||||||
'soslog': self.soslog,
|
|
||||||
- 'proflog' : self.proflog,
|
|
||||||
'policy': self.policy,
|
|
||||||
'verbosity': self.opts.verbosity,
|
|
||||||
'xmlreport': self.xml_report,
|
|
||||||
@@ -680,32 +662,17 @@ class SoSReport(object):
|
|
||||||
ui_console.setLevel(logging.INFO)
|
|
||||||
self.ui_log.addHandler(ui_console)
|
|
||||||
|
|
||||||
- # profile logging
|
|
||||||
- if self.opts.profiler:
|
|
||||||
- self.proflog = logging.getLogger('sosprofile')
|
|
||||||
- self.proflog.setLevel(logging.DEBUG)
|
|
||||||
- self.sos_profile_log_file = self.get_temp_file()
|
|
||||||
- plog = logging.FileHandler(self.sos_profile_log_file.name)
|
|
||||||
- plog.setFormatter(logging.Formatter('%(message)s'))
|
|
||||||
- plog.setLevel(logging.DEBUG)
|
|
||||||
- self.proflog.addHandler(plog)
|
|
||||||
- else:
|
|
||||||
- self.proflog = logging.getLogger('sosprofile')
|
|
||||||
- self.proflog.setLevel(logging.FATAL)
|
|
||||||
-
|
|
||||||
def _finish_logging(self):
|
|
||||||
logging.shutdown()
|
|
||||||
|
|
||||||
# the logging module seems to persist in the jython/jboss/eap world
|
|
||||||
# so the handlers need to be removed
|
|
||||||
- for logger in [logging.getLogger(x) for x in ('sos', 'sosprofile', 'sos_ui')]:
|
|
||||||
+ for logger in [logging.getLogger(x) for x in ('sos', 'sos_ui')]:
|
|
||||||
for h in logger.handlers:
|
|
||||||
logger.removeHandler(h)
|
|
||||||
|
|
||||||
if getattr(self, "sos_log_file", None):
|
|
||||||
self.archive.add_file(self.sos_log_file.name, dest=os.path.join('sos_logs', 'sos.log'))
|
|
||||||
- if getattr(self, "sos_profile_log_file", None):
|
|
||||||
- self.archive.add_file(self.sos_profile_log_file.name, dest=os.path.join('sos_logs', 'profile.log'))
|
|
||||||
if getattr(self, "sos_ui_log_file", None):
|
|
||||||
self.archive.add_file(self.sos_ui_log_file.name, dest=os.path.join('sos_logs', 'ui.log'))
|
|
||||||
|
|
||||||
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py
|
|
||||||
index 31ffae4..0f8ef5d 100644
|
|
||||||
--- a/tests/plugin_tests.py
|
|
||||||
+++ b/tests/plugin_tests.py
|
|
||||||
@@ -89,9 +89,7 @@ class EnablerPlugin(Plugin):
|
|
||||||
|
|
||||||
|
|
||||||
class MockOptions(object):
|
|
||||||
-
|
|
||||||
- profiler = False
|
|
||||||
-
|
|
||||||
+ pass
|
|
||||||
|
|
||||||
|
|
||||||
class PluginToolTests(unittest.TestCase):
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,78 +0,0 @@
|
|||||||
From e708041c050245bf05a7205e6661f8402e8e6a66 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Wed, 26 Mar 2014 12:22:29 +0000
|
|
||||||
Subject: [PATCH 40/61] Dead code removal: sos_relative_path()
|
|
||||||
|
|
||||||
The function is defined and even has test cases. But no callers..
|
|
||||||
Remove the function and the test cases that exercise it.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/__init__.py | 15 ---------------
|
|
||||||
tests/plugin_tests.py | 17 +----------------
|
|
||||||
2 files changed, 1 insertion(+), 31 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
|
|
||||||
index cf2a710..d420cd0 100644
|
|
||||||
--- a/sos/plugins/__init__.py
|
|
||||||
+++ b/sos/plugins/__init__.py
|
|
||||||
@@ -58,21 +58,6 @@ def common_prefix(l1, l2, common = None):
|
|
||||||
return (common, [l1, l2])
|
|
||||||
return common_prefix(l1[1:], l2[1:], common+[l1[0]])
|
|
||||||
|
|
||||||
-def sos_relative_path(path1, path2, sep=os.path.sep, pardir=os.path.pardir):
|
|
||||||
- '''Return a relative path from path1 equivalent to path path2. In
|
|
||||||
- particular: the empty string, if path1 == path2; path2, if path1 and path2
|
|
||||||
- have no common prefix.
|
|
||||||
- '''
|
|
||||||
- try:
|
|
||||||
- common, (u1, u2) = common_prefix(path1.split(sep), path2.split(sep))
|
|
||||||
- except AttributeError:
|
|
||||||
- return path2
|
|
||||||
-
|
|
||||||
- if not common:
|
|
||||||
- return path2 # leave path absolute if nothing at all in common
|
|
||||||
- return sep.join( [pardir]*len(u1) + u2 )
|
|
||||||
-
|
|
||||||
-
|
|
||||||
def regex_findall(regex, fname):
|
|
||||||
'''Return a list of all non overlapping matches in the string(s)'''
|
|
||||||
try:
|
|
||||||
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py
|
|
||||||
index 0f8ef5d..5eb1304 100644
|
|
||||||
--- a/tests/plugin_tests.py
|
|
||||||
+++ b/tests/plugin_tests.py
|
|
||||||
@@ -9,7 +9,7 @@ try:
|
|
||||||
except:
|
|
||||||
from io import StringIO
|
|
||||||
|
|
||||||
-from sos.plugins import Plugin, regex_findall, sos_relative_path, mangle_command
|
|
||||||
+from sos.plugins import Plugin, regex_findall, mangle_command
|
|
||||||
from sos.archive import TarFileArchive, ZipFileArchive
|
|
||||||
import sos.policies
|
|
||||||
|
|
||||||
@@ -114,21 +114,6 @@ class PluginToolTests(unittest.TestCase):
|
|
||||||
matches = regex_findall(r".*", 1)
|
|
||||||
self.assertEquals(matches, [])
|
|
||||||
|
|
||||||
- def test_rel_path(self):
|
|
||||||
- path1 = "/usr/lib/foo"
|
|
||||||
- path2 = "/usr/lib/boo"
|
|
||||||
- self.assertEquals(sos_relative_path(path1, path2), "../boo")
|
|
||||||
-
|
|
||||||
- def test_abs_path(self):
|
|
||||||
- path1 = "usr/lib/foo"
|
|
||||||
- path2 = "foo/lib/boo"
|
|
||||||
- self.assertEquals(sos_relative_path(path1, path2), "foo/lib/boo")
|
|
||||||
-
|
|
||||||
- def test_bad_path(self):
|
|
||||||
- path1 = None
|
|
||||||
- path2 = "foo/lib/boo"
|
|
||||||
- self.assertEquals(sos_relative_path(path1, path2), "foo/lib/boo")
|
|
||||||
-
|
|
||||||
def test_mangle_command(self):
|
|
||||||
self.assertEquals("foo", mangle_command("/usr/bin/foo"))
|
|
||||||
self.assertEquals("foo_-x", mangle_command("/usr/bin/foo -x"))
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,146 +0,0 @@
|
|||||||
From 6b3b56ee17e14a0f0de8a16a6a52b3708d01146b Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Wed, 26 Mar 2014 12:24:33 +0000
|
|
||||||
Subject: [PATCH 41/61] Dead code removal: DirTree
|
|
||||||
|
|
||||||
The DirTree class has remained unused since it was implemented.
|
|
||||||
Remove the definition and associated test cases.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/utilities.py | 89 ------------------------------------------------
|
|
||||||
tests/utilities_tests.py | 11 +-----
|
|
||||||
2 files changed, 1 insertion(+), 99 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/utilities.py b/sos/utilities.py
|
|
||||||
index a9aca74..8602a52 100644
|
|
||||||
--- a/sos/utilities.py
|
|
||||||
+++ b/sos/utilities.py
|
|
||||||
@@ -185,95 +185,6 @@ def shell_out(cmd):
|
|
||||||
Does not handle exceptions."""
|
|
||||||
return sos_get_command_output(cmd)[1]
|
|
||||||
|
|
||||||
-class DirTree(object):
|
|
||||||
- """Builds an ascii representation of a directory structure"""
|
|
||||||
-
|
|
||||||
- def __init__(self, top_directory):
|
|
||||||
- self.directory_count = 0
|
|
||||||
- self.file_count = 0
|
|
||||||
- self.buffer = []
|
|
||||||
- self.top_directory = top_directory
|
|
||||||
- self._build_tree()
|
|
||||||
-
|
|
||||||
- def buf(self, s):
|
|
||||||
- self.buffer.append(s)
|
|
||||||
-
|
|
||||||
- def printtree(self):
|
|
||||||
- print (six.u(self))
|
|
||||||
-
|
|
||||||
- def as_string(self):
|
|
||||||
- return self.__str__()
|
|
||||||
-
|
|
||||||
- def __str__(self):
|
|
||||||
- return "\n".join(self.buffer)
|
|
||||||
-
|
|
||||||
- def _build_tree(self):
|
|
||||||
- self.buf(os.path.abspath(self.top_directory))
|
|
||||||
- self.tree_i(self.top_directory, first=True)
|
|
||||||
-
|
|
||||||
- def _get_user(self, stats):
|
|
||||||
- try:
|
|
||||||
- import pwd
|
|
||||||
- return pwd.getpwuid(stats.st_uid)[0]
|
|
||||||
- except:
|
|
||||||
- return six.u(stats.st_uid)
|
|
||||||
-
|
|
||||||
- def _get_group(self, stats):
|
|
||||||
- try:
|
|
||||||
- import grp
|
|
||||||
- return grp.getgrgid(stats.st_gid)[0]
|
|
||||||
- except:
|
|
||||||
- return six.u(stats.st_uid)
|
|
||||||
-
|
|
||||||
- def _format(self, path):
|
|
||||||
- """Conditionally adds detail to paths"""
|
|
||||||
- stats = os.stat(path)
|
|
||||||
- details = {
|
|
||||||
- "filename": os.path.basename(path),
|
|
||||||
- "user": self._get_user(stats),
|
|
||||||
- "group": self._get_group(stats),
|
|
||||||
- "filesize": convert_bytes(stats.st_size),
|
|
||||||
- }
|
|
||||||
- return ("[%(user)s %(group)s %(filesize)s] " % details, "%(filename)s" % details)
|
|
||||||
-
|
|
||||||
- def tree_i(self, dir_, padding='', first=False, fmt="%-30s %s%s%s"):
|
|
||||||
- if not first:
|
|
||||||
- details, filename = self._format(os.path.abspath(dir_))
|
|
||||||
- line = fmt % (details, padding[:-1], "+-- ", filename)
|
|
||||||
- self.buf(line)
|
|
||||||
- padding += ' '
|
|
||||||
-
|
|
||||||
- count = 0
|
|
||||||
- files = os.listdir(dir_)
|
|
||||||
- files.sort(key=str.lower)
|
|
||||||
- for f in files:
|
|
||||||
- count += 1
|
|
||||||
- path = os.path.join(dir_, f)
|
|
||||||
-
|
|
||||||
- if f.startswith("."):
|
|
||||||
- pass
|
|
||||||
- elif os.path.isfile(path):
|
|
||||||
- self.file_count += 1
|
|
||||||
- details, filename = self._format(path)
|
|
||||||
- line = fmt % (details, padding, "+-- ", filename)
|
|
||||||
- self.buf(line)
|
|
||||||
- elif os.path.islink(path):
|
|
||||||
- self.buf(padding +
|
|
||||||
- '+-- ' +
|
|
||||||
- f +
|
|
||||||
- ' -> ' + os.path.basename(os.path.realpath(path)))
|
|
||||||
- if os.path.isdir(path):
|
|
||||||
- self.directory_count += 1
|
|
||||||
- else:
|
|
||||||
- self.file_count += 1
|
|
||||||
- elif os.path.isdir(path):
|
|
||||||
- self.directory_count += 1
|
|
||||||
- if count == len(files):
|
|
||||||
- self.tree_i(path, padding + ' ')
|
|
||||||
- else:
|
|
||||||
- self.tree_i(path, padding + '|')
|
|
||||||
-
|
|
||||||
-
|
|
||||||
class ImporterHelper(object):
|
|
||||||
"""Provides a list of modules that can be imported in a package.
|
|
||||||
Importable modules are located along the module __path__ list and modules
|
|
||||||
diff --git a/tests/utilities_tests.py b/tests/utilities_tests.py
|
|
||||||
index 04c5241..da0987f 100644
|
|
||||||
--- a/tests/utilities_tests.py
|
|
||||||
+++ b/tests/utilities_tests.py
|
|
||||||
@@ -5,7 +5,7 @@ import unittest
|
|
||||||
import six
|
|
||||||
from six import StringIO
|
|
||||||
|
|
||||||
-from sos.utilities import grep, DirTree, checksum, get_hash_name, is_executable, sos_get_command_output, find, tail, shell_out
|
|
||||||
+from sos.utilities import grep, checksum, get_hash_name, is_executable, sos_get_command_output, find, tail, shell_out
|
|
||||||
import sos
|
|
||||||
|
|
||||||
TEST_DIR = os.path.dirname(__file__)
|
|
||||||
@@ -43,15 +43,6 @@ class TailTest(unittest.TestCase):
|
|
||||||
self.assertEquals(t, six.b(expected))
|
|
||||||
|
|
||||||
|
|
||||||
-class DirTreeTest(unittest.TestCase):
|
|
||||||
-
|
|
||||||
- def test_makes_tree(self):
|
|
||||||
- # I'll admit, this a pretty lame test, but it will at least sniff out
|
|
||||||
- # some syntax issues
|
|
||||||
- t = DirTree(os.path.dirname(sos.__file__)).as_string()
|
|
||||||
- self.assertTrue('sos' in t)
|
|
||||||
-
|
|
||||||
-
|
|
||||||
class ChecksumTest(unittest.TestCase):
|
|
||||||
|
|
||||||
def test_simple_hash(self):
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
|||||||
From 9c88a8ff071c9a74e3b412bd4f4ef19cd9248611 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Wed, 26 Mar 2014 12:40:17 +0000
|
|
||||||
Subject: [PATCH 42/61] Dead code removal: utilities.checksum()
|
|
||||||
|
|
||||||
Has test case but no callers. Delete it.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/utilities.py | 15 ---------------
|
|
||||||
tests/utilities_tests.py | 12 ------------
|
|
||||||
2 files changed, 27 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/utilities.py b/sos/utilities.py
|
|
||||||
index 8602a52..1a56f9f 100644
|
|
||||||
--- a/sos/utilities.py
|
|
||||||
+++ b/sos/utilities.py
|
|
||||||
@@ -63,19 +63,6 @@ def fileobj(path_or_file, mode='r'):
|
|
||||||
else:
|
|
||||||
return closing(path_or_file)
|
|
||||||
|
|
||||||
-def checksum(file_, chunk_size=128, algorithm=None):
|
|
||||||
- """Returns the checksum of the supplied filename. The file is read in
|
|
||||||
- chunk_size blocks"""
|
|
||||||
- if not algorithm:
|
|
||||||
- algorithm = get_hash_name()
|
|
||||||
- digest = hashlib.new(algorithm)
|
|
||||||
- with fileobj(file_, 'rb') as fd:
|
|
||||||
- data = fd.read(chunk_size)
|
|
||||||
- while data:
|
|
||||||
- digest.update(six.b(data))
|
|
||||||
- data = fd.read(chunk_size)
|
|
||||||
- return digest.hexdigest()
|
|
||||||
-
|
|
||||||
def get_hash_name():
|
|
||||||
"""Returns the algorithm used when computing a hash"""
|
|
||||||
import sos.policies
|
|
||||||
@@ -101,8 +88,6 @@ def convert_bytes(bytes_, K=1 << 10, M=1 << 20, G=1 << 30, T=1 << 40):
|
|
||||||
else:
|
|
||||||
return '%d' % bytes_
|
|
||||||
|
|
||||||
-
|
|
||||||
-
|
|
||||||
def find(file_pattern, top_dir, max_depth=None, path_pattern=None):
|
|
||||||
"""generator function to find files recursively. Usage:
|
|
||||||
|
|
||||||
diff --git a/tests/utilities_tests.py b/tests/utilities_tests.py
|
|
||||||
index da0987f..395fde1 100644
|
|
||||||
--- a/tests/utilities_tests.py
|
|
||||||
+++ b/tests/utilities_tests.py
|
|
||||||
@@ -43,18 +43,6 @@ class TailTest(unittest.TestCase):
|
|
||||||
self.assertEquals(t, six.b(expected))
|
|
||||||
|
|
||||||
|
|
||||||
-class ChecksumTest(unittest.TestCase):
|
|
||||||
-
|
|
||||||
- def test_simple_hash(self):
|
|
||||||
- self.assertEquals(checksum(StringIO('this is a test'), algorithm="sha256"),
|
|
||||||
- '2e99758548972a8e8822ad47fa1017ff72f06f3ff6a016851f45c398732bc50c')
|
|
||||||
-
|
|
||||||
- def test_hash_loading(self):
|
|
||||||
- # not the greatest test, since we are asking the policy to pick for us
|
|
||||||
- name = get_hash_name()
|
|
||||||
- self.assertTrue(name in ('md5', 'sha256'))
|
|
||||||
-
|
|
||||||
-
|
|
||||||
class ExecutableTest(unittest.TestCase):
|
|
||||||
|
|
||||||
def test_nonexe_file(self):
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -1,39 +0,0 @@
|
|||||||
From e39258bacc722ea9e7446c93b6443b8e1923e3a4 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Wed, 26 Mar 2014 17:38:26 +0000
|
|
||||||
Subject: [PATCH 44/61] Dead code removal: sos.plugins.common_prefix()
|
|
||||||
|
|
||||||
Unused. Delete.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/__init__.py | 13 -------------
|
|
||||||
1 file changed, 13 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
|
|
||||||
index 9ee0b61..4de8c0d 100644
|
|
||||||
--- a/sos/plugins/__init__.py
|
|
||||||
+++ b/sos/plugins/__init__.py
|
|
||||||
@@ -45,19 +45,6 @@ try:
|
|
||||||
except ImportError:
|
|
||||||
import simplejson as json
|
|
||||||
|
|
||||||
-def common_prefix(l1, l2, common = None):
|
|
||||||
- """Returns a tuple like the following:
|
|
||||||
- ([common, elements, from l1, and l2], [[tails, from, l1], [tails, from, l2]])
|
|
||||||
-
|
|
||||||
- >>> common_prefix(['usr','share','foo'], ['usr','share','bar'])
|
|
||||||
- (['usr','share'], [['foo'], ['bar']])
|
|
||||||
- """
|
|
||||||
- if common is None:
|
|
||||||
- common = []
|
|
||||||
- if len(l1) < 1 or len(l2) < 1 or l1[0] != l2[0]:
|
|
||||||
- return (common, [l1, l2])
|
|
||||||
- return common_prefix(l1[1:], l2[1:], common+[l1[0]])
|
|
||||||
-
|
|
||||||
def regex_findall(regex, fname):
|
|
||||||
'''Return a list of all non overlapping matches in the string(s)'''
|
|
||||||
try:
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
From 6182367ec0672721d1381e40aaa97c3d2f504a95 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Wed, 26 Mar 2014 17:39:43 +0000
|
|
||||||
Subject: [PATCH 45/61] Dead code removal: PluginException
|
|
||||||
|
|
||||||
Defined but never used. Delete.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/__init__.py | 5 -----
|
|
||||||
1 file changed, 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
|
|
||||||
index 4de8c0d..0c4b9b4 100644
|
|
||||||
--- a/sos/plugins/__init__.py
|
|
||||||
+++ b/sos/plugins/__init__.py
|
|
||||||
@@ -60,11 +60,6 @@ def mangle_command(command):
|
|
||||||
mangledname = re.sub(r"/", ".", mangledname).strip(" ._-")[0:64]
|
|
||||||
return mangledname
|
|
||||||
|
|
||||||
-
|
|
||||||
-class PluginException(Exception):
|
|
||||||
- pass
|
|
||||||
-
|
|
||||||
-
|
|
||||||
class Plugin(object):
|
|
||||||
""" This is the base class for sosreport plugins. Plugins should subclass
|
|
||||||
this and set the class variables where applicable.
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
From 3f742644ebbf27b7b024a2f7061c347196312308 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Thu, 27 Mar 2014 11:39:30 +0000
|
|
||||||
Subject: [PATCH 46/61] Convert infiniband to package list
|
|
||||||
|
|
||||||
Remove infiniband's open-coded check_enabled() and use a package
|
|
||||||
list to control plugin activation.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/infiniband.py | 6 +-----
|
|
||||||
1 file changed, 1 insertion(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/infiniband.py b/sos/plugins/infiniband.py
|
|
||||||
index 2c890a5..d3ec982 100644
|
|
||||||
--- a/sos/plugins/infiniband.py
|
|
||||||
+++ b/sos/plugins/infiniband.py
|
|
||||||
@@ -21,11 +21,7 @@ class Infiniband(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
|
|
||||||
"""
|
|
||||||
|
|
||||||
plugin_name = 'infiniband'
|
|
||||||
-
|
|
||||||
- def check_enabled(self):
|
|
||||||
- if self.commons["policy"].pkg_by_name("libibverbs-utils"):
|
|
||||||
- return True
|
|
||||||
- return False
|
|
||||||
+ packages = ('libibverbs-utils',)
|
|
||||||
|
|
||||||
def setup(self):
|
|
||||||
self.add_copy_specs([
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
From 1bd31b763a11f15c89b1e2ae16788867ff62a84e Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Thu, 27 Mar 2014 11:40:40 +0000
|
|
||||||
Subject: [PATCH 47/61] Replace self.policy().pkg_by_name() us in Logs plugin
|
|
||||||
|
|
||||||
Use self.is_installed() for simple package presence tests.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/logs.py | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/logs.py b/sos/plugins/logs.py
|
|
||||||
index 1cd767c..318377d 100644
|
|
||||||
--- a/sos/plugins/logs.py
|
|
||||||
+++ b/sos/plugins/logs.py
|
|
||||||
@@ -40,7 +40,7 @@ class Logs(Plugin):
|
|
||||||
if self.get_option('all_logs'):
|
|
||||||
logs = self.do_regex_find_all("^\S+\s+(-?\/.*$)\s+",
|
|
||||||
"/etc/syslog.conf")
|
|
||||||
- if self.policy().pkg_by_name("rsyslog") \
|
|
||||||
+ if self.is_installed("rsyslog") \
|
|
||||||
or os.path.exists("/etc/rsyslog.conf"):
|
|
||||||
logs += self.do_regex_find_all("^\S+\s+(-?\/.*$)\s+", "/etc/rsyslog.conf")
|
|
||||||
for i in logs:
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
|||||||
From 426549369f818091935712936514382786502094 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Thu, 27 Mar 2014 11:50:33 +0000
|
|
||||||
Subject: [PATCH 48/61] Clean up package checks in processor plugin
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/processor.py | 18 ++++++------------
|
|
||||||
1 file changed, 6 insertions(+), 12 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/processor.py b/sos/plugins/processor.py
|
|
||||||
index 391c64f..0b236f8 100644
|
|
||||||
--- a/sos/plugins/processor.py
|
|
||||||
+++ b/sos/plugins/processor.py
|
|
||||||
@@ -21,6 +21,8 @@ class Processor(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
|
|
||||||
"""
|
|
||||||
|
|
||||||
plugin_name = 'processor'
|
|
||||||
+ files = ('/proc/cpuinfo',)
|
|
||||||
+ packages = ('cpufreq-utils')
|
|
||||||
|
|
||||||
def setup(self):
|
|
||||||
self.add_copy_specs([
|
|
||||||
@@ -29,21 +31,13 @@ class Processor(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
|
|
||||||
"/sys/devices/system/cpu"
|
|
||||||
])
|
|
||||||
|
|
||||||
- if self.policy().pkg_by_name("cpufreq-utils"):
|
|
||||||
- self.add_cmd_output("cpufreq-info")
|
|
||||||
- self.add_cmd_output("cpupower info")
|
|
||||||
- self.add_cmd_output("cpupower frequency-info")
|
|
||||||
-
|
|
||||||
- if self.policy().pkg_by_name("kernel-tools"):
|
|
||||||
- self.add_cmd_output("cpupower info")
|
|
||||||
- self.add_cmd_output("cpupower frequency-info")
|
|
||||||
- self.add_cmd_output("cpupower idle-info")
|
|
||||||
+ self.add_cmd_output("lscpu")
|
|
||||||
+ self.add_cmd_output("cpupower info")
|
|
||||||
+ self.add_cmd_output("cpupower idle-info")
|
|
||||||
+ self.add_cmd_output("cpupower frequency-info")
|
|
||||||
|
|
||||||
if self.policy().get_arch().endswith("386"):
|
|
||||||
self.add_cmd_output("x86info -a")
|
|
||||||
|
|
||||||
- self.add_cmd_output("lscpu")
|
|
||||||
-
|
|
||||||
-
|
|
||||||
|
|
||||||
# vim: et ts=4 sw=4
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
|||||||
From 691e1811a2c6557c062a76e754a3b5228ce40fbf Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Thu, 27 Mar 2014 13:05:41 +0000
|
|
||||||
Subject: [PATCH 49/61] Pythonify Plugin._path_in_pathlist()
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/__init__.py | 5 +----
|
|
||||||
1 file changed, 1 insertion(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
|
|
||||||
index 0c4b9b4..55c2d48 100644
|
|
||||||
--- a/sos/plugins/__init__.py
|
|
||||||
+++ b/sos/plugins/__init__.py
|
|
||||||
@@ -195,10 +195,7 @@ class Plugin(object):
|
|
||||||
return regex_findall(regex, fname)
|
|
||||||
|
|
||||||
def _path_in_path_list(self, path, path_list):
|
|
||||||
- for p in path_list:
|
|
||||||
- if p in path:
|
|
||||||
- return True
|
|
||||||
- return False
|
|
||||||
+ return any(p in path for p in path_list)
|
|
||||||
|
|
||||||
def copy_symlink(self, srcpath, sub=None):
|
|
||||||
# the target stored in the original symlink
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
From 36055d3d069a1176787e4dfb722fc5ca9a804ac5 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Thu, 27 Mar 2014 13:46:40 +0000
|
|
||||||
Subject: [PATCH 50/61] Fix x86 arch detection in processor plugin
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/processor.py | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/processor.py b/sos/plugins/processor.py
|
|
||||||
index 0b236f8..14d800e 100644
|
|
||||||
--- a/sos/plugins/processor.py
|
|
||||||
+++ b/sos/plugins/processor.py
|
|
||||||
@@ -36,7 +36,7 @@ class Processor(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
|
|
||||||
self.add_cmd_output("cpupower idle-info")
|
|
||||||
self.add_cmd_output("cpupower frequency-info")
|
|
||||||
|
|
||||||
- if self.policy().get_arch().endswith("386"):
|
|
||||||
+ if '86' in self.policy().get_arch():
|
|
||||||
self.add_cmd_output("x86info -a")
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,152 +0,0 @@
|
|||||||
From f98ae415bbff3f633641633a1c99c13021d4b352 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Thu, 27 Mar 2014 13:47:10 +0000
|
|
||||||
Subject: [PATCH 51/61] Refactor Plugin.collect() pathway
|
|
||||||
|
|
||||||
Clean up and refactor the collect() path in preparation for
|
|
||||||
fixing the recursive tree copying code.
|
|
||||||
|
|
||||||
- Move string and command collection into their own methods
|
|
||||||
- Move glob expansion from add_copy_spec*() to
|
|
||||||
collect_copy_specs()
|
|
||||||
- Rename do_copy_file_or_dir() to do_copy_path()
|
|
||||||
|
|
||||||
There are no functional changes as a result of this patch.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/__init__.py | 57 +++++++++++++++++++++++++++++--------------------
|
|
||||||
1 file changed, 34 insertions(+), 23 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
|
|
||||||
index 55c2d48..807bd3f 100644
|
|
||||||
--- a/sos/plugins/__init__.py
|
|
||||||
+++ b/sos/plugins/__init__.py
|
|
||||||
@@ -99,7 +99,7 @@ class Plugin(object):
|
|
||||||
self.opt_parms = []
|
|
||||||
self.commons = commons
|
|
||||||
self.forbidden_paths = []
|
|
||||||
- self.copy_paths = []
|
|
||||||
+ self.copy_specs = []
|
|
||||||
self.copy_strings = []
|
|
||||||
self.collect_cmds = []
|
|
||||||
|
|
||||||
@@ -229,10 +229,10 @@ class Plugin(object):
|
|
||||||
self.archive.add_link(reldest,srcpath)
|
|
||||||
|
|
||||||
# copy the symlink target translating relative targets
|
|
||||||
- # to absolute paths to pass to do_copy_file_or_dir.
|
|
||||||
+ # to absolute paths to pass to do_copy_path.
|
|
||||||
self.soslog.debug("normalized link target %s as %s"
|
|
||||||
%(linkdest, absdest))
|
|
||||||
- self.do_copy_file_or_dir(absdest)
|
|
||||||
+ self.do_copy_path(absdest)
|
|
||||||
|
|
||||||
self.copied_files.append({
|
|
||||||
'srcpath':srcpath,
|
|
||||||
@@ -242,7 +242,7 @@ class Plugin(object):
|
|
||||||
|
|
||||||
def copy_dir(self, srcpath, sub=None):
|
|
||||||
for afile in os.listdir(srcpath):
|
|
||||||
- self.do_copy_file_or_dir(os.path.join(srcpath, afile), dest=None, sub=sub)
|
|
||||||
+ self.do_copy_path(os.path.join(srcpath, afile), dest=None, sub=sub)
|
|
||||||
|
|
||||||
def _get_dest_for_srcpath(self, srcpath):
|
|
||||||
for copied in self.copied_files:
|
|
||||||
@@ -251,7 +251,7 @@ class Plugin(object):
|
|
||||||
return None
|
|
||||||
|
|
||||||
# Methods for copying files and shelling out
|
|
||||||
- def do_copy_file_or_dir(self, srcpath, dest=None, sub=None):
|
|
||||||
+ def do_copy_path(self, srcpath, dest=None, sub=None):
|
|
||||||
# pylint: disable-msg = R0912
|
|
||||||
# pylint: disable-msg = R0915
|
|
||||||
'''Copy file or directory to the destination tree. If a directory, then
|
|
||||||
@@ -308,7 +308,7 @@ class Plugin(object):
|
|
||||||
|
|
||||||
|
|
||||||
def add_forbidden_path(self, forbiddenPath):
|
|
||||||
- """Specify a path to not copy, even if it's part of a copy_paths[]
|
|
||||||
+ """Specify a path to not copy, even if it's part of a copy_specs[]
|
|
||||||
entry.
|
|
||||||
"""
|
|
||||||
# Glob case handling is such that a valid non-glob is a reduced glob
|
|
||||||
@@ -417,12 +417,11 @@ class Plugin(object):
|
|
||||||
copied into the sosreport by this module.
|
|
||||||
"""
|
|
||||||
if not (copyspec and len(copyspec)):
|
|
||||||
- # self.soslog.warning("invalid file path")
|
|
||||||
+ self.soslog.warning("%s added null or empty file path"
|
|
||||||
+ % self.name())
|
|
||||||
return False
|
|
||||||
- # Glob case handling is such that a valid non-glob is a reduced glob
|
|
||||||
- for filespec in glob.glob(copyspec):
|
|
||||||
- if filespec not in self.copy_paths:
|
|
||||||
- self.copy_paths.append((filespec, sub))
|
|
||||||
+ if copyspec not in self.copy_specs:
|
|
||||||
+ self.copy_specs.append((copyspec, sub))
|
|
||||||
|
|
||||||
def get_command_output(self, prog, timeout=300):
|
|
||||||
(status, output, runtime) = sos_get_command_output(prog, timeout)
|
|
||||||
@@ -535,19 +534,16 @@ class Plugin(object):
|
|
||||||
"""
|
|
||||||
self.custom_text += text
|
|
||||||
|
|
||||||
- def collect(self):
|
|
||||||
- """Collect the data for a plugin."""
|
|
||||||
- for path, sub in self.copy_paths:
|
|
||||||
- self.do_copy_file_or_dir(path, sub=sub)
|
|
||||||
+ def expand_copy_spec(self, copyspec):
|
|
||||||
+ return glob.glob(copyspec)
|
|
||||||
|
|
||||||
- for string, file_name in self.copy_strings:
|
|
||||||
- try:
|
|
||||||
- self.archive.add_string(string,
|
|
||||||
- os.path.join('sos_strings', self.name(), file_name))
|
|
||||||
- except Exception as e:
|
|
||||||
- self.soslog.debug("could not create %s, traceback follows: %s"
|
|
||||||
- % (file_name, e))
|
|
||||||
+ def collect_copy_specs(self):
|
|
||||||
+ # Glob case handling is such that a valid non-glob is a reduced glob
|
|
||||||
+ for spec, sub in self.copy_specs:
|
|
||||||
+ for path in self.expand_copy_spec(spec):
|
|
||||||
+ self.do_copy_path(path, sub=sub)
|
|
||||||
|
|
||||||
+ def collect_cmd_output(self):
|
|
||||||
for progs in zip(self.collect_cmds):
|
|
||||||
prog, suggest_filename, root_symlink, timeout = progs[0]
|
|
||||||
self.soslog.debug("collecting output of '%s'" % prog)
|
|
||||||
@@ -558,6 +554,21 @@ class Plugin(object):
|
|
||||||
self.soslog.debug("error collecting output of '%s' (%s)"
|
|
||||||
% (prog, e))
|
|
||||||
|
|
||||||
+ def collect_strings(self):
|
|
||||||
+ for string, file_name in self.copy_strings:
|
|
||||||
+ try:
|
|
||||||
+ self.archive.add_string(string,
|
|
||||||
+ os.path.join('sos_strings', self.name(), file_name))
|
|
||||||
+ except Exception as e:
|
|
||||||
+ self.soslog.debug("could not create %s, traceback follows: %s"
|
|
||||||
+ % (file_name, e))
|
|
||||||
+
|
|
||||||
+ def collect(self):
|
|
||||||
+ """Collect the data for a plugin."""
|
|
||||||
+ self.collect_copy_specs()
|
|
||||||
+ self.collect_cmd_output()
|
|
||||||
+ self.collect_strings()
|
|
||||||
+
|
|
||||||
def get_description(self):
|
|
||||||
""" This function will return the description for the plugin"""
|
|
||||||
try:
|
|
||||||
@@ -592,7 +603,7 @@ class Plugin(object):
|
|
||||||
return True
|
|
||||||
|
|
||||||
def setup(self):
|
|
||||||
- """This method must be overridden to add the copy_paths, forbidden_paths,
|
|
||||||
+ """This method must be overridden to add the copy_specs, forbidden_paths,
|
|
||||||
and external programs to be collected at a minimum.
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
From 01ef1eaed6f1228fcb8f3d6bc1746396d638282d Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Thu, 27 Mar 2014 13:59:14 +0000
|
|
||||||
Subject: [PATCH 52/61] Remove obsolete checksum reference from
|
|
||||||
utilities_tests.py
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
tests/utilities_tests.py | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/tests/utilities_tests.py b/tests/utilities_tests.py
|
|
||||||
index f3b1629..22b2bbe 100644
|
|
||||||
--- a/tests/utilities_tests.py
|
|
||||||
+++ b/tests/utilities_tests.py
|
|
||||||
@@ -5,7 +5,7 @@ import unittest
|
|
||||||
import six
|
|
||||||
from six import StringIO
|
|
||||||
|
|
||||||
-from sos.utilities import grep, checksum, get_hash_name, is_executable, sos_get_command_output, find, tail, shell_out
|
|
||||||
+from sos.utilities import grep, get_hash_name, is_executable, sos_get_command_output, find, tail, shell_out
|
|
||||||
import sos
|
|
||||||
|
|
||||||
TEST_DIR = os.path.dirname(__file__)
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
|||||||
From fbd60e01cfce143757b6de13aaf2209319f3eee9 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Thu, 27 Mar 2014 14:15:28 +0000
|
|
||||||
Subject: [PATCH 53/61] Update plugin_tests.py to match new method names
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
tests/plugin_tests.py | 10 +++++-----
|
|
||||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py
|
|
||||||
index 9a21b61..4ba5968 100644
|
|
||||||
--- a/tests/plugin_tests.py
|
|
||||||
+++ b/tests/plugin_tests.py
|
|
||||||
@@ -194,15 +194,15 @@ class PluginTests(unittest.TestCase):
|
|
||||||
self.assertEquals(p.get_option_as_list("opt"), ['testing'])
|
|
||||||
|
|
||||||
def test_copy_dir(self):
|
|
||||||
- self.mp.do_copy_file_or_dir("tests")
|
|
||||||
+ self.mp.do_copy_path("tests")
|
|
||||||
self.assertEquals(self.mp.archive.m["tests/plugin_tests.py"], 'tests/plugin_tests.py')
|
|
||||||
|
|
||||||
def test_copy_dir_sub(self):
|
|
||||||
- self.mp.do_copy_file_or_dir("tests", sub=("tests/", "foobar/"))
|
|
||||||
+ self.mp.do_copy_path("tests", sub=("tests/", "foobar/"))
|
|
||||||
self.assertEquals(self.mp.archive.m["tests/plugin_tests.py"], 'foobar/plugin_tests.py')
|
|
||||||
|
|
||||||
def test_copy_dir_bad_path(self):
|
|
||||||
- self.mp.do_copy_file_or_dir("not_here_tests")
|
|
||||||
+ self.mp.do_copy_path("not_here_tests")
|
|
||||||
self.assertEquals(self.mp.archive.m, {})
|
|
||||||
|
|
||||||
def test_copy_dir_forbidden_path(self):
|
|
||||||
@@ -211,7 +211,7 @@ class PluginTests(unittest.TestCase):
|
|
||||||
})
|
|
||||||
p.archive = MockArchive()
|
|
||||||
p.setup()
|
|
||||||
- p.do_copy_file_or_dir("tests")
|
|
||||||
+ p.do_copy_path("tests")
|
|
||||||
self.assertEquals(p.archive.m, {})
|
|
||||||
|
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ class AddCopySpecLimitTests(unittest.TestCase):
|
|
||||||
|
|
||||||
def test_single_file_under_limit(self):
|
|
||||||
self.mp.add_copy_spec_limit("tests/tail_test.txt", 1)
|
|
||||||
- self.assertEquals(self.mp.copy_paths, [('tests/tail_test.txt', None)])
|
|
||||||
+ self.assertEquals(self.mp.copy_specs, [('tests/tail_test.txt', None)])
|
|
||||||
|
|
||||||
def test_single_file_over_limit(self):
|
|
||||||
fn = create_file(2) # create 2MB file, consider a context manager
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
|||||||
From 2f7baff1e206831945c83894fbc0ba5250178b5b Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Thu, 27 Mar 2014 14:45:53 +0000
|
|
||||||
Subject: [PATCH 54/61] Drop RedHatPlugin from procenv
|
|
||||||
|
|
||||||
The procenv package is not shipped in Red Hat distributions so
|
|
||||||
remove the RedHatPlugin tagging class from it.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/procenv.py | 4 ++--
|
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/procenv.py b/sos/plugins/procenv.py
|
|
||||||
index e776e14..4367555 100644
|
|
||||||
--- a/sos/plugins/procenv.py
|
|
||||||
+++ b/sos/plugins/procenv.py
|
|
||||||
@@ -13,9 +13,9 @@
|
|
||||||
## along with this program; if not, write to the Free Software
|
|
||||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
|
|
||||||
-from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
|
|
||||||
+from sos.plugins import Plugin, DebianPlugin, UbuntuPlugin
|
|
||||||
|
|
||||||
-class Procenv(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
|
|
||||||
+class Procenv(Plugin, DebianPlugin, UbuntuPlugin):
|
|
||||||
"""Process environment.
|
|
||||||
"""
|
|
||||||
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,164 +0,0 @@
|
|||||||
From a09090ab98b10e2eca363a4919397545d64f1c85 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Thu, 27 Mar 2014 16:09:35 +0000
|
|
||||||
Subject: [PATCH 55/61] Remove 'sub' parameter from Plugin.add_copy_spec*()
|
|
||||||
|
|
||||||
The 'sub' parameter to these functions allowed substituting part
|
|
||||||
of the path in the generated archive. E.g. transforming 'etc/'
|
|
||||||
into 'configs/'. This has never been used and seems to serve no
|
|
||||||
real purpose today. Simplify the parameter passing and copy_spec
|
|
||||||
lists by removing this support.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/__init__.py | 49 +++++++++++++++++--------------------------------
|
|
||||||
1 file changed, 17 insertions(+), 32 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
|
|
||||||
index 807bd3f..de278d0 100644
|
|
||||||
--- a/sos/plugins/__init__.py
|
|
||||||
+++ b/sos/plugins/__init__.py
|
|
||||||
@@ -197,7 +197,7 @@ class Plugin(object):
|
|
||||||
def _path_in_path_list(self, path, path_list):
|
|
||||||
return any(p in path for p in path_list)
|
|
||||||
|
|
||||||
- def copy_symlink(self, srcpath, sub=None):
|
|
||||||
+ def copy_symlink(self, srcpath):
|
|
||||||
# the target stored in the original symlink
|
|
||||||
linkdest = os.readlink(srcpath)
|
|
||||||
# absolute path to the link target
|
|
||||||
@@ -213,18 +213,14 @@ class Plugin(object):
|
|
||||||
reldest = linkdest
|
|
||||||
|
|
||||||
self.soslog.debug(
|
|
||||||
- "copying link %s pointing to %s with sub=%s, isdir=%s"
|
|
||||||
- % (srcpath, linkdest, sub, os.path.isdir(absdest)))
|
|
||||||
+ "copying link %s pointing to %s with isdir=%s"
|
|
||||||
+ % (srcpath, linkdest, os.path.isdir(absdest)))
|
|
||||||
|
|
||||||
if os.path.isdir(absdest):
|
|
||||||
self.soslog.debug("link %s is a directory, skipping..."
|
|
||||||
% linkdest)
|
|
||||||
return
|
|
||||||
|
|
||||||
- if sub:
|
|
||||||
- old, new = sub
|
|
||||||
- reldest = srcpath.replace(old, new)
|
|
||||||
-
|
|
||||||
# use the relative target path in the tarball
|
|
||||||
self.archive.add_link(reldest,srcpath)
|
|
||||||
|
|
||||||
@@ -240,9 +236,9 @@ class Plugin(object):
|
|
||||||
'symlink':"yes",
|
|
||||||
'pointsto':linkdest})
|
|
||||||
|
|
||||||
- def copy_dir(self, srcpath, sub=None):
|
|
||||||
+ def copy_dir(self, srcpath):
|
|
||||||
for afile in os.listdir(srcpath):
|
|
||||||
- self.do_copy_path(os.path.join(srcpath, afile), dest=None, sub=sub)
|
|
||||||
+ self.do_copy_path(os.path.join(srcpath, afile), dest=None)
|
|
||||||
|
|
||||||
def _get_dest_for_srcpath(self, srcpath):
|
|
||||||
for copied in self.copied_files:
|
|
||||||
@@ -251,16 +247,12 @@ class Plugin(object):
|
|
||||||
return None
|
|
||||||
|
|
||||||
# Methods for copying files and shelling out
|
|
||||||
- def do_copy_path(self, srcpath, dest=None, sub=None):
|
|
||||||
+ def do_copy_path(self, srcpath, dest=None):
|
|
||||||
# pylint: disable-msg = R0912
|
|
||||||
# pylint: disable-msg = R0915
|
|
||||||
'''Copy file or directory to the destination tree. If a directory, then
|
|
||||||
everything below it is recursively copied. A list of copied files are
|
|
||||||
- saved for use later in preparing a report. sub can be used to rename
|
|
||||||
- the destination of the file, sub should be a two-tuple of (old,new).
|
|
||||||
- For example if you passed in ("etc","configurations") for use against
|
|
||||||
- /etc/my_file.conf the file would end up at
|
|
||||||
- /configurations/my_file.conf.
|
|
||||||
+ saved for use later in preparing a report.
|
|
||||||
'''
|
|
||||||
if self._path_in_path_list(srcpath, self.forbidden_paths):
|
|
||||||
self.soslog.debug("%s is in the forbidden path list" % srcpath)
|
|
||||||
@@ -273,16 +265,12 @@ class Plugin(object):
|
|
||||||
if not dest:
|
|
||||||
dest = srcpath
|
|
||||||
|
|
||||||
- if sub:
|
|
||||||
- old, new = sub
|
|
||||||
- dest = srcpath.replace(old, new)
|
|
||||||
-
|
|
||||||
if os.path.islink(srcpath):
|
|
||||||
- self.copy_symlink(srcpath, sub=sub)
|
|
||||||
+ self.copy_symlink(srcpath)
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
if os.path.isdir(srcpath):
|
|
||||||
- self.copy_dir(srcpath, sub=sub)
|
|
||||||
+ self.copy_dir(srcpath)
|
|
||||||
return
|
|
||||||
|
|
||||||
# if we get here, it's definitely a regular file (not a symlink or dir)
|
|
||||||
@@ -370,7 +358,7 @@ class Plugin(object):
|
|
||||||
except Exception:
|
|
||||||
return default
|
|
||||||
|
|
||||||
- def add_copy_spec_limit(self, copyspec, sizelimit=None, sub=None):
|
|
||||||
+ def add_copy_spec_limit(self, copyspec, sizelimit=None):
|
|
||||||
"""Add a file or glob but limit it to sizelimit megabytes. If fname is
|
|
||||||
a single file the file will be tailed to meet sizelimit. If the first
|
|
||||||
file in a glob is too large it will be tailed to meet the sizelimit.
|
|
||||||
@@ -392,14 +380,11 @@ class Plugin(object):
|
|
||||||
if sizelimit and current_size > sizelimit:
|
|
||||||
limit_reached = True
|
|
||||||
break
|
|
||||||
- self.add_copy_spec(_file, sub)
|
|
||||||
+ self.add_copy_spec(_file)
|
|
||||||
|
|
||||||
if limit_reached:
|
|
||||||
file_name = _file
|
|
||||||
|
|
||||||
- if sub:
|
|
||||||
- old, new = sub
|
|
||||||
- file_name = _file.replace(old, new)
|
|
||||||
if file_name[0] == os.sep:
|
|
||||||
file_name = file_name.lstrip(os.sep)
|
|
||||||
strfile = file_name.replace(os.path.sep, ".") + ".tailed"
|
|
||||||
@@ -408,11 +393,11 @@ class Plugin(object):
|
|
||||||
os.path.relpath('/', os.path.dirname(_file)), 'sos_strings',
|
|
||||||
self.name(), strfile), _file)
|
|
||||||
|
|
||||||
- def add_copy_specs(self, copyspecs, sub=None):
|
|
||||||
+ def add_copy_specs(self, copyspecs):
|
|
||||||
for copyspec in copyspecs:
|
|
||||||
- self.add_copy_spec(copyspec, sub)
|
|
||||||
+ self.add_copy_spec(copyspec)
|
|
||||||
|
|
||||||
- def add_copy_spec(self, copyspec, sub=None):
|
|
||||||
+ def add_copy_spec(self, copyspec):
|
|
||||||
"""Add a file specification (can be file, dir,or shell glob) to be
|
|
||||||
copied into the sosreport by this module.
|
|
||||||
"""
|
|
||||||
@@ -421,7 +406,7 @@ class Plugin(object):
|
|
||||||
% self.name())
|
|
||||||
return False
|
|
||||||
if copyspec not in self.copy_specs:
|
|
||||||
- self.copy_specs.append((copyspec, sub))
|
|
||||||
+ self.copy_specs.append(copyspec)
|
|
||||||
|
|
||||||
def get_command_output(self, prog, timeout=300):
|
|
||||||
(status, output, runtime) = sos_get_command_output(prog, timeout)
|
|
||||||
@@ -539,9 +524,9 @@ class Plugin(object):
|
|
||||||
|
|
||||||
def collect_copy_specs(self):
|
|
||||||
# Glob case handling is such that a valid non-glob is a reduced glob
|
|
||||||
- for spec, sub in self.copy_specs:
|
|
||||||
+ for spec in self.copy_specs:
|
|
||||||
for path in self.expand_copy_spec(spec):
|
|
||||||
- self.do_copy_path(path, sub=sub)
|
|
||||||
+ self.do_copy_path(path)
|
|
||||||
|
|
||||||
def collect_cmd_output(self):
|
|
||||||
for progs in zip(self.collect_cmds):
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
|||||||
From f5be64704096d5bdf9f75cc78dc571c6d9325fcb Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Thu, 27 Mar 2014 16:38:29 +0000
|
|
||||||
Subject: [PATCH 56/61] Remove references to 'sub' parameter from plugin tests
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
tests/plugin_tests.py | 10 +++-------
|
|
||||||
1 file changed, 3 insertions(+), 7 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py
|
|
||||||
index 4ba5968..cf874f1 100644
|
|
||||||
--- a/tests/plugin_tests.py
|
|
||||||
+++ b/tests/plugin_tests.py
|
|
||||||
@@ -197,10 +197,6 @@ class PluginTests(unittest.TestCase):
|
|
||||||
self.mp.do_copy_path("tests")
|
|
||||||
self.assertEquals(self.mp.archive.m["tests/plugin_tests.py"], 'tests/plugin_tests.py')
|
|
||||||
|
|
||||||
- def test_copy_dir_sub(self):
|
|
||||||
- self.mp.do_copy_path("tests", sub=("tests/", "foobar/"))
|
|
||||||
- self.assertEquals(self.mp.archive.m["tests/plugin_tests.py"], 'foobar/plugin_tests.py')
|
|
||||||
-
|
|
||||||
def test_copy_dir_bad_path(self):
|
|
||||||
self.mp.do_copy_path("not_here_tests")
|
|
||||||
self.assertEquals(self.mp.archive.m, {})
|
|
||||||
@@ -225,14 +221,14 @@ class AddCopySpecLimitTests(unittest.TestCase):
|
|
||||||
|
|
||||||
def test_single_file_under_limit(self):
|
|
||||||
self.mp.add_copy_spec_limit("tests/tail_test.txt", 1)
|
|
||||||
- self.assertEquals(self.mp.copy_specs, [('tests/tail_test.txt', None)])
|
|
||||||
+ self.assertEquals(self.mp.copy_specs, ['tests/tail_test.txt'])
|
|
||||||
|
|
||||||
def test_single_file_over_limit(self):
|
|
||||||
fn = create_file(2) # create 2MB file, consider a context manager
|
|
||||||
- self.mp.add_copy_spec_limit(fn, 1, sub=('tmp', 'awesome'))
|
|
||||||
+ self.mp.add_copy_spec_limit(fn, 1)
|
|
||||||
content, fname = self.mp.copy_strings[0]
|
|
||||||
self.assertTrue("tailed" in fname)
|
|
||||||
- self.assertTrue("awesome" in fname)
|
|
||||||
+ self.assertTrue("tmp" in fname)
|
|
||||||
self.assertTrue("/" not in fname)
|
|
||||||
self.assertEquals(1024 * 1024, len(content))
|
|
||||||
os.unlink(fn)
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
|||||||
From 81b06ca7406aee6ecb47f7afe33fc56caafee570 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Thu, 27 Mar 2014 20:33:40 +0000
|
|
||||||
Subject: [PATCH 57/61] Use a set for Plugin.copy_paths
|
|
||||||
|
|
||||||
We want to remove any duplicates from the list of paths to
|
|
||||||
collect. Use a set and update it with the expansion of each copy
|
|
||||||
spec as we add it. This avoids having to explictly test for
|
|
||||||
duplicates when we come to iterate over the set.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/__init__.py | 14 ++++++--------
|
|
||||||
1 file changed, 6 insertions(+), 8 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
|
|
||||||
index de278d0..7b6180c 100644
|
|
||||||
--- a/sos/plugins/__init__.py
|
|
||||||
+++ b/sos/plugins/__init__.py
|
|
||||||
@@ -99,7 +99,7 @@ class Plugin(object):
|
|
||||||
self.opt_parms = []
|
|
||||||
self.commons = commons
|
|
||||||
self.forbidden_paths = []
|
|
||||||
- self.copy_specs = []
|
|
||||||
+ self.copy_paths = set()
|
|
||||||
self.copy_strings = []
|
|
||||||
self.collect_cmds = []
|
|
||||||
|
|
||||||
@@ -402,11 +402,11 @@ class Plugin(object):
|
|
||||||
copied into the sosreport by this module.
|
|
||||||
"""
|
|
||||||
if not (copyspec and len(copyspec)):
|
|
||||||
- self.soslog.warning("%s added null or empty file path"
|
|
||||||
- % self.name())
|
|
||||||
+ self.soslog.warning("plugin %s %s"
|
|
||||||
+ % ("added null or empty copy spec", self.name()))
|
|
||||||
return False
|
|
||||||
- if copyspec not in self.copy_specs:
|
|
||||||
- self.copy_specs.append(copyspec)
|
|
||||||
+ copy_paths = self.expand_copy_spec(copyspec)
|
|
||||||
+ self.copy_paths.update(copy_paths)
|
|
||||||
|
|
||||||
def get_command_output(self, prog, timeout=300):
|
|
||||||
(status, output, runtime) = sos_get_command_output(prog, timeout)
|
|
||||||
@@ -523,9 +523,7 @@ class Plugin(object):
|
|
||||||
return glob.glob(copyspec)
|
|
||||||
|
|
||||||
def collect_copy_specs(self):
|
|
||||||
- # Glob case handling is such that a valid non-glob is a reduced glob
|
|
||||||
- for spec in self.copy_specs:
|
|
||||||
- for path in self.expand_copy_spec(spec):
|
|
||||||
+ for path in self.copy_paths:
|
|
||||||
self.do_copy_path(path)
|
|
||||||
|
|
||||||
def collect_cmd_output(self):
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
|||||||
From cfefd80c828c309745cc40d8498223b4fbc7b5ca Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Thu, 27 Mar 2014 20:52:49 +0000
|
|
||||||
Subject: [PATCH 58/61] Update Plugin tests to treat copy_paths as a set
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
tests/plugin_tests.py | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py
|
|
||||||
index cf874f1..5074cbf 100644
|
|
||||||
--- a/tests/plugin_tests.py
|
|
||||||
+++ b/tests/plugin_tests.py
|
|
||||||
@@ -221,7 +221,7 @@ class AddCopySpecLimitTests(unittest.TestCase):
|
|
||||||
|
|
||||||
def test_single_file_under_limit(self):
|
|
||||||
self.mp.add_copy_spec_limit("tests/tail_test.txt", 1)
|
|
||||||
- self.assertEquals(self.mp.copy_specs, ['tests/tail_test.txt'])
|
|
||||||
+ self.assertEquals(self.mp.copy_paths, set(['tests/tail_test.txt']))
|
|
||||||
|
|
||||||
def test_single_file_over_limit(self):
|
|
||||||
fn = create_file(2) # create 2MB file, consider a context manager
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
|||||||
From c613b172a44c98f40919c763eb4bf088476cbefa Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Thu, 27 Mar 2014 21:04:42 +0000
|
|
||||||
Subject: [PATCH 59/61] Add tests for Plugin.add_copy_spec()/add_copy_specs()
|
|
||||||
|
|
||||||
Give add_copy_spec() and add_copy_specs() their own test cases.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
tests/plugin_tests.py | 26 ++++++++++++++++++++++++--
|
|
||||||
1 file changed, 24 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py
|
|
||||||
index 5074cbf..a4905cf 100644
|
|
||||||
--- a/tests/plugin_tests.py
|
|
||||||
+++ b/tests/plugin_tests.py
|
|
||||||
@@ -211,7 +211,9 @@ class PluginTests(unittest.TestCase):
|
|
||||||
self.assertEquals(p.archive.m, {})
|
|
||||||
|
|
||||||
|
|
||||||
-class AddCopySpecLimitTests(unittest.TestCase):
|
|
||||||
+class AddCopySpecTests(unittest.TestCase):
|
|
||||||
+
|
|
||||||
+ expect_paths = set(['tests/tail_test.txt'])
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
self.mp = MockPlugin({
|
|
||||||
@@ -219,9 +221,29 @@ class AddCopySpecLimitTests(unittest.TestCase):
|
|
||||||
})
|
|
||||||
self.mp.archive = MockArchive()
|
|
||||||
|
|
||||||
+ def assert_expect_paths(self):
|
|
||||||
+ self.assertEquals(self.mp.copy_paths, self.expect_paths)
|
|
||||||
+
|
|
||||||
+ # add_copy_spec()
|
|
||||||
+
|
|
||||||
+ def test_single_file(self):
|
|
||||||
+ self.mp.add_copy_spec('tests/tail_test.txt')
|
|
||||||
+ self.assert_expect_paths()
|
|
||||||
+ def test_glob_file(self):
|
|
||||||
+ self.mp.add_copy_spec('tests/tail_test.*')
|
|
||||||
+ self.assert_expect_paths()
|
|
||||||
+
|
|
||||||
def test_single_file_under_limit(self):
|
|
||||||
self.mp.add_copy_spec_limit("tests/tail_test.txt", 1)
|
|
||||||
- self.assertEquals(self.mp.copy_paths, set(['tests/tail_test.txt']))
|
|
||||||
+ self.assert_expect_paths()
|
|
||||||
+
|
|
||||||
+ # add_copy_specs()
|
|
||||||
+
|
|
||||||
+ def test_add_copy_specs(self):
|
|
||||||
+ self.mp.add_copy_specs(["tests/tail_test.txt"])
|
|
||||||
+ self.assert_expect_paths()
|
|
||||||
+
|
|
||||||
+ # add_copy_spec_limit()
|
|
||||||
|
|
||||||
def test_single_file_over_limit(self):
|
|
||||||
fn = create_file(2) # create 2MB file, consider a context manager
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
|||||||
From 0bedab23f3eb86878d894419614e1728c395a84e Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Thu, 27 Mar 2014 21:06:24 +0000
|
|
||||||
Subject: [PATCH 60/61] Raise a TypeError if add_copy_specs() is called with a
|
|
||||||
string
|
|
||||||
|
|
||||||
Since strings are iterable a plugin attempting to call
|
|
||||||
add_copy_specs("/something") results in a plugin calling
|
|
||||||
add_copy_spec("/"). Raise a TypeError if this happens.
|
|
||||||
|
|
||||||
Fixes Issue #141.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/__init__.py | 2 ++
|
|
||||||
tests/plugin_tests.py | 3 +++
|
|
||||||
2 files changed, 5 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
|
|
||||||
index 7b6180c..7e865cd 100644
|
|
||||||
--- a/sos/plugins/__init__.py
|
|
||||||
+++ b/sos/plugins/__init__.py
|
|
||||||
@@ -394,6 +394,8 @@ class Plugin(object):
|
|
||||||
self.name(), strfile), _file)
|
|
||||||
|
|
||||||
def add_copy_specs(self, copyspecs):
|
|
||||||
+ if isinstance(copyspecs, six.string_types):
|
|
||||||
+ raise TypeError("Plugin.add_copy_specs called with string argument")
|
|
||||||
for copyspec in copyspecs:
|
|
||||||
self.add_copy_spec(copyspec)
|
|
||||||
|
|
||||||
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py
|
|
||||||
index a4905cf..c44c162 100644
|
|
||||||
--- a/tests/plugin_tests.py
|
|
||||||
+++ b/tests/plugin_tests.py
|
|
||||||
@@ -243,6 +243,9 @@ class AddCopySpecTests(unittest.TestCase):
|
|
||||||
self.mp.add_copy_specs(["tests/tail_test.txt"])
|
|
||||||
self.assert_expect_paths()
|
|
||||||
|
|
||||||
+ def test_add_copy_spec_nostrings(self):
|
|
||||||
+ self.assertRaises(TypeError, self.mp.add_copy_specs,"stringsarebadmkay?")
|
|
||||||
+
|
|
||||||
# add_copy_spec_limit()
|
|
||||||
|
|
||||||
def test_single_file_over_limit(self):
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
|||||||
From efc3b09c2b41c166e54593f0956b9f0eaf374925 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Bryn M. Reeves" <bmr@redhat.com>
|
|
||||||
Date: Fri, 28 Mar 2014 16:29:38 +0000
|
|
||||||
Subject: [PATCH 61/61] Add collection of grub configuration for UEFI systems
|
|
||||||
|
|
||||||
UEFI systems store the grub configuration at:
|
|
||||||
|
|
||||||
/boot/efi/EFI/*/grub.conf [grub 1.x]
|
|
||||||
/boot/efi/EFI/*/grub.cfg [grub 2.x]
|
|
||||||
|
|
||||||
Add these paths to the respective modules.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
---
|
|
||||||
sos/plugins/grub.py | 2 +-
|
|
||||||
sos/plugins/grub2.py | 11 ++++++-----
|
|
||||||
2 files changed, 7 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/grub.py b/sos/plugins/grub.py
|
|
||||||
index cc4d593..3911041 100644
|
|
||||||
--- a/sos/plugins/grub.py
|
|
||||||
+++ b/sos/plugins/grub.py
|
|
||||||
@@ -23,11 +23,11 @@ class Grub(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
|
|
||||||
|
|
||||||
def setup(self):
|
|
||||||
self.add_copy_specs([
|
|
||||||
+ "/boot/efi/EFI/*/grub.conf",
|
|
||||||
"/boot/grub/grub.conf",
|
|
||||||
"/boot/grub/device.map",
|
|
||||||
"/etc/grub.conf",
|
|
||||||
"/etc/grub.d"
|
|
||||||
])
|
|
||||||
|
|
||||||
-
|
|
||||||
# vim: et ts=4 sw=4
|
|
||||||
diff --git a/sos/plugins/grub2.py b/sos/plugins/grub2.py
|
|
||||||
index c9f64b0..95c1218 100644
|
|
||||||
--- a/sos/plugins/grub2.py
|
|
||||||
+++ b/sos/plugins/grub2.py
|
|
||||||
@@ -23,12 +23,13 @@ class Grub2(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
|
|
||||||
|
|
||||||
def setup(self):
|
|
||||||
self.add_copy_specs([
|
|
||||||
- "/etc/grub.d",
|
|
||||||
- "/etc/grub2.cfg",
|
|
||||||
- "/etc/default/grub",
|
|
||||||
- "/boot/grub/grub.cfg",
|
|
||||||
+ "/boot/efi/EFI/*/grub.cfg",
|
|
||||||
"/boot/grub2/grub.cfg",
|
|
||||||
- "/boot/grub2/grubenv"
|
|
||||||
+ "/boot/grub2/grubenv",
|
|
||||||
+ "/boot/grub/grub.cfg",
|
|
||||||
+ "/etc/default/grub",
|
|
||||||
+ "/etc/grub2.cfg",
|
|
||||||
+ "/etc/grub.d"
|
|
||||||
])
|
|
||||||
self.add_cmd_output("ls -lanR /boot")
|
|
||||||
self.add_cmd_output("grub2-mkconfig")
|
|
||||||
--
|
|
||||||
1.7.11.7
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
|||||||
commit f81df25a32ff525f965a52581711ff06563166b5
|
|
||||||
Author: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
Date: Mon Jun 10 19:50:28 2013 +0100
|
|
||||||
|
|
||||||
Reduce level of 'could not run' messages info->debug
|
|
||||||
|
|
||||||
We expect not to find all commands; don't output a log message on
|
|
||||||
each missing binary.
|
|
||||||
|
|
||||||
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
|
|
||||||
|
|
||||||
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
|
|
||||||
index 70711a3..e25f035 100644
|
|
||||||
--- a/sos/plugins/__init__.py
|
|
||||||
+++ b/sos/plugins/__init__.py
|
|
||||||
@@ -543,7 +543,7 @@ class Plugin(object):
|
|
||||||
# pylint: disable-msg = W0612
|
|
||||||
status, shout, runtime = sos_get_command_output(exe, timeout=timeout)
|
|
||||||
if (status == 127):
|
|
||||||
- self.soslog.info("could not run '%s': command not found" % exe)
|
|
||||||
+ self.soslog.debug("could not run '%s': command not found" % exe)
|
|
||||||
return None
|
|
||||||
|
|
||||||
if suggest_filename:
|
|
137
sos.spec
137
sos.spec
@ -1,11 +1,12 @@
|
|||||||
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
||||||
|
%global commit 55c89eb6810e7060845082845653b059aab90e3d
|
||||||
|
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
||||||
Summary: A set of tools to gather troubleshooting information from a system
|
Summary: A set of tools to gather troubleshooting information from a system
|
||||||
Name: sos
|
Name: sos
|
||||||
Version: 3.1
|
Version: 3.2
|
||||||
Release: 2%{?dist}
|
Release: 0.1.a%{?dist}
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
Source0: https://github.com/sosreport/sosreport/archive/sos-3.1.tar.gz
|
Source0: https://github.com/sosreport/sos/archive/%{commit}.tar.gz#/%{name}-%{commit}.tar.gz
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
@ -17,67 +18,6 @@ Requires: rpm-python
|
|||||||
Requires: tar
|
Requires: tar
|
||||||
Requires: bzip2
|
Requires: bzip2
|
||||||
Requires: xz
|
Requires: xz
|
||||||
Patch0: 0001-Fix-cluster-module-crm_report-support.patch
|
|
||||||
Patch1: 0002-Remove-obsolete-diagnostics-code-from-ldap-plugin.patch
|
|
||||||
Patch2: 0003-Ensure-superclass-postproc-method-is-called-in-ldap-.patch
|
|
||||||
Patch3: 0004-Fix-cluster-postproc-regression.patch
|
|
||||||
Patch4: 0005-Fix-get_option-use-in-cluster-plugin.patch
|
|
||||||
Patch5: 0006-Fix-verbose-file-logging.patch
|
|
||||||
Patch6: 0007-Always-treat-rhevm-vdsmlogs-option-as-string.patch
|
|
||||||
Patch7: 0008-Add-rhsm-debug-collection-to-yum-plugin.patch
|
|
||||||
Patch8: 0009-Make-get_cmd_output_now-behaviour-match-2.2.patch
|
|
||||||
Patch9: 0010-Include-geo-replication-status-in-gluster-plugin.patch
|
|
||||||
Patch10: 0011-postgresql-minor-fixes.patch
|
|
||||||
Patch11: 0012-postgresql-add-logs-about-errors-warnings.patch
|
|
||||||
Patch12: 0013-postgresql-added-license-and-copyright.patch
|
|
||||||
Patch13: 0014-postgresql-allow-use-TCP-socket.patch
|
|
||||||
Patch14: 0015-Pass-no-archive-to-rhsm-debug-script.patch
|
|
||||||
Patch15: 0016-Ensure-unused-fds-are-closed-when-calling-subprocess.patch
|
|
||||||
Patch16: 0017-Fix-gluster-volume-name-extraction.patch
|
|
||||||
Patch17: 0018-Add-distupgrade-plugin.patch
|
|
||||||
Patch18: 0019-Fix-command-output-substitution-exception.patch
|
|
||||||
Patch19: 0020-Improve-error-message-when-cluster.crm_from-is-inval.patch
|
|
||||||
Patch20: 0021-Remove-useless-check_enabled-from-sar-plugin.patch
|
|
||||||
Patch21: 0022-Eliminate-hard-coded-var-log-sa-paths-in-sar-plugin.patch
|
|
||||||
Patch22: 0023-Scrub-ldap_default_authtok-password-in-sssd-plugin.patch
|
|
||||||
Patch23: 0024-Replace-package-check-with-file-check-in-anacron.patch
|
|
||||||
Patch24: 0025-Remove-the-rhevm-plugin.patch
|
|
||||||
Patch25: 0026-powerpc-Move-VPD-related-tool-under-common-code.patch
|
|
||||||
Patch26: 0027-Add-PowerNV-specific-debug-data.patch
|
|
||||||
Patch27: 0028-Fix-remaining-use-of-obsolete-get_cmd_dir-in-plugins.patch
|
|
||||||
Patch28: 0029-Update-systemd-support.patch
|
|
||||||
Patch29: 0030-Add-tuned-plugin.patch
|
|
||||||
Patch30: 0031-Clean-up-get_cmd_path-make_cmd_path-make_cmd_dirs-me.patch
|
|
||||||
Patch31: 0032-Fix-broken-binary-detection-in-satellite-plugin.patch
|
|
||||||
Patch32: 0033-Rename-validatePlugin-to-validate_plugin.patch
|
|
||||||
Patch33: 0034-Update-policy_tests.py-for-validate_plugin-change.patch
|
|
||||||
Patch34: 0035-Match-plugins-against-policies.patch
|
|
||||||
Patch35: 0036-Do-not-collect-isos-in-cobbler-plugin.patch
|
|
||||||
Patch36: 0037-Call-rhsm-debug-with-the-sos-switch.patch
|
|
||||||
Patch37: 0038-Fix-plugin_test-exception-on-six.PY2.patch
|
|
||||||
Patch38: 0039-Remove-profile-support.patch
|
|
||||||
Patch39: 0040-Dead-code-removal-sos_relative_path.patch
|
|
||||||
Patch40: 0041-Dead-code-removal-DirTree.patch
|
|
||||||
Patch41: 0042-Dead-code-removal-utilities.checksum.patch
|
|
||||||
Patch42: 0043-Add-vim-tags-to-all-python-source-files.patch
|
|
||||||
Patch43: 0044-Dead-code-removal-sos.plugins.common_prefix.patch
|
|
||||||
Patch44: 0045-Dead-code-removal-PluginException.patch
|
|
||||||
Patch45: 0046-Convert-infiniband-to-package-list.patch
|
|
||||||
Patch46: 0047-Replace-self.policy-.pkg_by_name-us-in-Logs-plugin.patch
|
|
||||||
Patch47: 0048-Clean-up-package-checks-in-processor-plugin.patch
|
|
||||||
Patch48: 0049-Pythonify-Plugin._path_in_pathlist.patch
|
|
||||||
Patch49: 0050-Fix-x86-arch-detection-in-processor-plugin.patch
|
|
||||||
Patch50: 0051-Refactor-Plugin.collect-pathway.patch
|
|
||||||
Patch51: 0052-Remove-obsolete-checksum-reference-from-utilities_te.patch
|
|
||||||
Patch52: 0053-Update-plugin_tests.py-to-match-new-method-names.patch
|
|
||||||
Patch53: 0054-Drop-RedHatPlugin-from-procenv.patch
|
|
||||||
Patch54: 0055-Remove-sub-parameter-from-Plugin.add_copy_spec.patch
|
|
||||||
Patch55: 0056-Remove-references-to-sub-parameter-from-plugin-tests.patch
|
|
||||||
Patch56: 0057-Use-a-set-for-Plugin.copy_paths.patch
|
|
||||||
Patch57: 0058-Update-Plugin-tests-to-treat-copy_paths-as-a-set.patch
|
|
||||||
Patch58: 0059-Add-tests-for-Plugin.add_copy_spec-add_copy_specs.patch
|
|
||||||
Patch59: 0060-Raise-a-TypeError-if-add_copy_specs-is-called-with-a.patch
|
|
||||||
Patch60: 0061-Add-collection-of-grub-configuration-for-UEFI-system.patch
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Sos is a set of tools that gathers information about system
|
Sos is a set of tools that gathers information about system
|
||||||
@ -87,68 +27,7 @@ support technicians and developers.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
# deal with github tarball naming scheme
|
# deal with github tarball naming scheme
|
||||||
%setup -q -n sosreport-sos-%{version}
|
%setup -q -n %{name}-%{commit}
|
||||||
%patch0 -p1
|
|
||||||
%patch1 -p1
|
|
||||||
%patch2 -p1
|
|
||||||
%patch3 -p1
|
|
||||||
%patch4 -p1
|
|
||||||
%patch5 -p1
|
|
||||||
%patch6 -p1
|
|
||||||
%patch7 -p1
|
|
||||||
%patch8 -p1
|
|
||||||
%patch9 -p1
|
|
||||||
%patch10 -p1
|
|
||||||
%patch11 -p1
|
|
||||||
%patch12 -p1
|
|
||||||
%patch13 -p1
|
|
||||||
%patch14 -p1
|
|
||||||
%patch15 -p1
|
|
||||||
%patch16 -p1
|
|
||||||
%patch17 -p1
|
|
||||||
%patch18 -p1
|
|
||||||
%patch19 -p1
|
|
||||||
%patch20 -p1
|
|
||||||
%patch21 -p1
|
|
||||||
%patch22 -p1
|
|
||||||
%patch23 -p1
|
|
||||||
%patch24 -p1
|
|
||||||
%patch25 -p1
|
|
||||||
%patch26 -p1
|
|
||||||
%patch27 -p1
|
|
||||||
%patch28 -p1
|
|
||||||
%patch29 -p1
|
|
||||||
%patch30 -p1
|
|
||||||
%patch31 -p1
|
|
||||||
%patch32 -p1
|
|
||||||
%patch33 -p1
|
|
||||||
%patch34 -p1
|
|
||||||
%patch35 -p1
|
|
||||||
%patch36 -p1
|
|
||||||
%patch37 -p1
|
|
||||||
%patch38 -p1
|
|
||||||
%patch39 -p1
|
|
||||||
%patch40 -p1
|
|
||||||
%patch41 -p1
|
|
||||||
%patch42 -p1
|
|
||||||
%patch43 -p1
|
|
||||||
%patch44 -p1
|
|
||||||
%patch45 -p1
|
|
||||||
%patch46 -p1
|
|
||||||
%patch47 -p1
|
|
||||||
%patch48 -p1
|
|
||||||
%patch49 -p1
|
|
||||||
%patch50 -p1
|
|
||||||
%patch51 -p1
|
|
||||||
%patch52 -p1
|
|
||||||
%patch53 -p1
|
|
||||||
%patch54 -p1
|
|
||||||
%patch55 -p1
|
|
||||||
%patch56 -p1
|
|
||||||
%patch57 -p1
|
|
||||||
%patch58 -p1
|
|
||||||
%patch59 -p1
|
|
||||||
%patch60 -p1
|
|
||||||
%build
|
%build
|
||||||
make
|
make
|
||||||
|
|
||||||
@ -171,6 +50,10 @@ rm -rf ${RPM_BUILD_ROOT}
|
|||||||
%config(noreplace) %{_sysconfdir}/sos.conf
|
%config(noreplace) %{_sysconfdir}/sos.conf
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jun 17 2014 Bryn M. Reeves <bmr@redhat.com> = 3.2-0.1.a
|
||||||
|
- Make source URL handling compliant with packaging guidelines
|
||||||
|
- Update to new upstream pre-release sos-3.2-alpha1
|
||||||
|
|
||||||
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1-2
|
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1-2
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user