diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2014-04-19 13:59:00 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2014-04-19 13:59:00 +0100 |
commit | 38a35dcb8d553d5ac6fe616f64c96632e2b860a2 (patch) | |
tree | c7d99b810f13f4e38319beeb16d95c0829e9b586 | |
parent | 64aceb0949f58d23ae666a8ad9328f773456c137 (diff) | |
download | sos-38a35dcb8d553d5ac6fe616f64c96632e2b860a2.tar.gz |
Add parameter to add_copy_spec_limit() to control tail behavior
Allow callers of add_copy_spec_limit() to disable collection of
the tail of a file when the limit is reached. This is not useful
for most binary data formats and even many text formats.
Based on a patch from Peter Portante <peter.portante@redhat.com>.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/__init__.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index 1570b6a9..79bc3edb 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -182,7 +182,7 @@ class Plugin(object): self.log_error(msg % (called['exe'], e)) replacements = None return replacements - + def do_file_sub(self, srcpath, regexp, subst): '''Apply a regexp substitution to a file archived by sosreport. srcpath is the path in the archive where the file can be found. regexp @@ -379,7 +379,7 @@ class Plugin(object): except Exception: return default - def add_copy_spec_limit(self, copyspec, sizelimit=None): + def add_copy_spec_limit(self, copyspec, sizelimit=None, tailit=True): """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. @@ -403,7 +403,7 @@ class Plugin(object): break self.add_copy_spec(_file) - if limit_reached: + if limit_reached and tailit: file_name = _file if file_name[0] == os.sep: |