mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Move lib389 imports to module scope
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
parent
383311a17f
commit
ed955d14d3
@ -48,9 +48,11 @@
|
||||
%global selinux_policy_version 3.14.1-14
|
||||
%global slapi_nis_version 0.56.1-4
|
||||
%global python_ldap_version 3.1.0-1
|
||||
# python3-lib389
|
||||
# Fix for "Installation fails: Replica Busy"
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1598478
|
||||
%global ds_version 1.3.8.4-15
|
||||
# https://pagure.io/389-ds-base/issue/49818
|
||||
%global ds_version 1.4.0.16-1
|
||||
|
||||
%else
|
||||
# Fedora
|
||||
%global package_name freeipa
|
||||
@ -67,9 +69,7 @@
|
||||
|
||||
# fix for segfault in python3-ldap, https://pagure.io/freeipa/issue/7324
|
||||
%global python_ldap_version 3.1.0-1
|
||||
|
||||
# Fix for "Crash when failing to read from SASL connection"
|
||||
# https://pagure.io/389-ds-base/issue/49639
|
||||
# python3-lib389
|
||||
# Fix for "Installation fails: Replica Busy"
|
||||
# https://pagure.io/389-ds-base/issue/49818
|
||||
%global ds_version 1.4.0.16-1
|
||||
|
@ -386,8 +386,6 @@ class BasePathNamespace:
|
||||
DB2LDIF = '/usr/sbin/db2ldif'
|
||||
BAK2DB = '/usr/sbin/bak2db'
|
||||
DB2BAK = '/usr/sbin/db2bak'
|
||||
SETUP_DS_PL = "/usr/sbin/setup-ds.pl"
|
||||
REMOVE_DS_PL = "/usr/sbin/remove-ds.pl"
|
||||
IPA_SERVER_UPGRADE = '/usr/sbin/ipa-server-upgrade'
|
||||
KEYCTL = '/usr/bin/keyctl'
|
||||
GETENT = '/usr/bin/getent'
|
||||
|
@ -31,6 +31,12 @@ import fnmatch
|
||||
|
||||
import ldap
|
||||
|
||||
from lib389 import DirSrv
|
||||
from lib389.idm.ipadomain import IpaDomain
|
||||
from lib389.instance.options import General2Base, Slapd2Base
|
||||
from lib389.instance.remove import remove_ds_instance as lib389_remove_ds
|
||||
from lib389.instance.setup import SetupDs
|
||||
|
||||
from ipalib import x509
|
||||
from ipalib.install import certmonger, certstore
|
||||
from ipapython.certdb import (IPA_CA_TRUST_FLAGS,
|
||||
@ -103,16 +109,13 @@ def remove_ds_instance(serverid):
|
||||
you even need multiple times ....)
|
||||
"""
|
||||
|
||||
from lib389.instance.remove import remove_ds_instance
|
||||
from lib389 import DirSrv
|
||||
|
||||
logger.debug("Attempting to remove instance %s", serverid)
|
||||
# Alloc the local instance by name (no creds needed!)
|
||||
ds = DirSrv(verbose=True, external_log=logger)
|
||||
ds.local_simple_allocate(serverid)
|
||||
|
||||
# Remove it
|
||||
remove_ds_instance(ds)
|
||||
lib389_remove_ds(ds)
|
||||
logger.debug("Instance removed correctly.")
|
||||
|
||||
|
||||
@ -548,13 +551,6 @@ class DsInstance(service.Service):
|
||||
)
|
||||
|
||||
def __create_instance(self):
|
||||
# We only import lib389 now, we can't always guarantee its presence
|
||||
# yet. After f28, this can be made a dependency proper.
|
||||
from lib389.instance.setup import SetupDs
|
||||
from lib389.instance.options import General2Base, Slapd2Base
|
||||
from lib389.idm.ipadomain import IpaDomain
|
||||
from lib389 import DirSrv
|
||||
|
||||
# The new installer is api driven. We can pass it a log function
|
||||
# and it will use it. Because of this, we can pass verbose true,
|
||||
# and allow our logger to control the display based on level.
|
||||
@ -581,7 +577,7 @@ class DsInstance(service.Service):
|
||||
'nsslapd-suffix': self.suffix.ldap_text()
|
||||
}
|
||||
|
||||
backends = [userroot, ]
|
||||
backends = [userroot]
|
||||
|
||||
sds.create_from_args(general, slapd, backends, None)
|
||||
|
||||
@ -595,11 +591,15 @@ class DsInstance(service.Service):
|
||||
# This actually opens the conn and binds.
|
||||
inst.open()
|
||||
|
||||
ipadomain = IpaDomain(inst, dn=self.suffix.ldap_text())
|
||||
ipadomain.create(properties={
|
||||
'dc': self.realm.split('.')[0].lower(),
|
||||
'info': 'IPA V2.0',
|
||||
})
|
||||
try:
|
||||
ipadomain = IpaDomain(inst, dn=self.suffix.ldap_text())
|
||||
ipadomain.create(properties={
|
||||
'dc': self.realm.split('.')[0].lower(),
|
||||
'info': 'IPA V2.0',
|
||||
})
|
||||
finally:
|
||||
inst.close()
|
||||
|
||||
# Done!
|
||||
logger.debug("completed creating DS instance")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user