Revision 7ffe8fba

b/lib/utils.py
29 29

  
30 30
import sys
31 31
import os
32
import sha
33 32
import time
34 33
import subprocess
35 34
import re
......
47 46

  
48 47
from cStringIO import StringIO
49 48

  
49
try:
50
  from hashlib import sha1
51
except ImportError:
52
  import sha
53
  sha1 = sha.new
54

  
50 55
from ganeti import errors
51 56
from ganeti import constants
52 57

  
......
337 342

  
338 343
  f = open(filename)
339 344

  
340
  fp = sha.sha()
345
  fp = sha1()
341 346
  while True:
342 347
    data = f.read(4096)
343 348
    if not data:
......
1186 1191
  @return: a sha1 hexdigest of a block of 64 random bytes
1187 1192

  
1188 1193
  """
1189
  return sha.new(os.urandom(64)).hexdigest()
1194
  return sha1(os.urandom(64)).hexdigest()
1190 1195

  
1191 1196

  
1192 1197
def EnsureDirs(dirs):

Also available in: Unified diff