Replace crypt module
The crypt module was removed in Python 3.13 . Replace the module by new methods from oslo_utils.secretutils . Closes-Bug: #2083955 Change-Id: Ib574fc1b0f267e9b42f899f02a7ef84188ef9e85
This commit is contained in:
parent
9479347cf4
commit
95f514da06
@ -13,7 +13,6 @@
|
||||
# under the License.
|
||||
|
||||
import contextlib
|
||||
import crypt
|
||||
import datetime
|
||||
import functools
|
||||
import os
|
||||
@ -26,6 +25,7 @@ from oslo_log import log
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_service import loopingcall
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import secretutils
|
||||
from oslo_utils import strutils
|
||||
from oslo_utils import timeutils
|
||||
|
||||
@ -49,8 +49,8 @@ CONF = cfg.CONF
|
||||
|
||||
|
||||
PASSWORD_HASH_FORMAT = {
|
||||
'sha256': crypt.METHOD_SHA256,
|
||||
'sha512': crypt.METHOD_SHA512,
|
||||
'sha256': 'SHA-256',
|
||||
'sha512': 'SHA-512',
|
||||
}
|
||||
|
||||
|
||||
@ -1475,7 +1475,7 @@ def make_salt():
|
||||
|
||||
:returns: a valid salt for use with crypt.crypt
|
||||
"""
|
||||
return crypt.mksalt(
|
||||
return secretutils.crypt_mksalt(
|
||||
method=PASSWORD_HASH_FORMAT[
|
||||
CONF.conductor.rescue_password_hash_algorithm])
|
||||
|
||||
@ -1485,7 +1485,7 @@ def hash_password(password=''):
|
||||
|
||||
:param password: password to be hashed
|
||||
"""
|
||||
return crypt.crypt(password, make_salt())
|
||||
return secretutils.crypt_password(password, make_salt())
|
||||
|
||||
|
||||
def get_attached_vif(port):
|
||||
|
@ -23,7 +23,7 @@ oslo.policy>=4.5.0 # Apache-2.0
|
||||
oslo.serialization>=2.25.0 # Apache-2.0
|
||||
oslo.service>=1.24.0 # Apache-2.0
|
||||
oslo.upgradecheck>=1.3.0 # Apache-2.0
|
||||
oslo.utils>=7.3.0 # Apache-2.0
|
||||
oslo.utils>=8.0.0 # Apache-2.0
|
||||
osprofiler>=1.5.0 # Apache-2.0
|
||||
os-traits>=0.4.0 # Apache-2.0
|
||||
pecan>=1.0.0 # BSD
|
||||
|
Loading…
x
Reference in New Issue
Block a user