[sos-devel] addCopySpecLimit

Jesse Jaggars jjaggars at redhat.com
Tue Mar 13 16:10:32 UTC 2012


There is a plugin method called addCopySpecLimit with the following
signature:

def addCopySpecLimit(self, fname, sizelimit=None, sub=None)

It's a fairly complicated function, as far as I can tell it does about
three things:

1. If fname is a single file it will attempt to copy the file.
  - if the file is under sizelimit it adds it via addCopySpec
  - if the file is over sizelimit it tails the last sizelimit bytes and
    writes that as an extCommand (via shelling out to tail)

2. If fname is a glob it will attempt to copy (via addCopySpec) all the
files, stopping before it gets to sizelimit bytes total.

3. If fname is a glob, but the first file it tries to copy is larger
than sizelimit bytes then nothing is added via addCopySpec.

There may be some problems with the above (especially #3) so I wanted to
start a thread on what the expectations for this function are and what
folks think this thing ought to do.

Here are my ideas:

* control the sorting

Currently files found via glob.glob are sorted alphabetically, which is
probably not what you want in some cases. It would be nice to be able to
sort the files however you wanted, or at least some parameter of
os.stat.

* trim the first file in a glob if it is too big

Rather than copying nothing, it might be better to try to copy the first
file (post sort) according to the 'only one file passed in rule'.

Both of these can be implemented in the plugin code so these changes
aren't top priority I don't suppose.

Jesse
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/sos-devel/attachments/20120313/d16da84d/attachment.sig>


More information about the sos-devel mailing list