diff --git a/certmaster/certmaster.py b/certmaster/certmaster.py
index 9548b8b..b671cb1 100644
--- a/certmaster/certmaster.py
+++ b/certmaster/certmaster.py
@@ -22,7 +22,11 @@ import traceback
 import os
 import os.path
 from OpenSSL import crypto
-import sha
+try:
+    import hashlib
+except ImportError:
+    # Until support for <= RHEL 5 is removed
+    import sha as hashlib
 import glob
 import socket
 import exceptions
@@ -123,10 +127,10 @@ class CertMaster(object):
         if os.path.exists(csrfile):
             oldfo = open(csrfile)
             oldcsrbuf = oldfo.read()
-            oldsha = sha.new()
+            oldsha = hashlib.new()
             oldsha.update(oldcsrbuf)
             olddig = oldsha.hexdigest()
-            newsha = sha.new()
+            newsha = hashlib.new()
             newsha.update(csrbuf)
             newdig = newsha.hexdigest()
             if not newdig == olddig:
diff --git a/scripts/certmaster-sync b/scripts/certmaster-sync
index bd27af5..a99ea30 100644
--- a/scripts/certmaster-sync
+++ b/scripts/certmaster-sync
@@ -7,7 +7,11 @@

 import os
 import sys
-import sha
+try:
+    import hashlib
+except ImportError:
+    # Until support for        <= RHEL 5 is removed
+    import sha as hashlib
 import xmlrpclib
 from glob import glob
 from time import sleep
@@ -72,7 +76,7 @@ def local_certs():
     return results

 def checksum(f):
-    thissum = sha.new()
+    thissum = hashlib.new()
     if os.path.exists(f):
         fo = open(f, 'r')
         data = fo.read()
_______________________________________________
Func-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/func-list

Reply via email to