Conditionally import nss

python-nss does not exist (and is not needed) in RHEL8.
We need to conditionally import nss to avoid errors in RHEL8.

Change-Id: I699fbfab4c2106f24260c99905b1bd40a8e683a8
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1758771
This commit is contained in:
Ade Lee 2019-11-26 15:35:55 -05:00 committed by Grzegorz Grasza
parent 4aa08a25b8
commit e418762753
1 changed files with 2 additions and 2 deletions

View File

@ -52,8 +52,6 @@ except ImportError:
if version.NUM_VERSION >= 40500: if version.NUM_VERSION >= 40500:
from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives import serialization
import nss.nss as nss
logger = logging.getLogger() logger = logging.getLogger()
allowed_chars = string.ascii_letters + string.digits allowed_chars = string.ascii_letters + string.digits
@ -171,6 +169,8 @@ class NovajoinRole(object):
NOTE: For IPA v4.4.0. NOTE: For IPA v4.4.0.
""" """
import nss.nss as nss
nss.nss_init_nodb() nss.nss_init_nodb()
nss_db = certdb.NSSDatabase() nss_db = certdb.NSSDatabase()