On Tue, 2008-08-26 at 08:53 -0400, Michael DeHaan wrote: > Luca Lesinigo wrote: > > Included a patch that will add support for a "df" method to the > > "mount" minion module. It does what its name suggests :D > > > > Return data is a dict: { 'mountpoint': [total_space, free_space, > > device, fs_type] } > > > > I found out the hard way that XML-RPC doesn't like integers bigger > > than 32bit, so the space is reported in 1KiB units. This gives us a > > maximum fs size of 4TiB, which is rather small. > > I'm unaware of that problem. Interesting. Perhaps you should use floats. > > > > I never used XML-RPC directly nor touched func's implementation, but I > > suspect there's a way to use 64bit values. At least it's there in the > > C library xmlrpc-c, which I found out using it with rtorrent :D > > > > vm1 ~ # func vm2 call mount df > > {'vm2': {'/': [8256952, 6511760, '/dev/root', 'ext3'], > > '/dev': [10240, 10188, 'udev', 'tmpfs'], > > '/dev/shm': [262200, 262200, 'shm', 'tmpfs']}} > > > > > > ------------------------------------------------------------------------ > > > > > > PS, anyone knows why I get single characters if I do "for line in > > openedfile.readline()" ? > > I had to use file.readlines() [notice the last 's']. > > readline returns a string, which is iterable. A for loop on a string > iterates through the characters in the string. > > What you are asking is closer to: > > while True: > x = f.readline() > if not x: > break > ... > > Though unless you are dealing with very large files there's not much > reason to do this, and reading things entirely into memory is sufficient. > > That all being said, Func modules should not be parsing shell commands > unless it's a last resort, when it's possible to get data through other > libraries, they should use those libraries, and when they can use proc, > they should. Parsing shell commands can be rather fragile. Not to mention dangerous. IIRC googling 'python df' will return a number of functional examples. -sv _______________________________________________ Func-list mailing list Func-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/func-list