sebastien/cuisine

Using hashlib breaks compatibility with CentoOS 5

Closed this issue · 2 comments

This is not a bug, but new versions of cuisine breaks compatiblity with CentOS 5 hosts, as it's using hashlib in the remote host to calculate hashes of files.

CentOS 5 has Python version 2.4.3, and it's a pain to upgrade, as many of the system tools require that exact version. hashlib was introduced in Python 2.5, hence the problem.

I guess previous versions relied on md5sum, sha1sum and base64, which are included in the distribution.

The versions checked were:

  • cuisine 0.7.11 (Pypi) Broken
  • cuisine 0.6.4 (Pypi) OK

¿Could be possible to define an alternate method in file checksum for CentOS hosts?

Hi Carlos,

You're welcome to provide a patch for that. You could do something like

try:
    import hashlib
    md5 = hashlib.md5
    sha1 = hashlib.sha1
except ImportError:
    md5 = XXX
    sha1 = XXX

Not a bug, it's a configuration problem. I should have set select_hash('openssl') on my cuisine setup. Anyway, I've added a function to check for hashlib support on remote host, raising an exception and advising to use select_hash('openssl').