From 4b351b751e2f847b12ebbe7922a39cdc0959ea2e Mon Sep 17 00:00:00 2001 From: Jesse Jaggars Date: Thu, 5 Apr 2012 15:34:58 -0500 Subject: adding more gathering for as7 and fixing an error where trying to add a unicode filename to a zipfile would fail --- sos/plugins/__init__.py | 3 ++- sos/plugins/as7.py | 4 +++- sos/utilities.py | 4 ++++ tests/archive_tests.py | 6 ++++++ 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() -- cgit