From 029e99ad1af022a5c3f713fdebb5646a52fca735 Mon Sep 17 00:00:00 2001
From: "Bryn M. Reeves" <bmr@redhat.com>
Date: Sat, 21 Jun 2014 13:02:09 +0100
Subject: [PATCH] [plugin] backport addCopySpecLimit tailit parameter

    commit 38a35dcb8d553d5ac6fe616f64c96632e2b860a2
    Author: Bryn M. Reeves <bmr@redhat.com>
    Date:   Sat Apr 19 13:59:00 2014 +0100

        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>
---
 sos/plugintools.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sos/plugintools.py b/sos/plugintools.py
index 97deedf..e985875 100644
--- a/sos/plugintools.py
+++ b/sos/plugintools.py
@@ -323,7 +323,7 @@ class PluginBase:
         # nonexistent options aren't enabled.
         return 0
 
-    def addCopySpecLimit(self, fname, sizelimit = None):
+    def addCopySpecLimit(self, fname, sizelimit=None, tailit=True):
         """Add a file specification (with limits)
         """
         if not ( fname and len(fname) ):
@@ -340,9 +340,7 @@ class PluginBase:
                 limit_reached = True
             else:
                 self.addCopySpec(flog)
-            # Truncate the first file (others would likely be compressed),
-            # ensuring we get at least some logs
-            if flog == files[0] and limit_reached:
+            if limit_reached and tailit:
                 self.collectExtOutput("tail -c%d %s" % (sizelimit, flog),
                     "tail_" + os.path.basename(flog), flog[1:])
 
-- 
1.9.3

