Move hash functions to the compat module
authorGuido Trotter <ultrotter@google.com>
Fri, 28 May 2010 18:48:17 +0000 (19:48 +0100)
committerGuido Trotter <ultrotter@google.com>
Tue, 1 Jun 2010 08:34:46 +0000 (09:34 +0100)
commit716a32cbd9161f79dc63383d34a606d7c04450e7
tree1cbeb3b57d056c1d192db8f86d36964a2e4573cb
parente3cc4c69bb06ce7e6cff364f6273f0a0db333af2
Move hash functions to the compat module

Since the hash functions' changed their module name between python 2.4
and 2.6, and we have to do an try/import/except trick, we'll do it just
once, for both hash functions, and in compat.py. This also fixes a use
of md5 in the utils unittests which didn't use the trick before, and
generated a deprecation warning under 2.6.

In compat we keep both a ganeti-wide non-version-specific version to be
used by other ganeti modules, and a python-version specific that can be
passed to python modules which expect a hash function for their input
but call it differently under different versions of python (hmac, for
example).

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
lib/compat.py
lib/http/auth.py
lib/utils.py
test/ganeti.utils_unittest.py