Re: [patch] added "df" method to "mount" module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Il giorno 26/ago/08, alle ore 14:53, Michael DeHaan ha scritto:
  Perhaps you should use floats.
You're joking, aren't you?
I think you know floats are approximate values and not exact ones: you can't expect to take out of a float the same number you put in. Also, everyone knows that bytes are heavier than water so they won't float :-)
The correct answer is to increase the counter size, my /1024 hack was just to get it running now.

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.
awww right, I hadn't thought about that. thanks.

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.
I'm not using any external process/command/utility and am actually using proc. While this won't be portable on non-linux kernels, it's always better than parsing output from /bin/df or whatever.
Was yours an implicit reference to minion/modules/mount.py:27 ?

--
Luca Lesinigo
_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list

[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux