Statistics
| Branch: | Tag: | Revision:

root / lib / utils @ 5ff82cc9

Name Size
__init__.py 22 kB
algo.py 7.3 kB
filelock.py 5 kB
hash.py 2.4 kB
io.py 28.2 kB
log.py 8.4 kB
mlock.py 2.3 kB
nodesetup.py 3.4 kB
process.py 28.6 kB
retry.py 6.2 kB
text.py 14.9 kB
wrapper.py 5 kB
x509.py 9.5 kB

Latest revisions

# Date Author Comment
f97a7ada 05/09/2012 12:12 pm Iustin Pop

Allow clock skews in certificate verification

Currently we allow for up to NODE_MAX_CLOCK_SKEW time difference
between nodes in some operations, but not everywhere: SSL certificate
verification (import/export, both intra and inter-cluster) has a zero
limit (downwards), and a week upwards. This can cause even...

21864565 04/26/2012 05:17 pm Iustin Pop

Log all external commands execution

This logs all external commands in normal (non-debug) mode. This will
leak the DRBD secrets, but in any case we do log failed commands, so
it's not a significant change.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

dd27bc21 04/19/2012 09:04 pm Michael Hanselmann

utils.algo: Use str.isdigit instead of regular expression

str.isdigit is about 4x faster than using a regular expression ("\d+").
This is in the inner sorting code so speed matters.

$ python -m timeit -s 'import re; s = re.compile("^\d+$")' \
's.match(""); s.match("Hello World"); s.match("1234")'...

26a72a48 03/30/2012 03:02 pm Michael Hanselmann

Merge cli.FormatTimestamp and utils.FormatTime

… to some degree at least. Unittests are included.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

81f7ea25 03/09/2012 04:46 pm Iustin Pop

Fix lint error in commit 035b33e2

Commit 035b33e2 forgot one blank space, and current pylint in Debian
Sid doesn't run on our code… so I didn't realise this until after
commit, sorry.

Signed-off-by: Guido Trotter <>
Reviewed-by: Guido Trotter <>

035b33e2 03/07/2012 10:59 pm Iustin Pop

Fix tempfile reset code & test on newer Python

Python 2.7.3 (rc status) and 3.2.3/3.3 (rc, respectively alpha status)
have fixed http://bugs.python.org/issue12856 which we worked around
ourselves.

This means two things:

- we don't need to manually reset the module...

3ccb3a64 02/21/2012 05:23 pm Michael Hanselmann

Replace single- with double-quotes

In at least two cases "%s" is replaced with str(), too.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

5401c39d 02/17/2012 05:39 pm Michael Hanselmann

utils.text: Add function to truncate string

The function adds an ellipse if the string was actually truncated. Also
start using it in mcpu for result checks (where the message is also
slightly changed to use a colon).

Signed-off-by: Michael Hanselmann <>...

59d81cb3 01/19/2012 03:14 pm Michael Hanselmann

Merge branch 'devel-2.5'

  • devel-2.5:
    Fix wrong option names in QA and cluster-merge
    Bump version to 2.5.0~rc5, update NEWS
    Add UnescapeAndSplit unittest for multi-escapes
    Fix a bug in command line option parsing code
    cli: Disable abbreviation matching for options...
ecabe27e 01/19/2012 02:42 pm Nikos Skalkotos

Fix a bug in command line option parsing code

Fix bug affecting command line options of "keyval" type. Although
escaping commands with \ is supported, it is is not applied to the
input recursively.

Signed-off-by: Nikos Skalkotos <>
Signed-off-by: Iustin Pop <>...

View revisions

Also available in: Atom