mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix deprecation warning for the sha library on Python 2.6
sha has been replaced by hashlib. We need to support Python 2.4 - 2.6 so this will use hashlib if available but fall back onto sha if not. Fortunately they use the same API for the function we need. 509042 Signed-off-by: Jason Gerard DeRose <jderose@redhat.com>
This commit is contained in:
committed by
Jason Gerard DeRose
parent
b382755fee
commit
5767c6b37d
@@ -18,7 +18,6 @@
|
||||
#
|
||||
|
||||
import os, stat, subprocess, re
|
||||
import sha
|
||||
import errno
|
||||
import tempfile
|
||||
import shutil
|
||||
@@ -34,6 +33,13 @@ from ipapython import ipautil
|
||||
from nss.error import NSPRError
|
||||
import nss.nss as nss
|
||||
|
||||
# The sha module is deprecated in Python 2.6, replaced by hashlib. Try
|
||||
# that first and fall back to sha.sha if it isn't available.
|
||||
try:
|
||||
from hashlib import sha256 as sha
|
||||
except ImportError:
|
||||
from sha import sha
|
||||
|
||||
CA_SERIALNO="/var/lib/ipa/ca_serialno"
|
||||
|
||||
def ipa_self_signed():
|
||||
@@ -194,7 +200,7 @@ class CertDB(object):
|
||||
os.chmod(fname, perms)
|
||||
|
||||
def gen_password(self):
|
||||
return sha.sha(ipautil.ipa_generate_password()).hexdigest()
|
||||
return sha(ipautil.ipa_generate_password()).hexdigest()
|
||||
|
||||
def run_certutil(self, args, stdin=None):
|
||||
new_args = ["/usr/bin/certutil", "-d", self.secdir]
|
||||
|
||||
Reference in New Issue
Block a user