aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Jaggars <jjaggars@redhat.com>2012-04-05 15:34:58 -0500
committerJesse Jaggars <jjaggars@redhat.com>2012-04-05 15:34:58 -0500
commit4b351b751e2f847b12ebbe7922a39cdc0959ea2e (patch)
tree303fe7f3690853dd92ebcf32366e351fe23791d0
parent79b22b9dcca60f5d2b8d455d226a2bdb30c15fe2 (diff)
downloadsos-4b351b751e2f847b12ebbe7922a39cdc0959ea2e.tar.gz
adding more gathering for as7 and fixing an error where trying to add a unicode filename to a zipfile would fail
-rw-r--r--sos/plugins/__init__.py3
-rw-r--r--sos/plugins/as7.py4
-rw-r--r--sos/utilities.py4
-rw-r--r--tests/archive_tests.py6
4 files changed, 15 insertions, 2 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index f06c1fba..4ee9e419 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -289,7 +289,8 @@ class Plugin(object):
time_passed = time() - start_time
self.proflog.debug("copied: %-75s time: %f" % (srcpath, time_passed))
except Exception, e:
- self.soslog.debug(traceback.format_exc())
+ self.soslog.error("Unable to copy %s to %s" % (srcpath, dest))
+ self.soslog.error(traceback.format_exc())
def addForbiddenPath(self, forbiddenPath):
diff --git a/sos/plugins/as7.py b/sos/plugins/as7.py
index 5f12be78..a4af8243 100644
--- a/sos/plugins/as7.py
+++ b/sos/plugins/as7.py
@@ -126,7 +126,6 @@ class AS7(Plugin, IndependentPlugin, AS7Mixin):
This function will collect files from JBOSS_HOME for analysis. The scope of files to
be collected are determined by options to this SOS plug-in.
"""
-
for dir_ in configDirAry:
path = os.path.join(self.__jbossHome, dir_)
## First add forbidden files
@@ -156,6 +155,9 @@ class AS7(Plugin, IndependentPlugin, AS7Mixin):
for deployment in deployments:
self.__get_listing_from_deployment(deployment, deployment_info)
+ for xml in find("*.xml", os.path.join(self.__jbossHome, 'modules')):
+ self.addCopySpec(xml, sub=(self.__jbossHome, 'JBOSSHOME'))
+
def __get_deployment_info(self, dir_):
"""Gets the deployment name to sha1 mapping for all deployments defined
in configs under dir_"""
diff --git a/sos/utilities.py b/sos/utilities.py
index 3b76b999..046a9a51 100644
--- a/sos/utilities.py
+++ b/sos/utilities.py
@@ -304,6 +304,10 @@ class ZipFileArchive(Archive):
return self.name()
def add_file(self, src, dest=None):
+ src = str(src)
+ if dest:
+ dest = str(dest)
+
if os.path.isdir(src):
# We may not need, this, but if we do I only want to do it
# one time
diff --git a/tests/archive_tests.py b/tests/archive_tests.py
index 8a542f73..7f4d95e1 100644
--- a/tests/archive_tests.py
+++ b/tests/archive_tests.py
@@ -29,6 +29,12 @@ class ZipFileArchiveTest(unittest.TestCase):
self.check_for_file('test/tests/ziptest')
+ def test_add_unicode_file(self):
+ self.zf.add_file(u'tests/')
+ self.zf.close()
+
+ self.check_for_file('test/tests/ziptest')
+
def test_add_dir(self):
self.zf.add_file('tests/')
self.zf.close()