Imported Upstream version 4.3.1
This commit is contained in:
@@ -17,10 +17,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
|
||||
import gssapi
|
||||
import sys
|
||||
|
||||
@@ -28,17 +24,16 @@ import six
|
||||
|
||||
from ipalib import api
|
||||
from ipalib import errors
|
||||
from ipaplatform.paths import paths
|
||||
from ipapython import admintool
|
||||
from ipapython.dn import DN
|
||||
from ipapython.ipautil import realm_to_suffix, posixify
|
||||
from ipapython.ipa_log_manager import log_mgr
|
||||
from ipaserver.plugins.ldap2 import ldap2
|
||||
from ipaserver.install import replication, installutils
|
||||
|
||||
if six.PY3:
|
||||
unicode = str
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
DEFAULT_TRUST_VIEW_NAME = u'Default Trust View'
|
||||
|
||||
|
||||
@@ -180,16 +175,16 @@ class WinsyncMigrate(admintool.AdminTool):
|
||||
}
|
||||
|
||||
try:
|
||||
api.Command['idoverrideuser_add'](
|
||||
result = api.Command['idoverrideuser_add'](
|
||||
DEFAULT_TRUST_VIEW_NAME,
|
||||
user_identifier,
|
||||
**kwargs
|
||||
)
|
||||
except Exception as e:
|
||||
logger.warning("Migration failed: %s (%s)",
|
||||
user_identifier, str(e))
|
||||
self.log.warning("Migration failed: %s (%s)"
|
||||
% (user_identifier, str(e)))
|
||||
else:
|
||||
logger.debug("Migrated: %s", user_identifier)
|
||||
self.log.debug("Migrated: %s" % user_identifier)
|
||||
|
||||
def find_winsync_users(self):
|
||||
"""
|
||||
@@ -198,13 +193,13 @@ class WinsyncMigrate(admintool.AdminTool):
|
||||
|
||||
user_filter = "(&(objectclass=ntuser)(ntUserDomainId=*))"
|
||||
user_base = DN(api.env.container_user, api.env.basedn)
|
||||
entries, _truncated = self.ldap.find_entries(
|
||||
entries, _ = self.ldap.find_entries(
|
||||
filter=user_filter,
|
||||
base_dn=user_base,
|
||||
paged_search=True)
|
||||
|
||||
for entry in entries:
|
||||
logger.debug("Discovered entry: %s", entry)
|
||||
self.log.debug("Discovered entry: %s" % entry)
|
||||
|
||||
return entries
|
||||
|
||||
@@ -267,9 +262,8 @@ class WinsyncMigrate(admintool.AdminTool):
|
||||
user_entry.dn)
|
||||
|
||||
try:
|
||||
objects, _truncated = self.ldap.find_entries(
|
||||
member_filter,
|
||||
base_dn=object_container_dn)
|
||||
objects, _ = self.ldap.find_entries(member_filter,
|
||||
base_dn=object_container_dn)
|
||||
except errors.EmptyResult:
|
||||
# If there's nothing to migrate, then let's get out of here
|
||||
return
|
||||
@@ -334,11 +328,10 @@ class WinsyncMigrate(admintool.AdminTool):
|
||||
)
|
||||
|
||||
def warn_passsync(self):
|
||||
logger.warning("Migration completed. Please note that if PassSync "
|
||||
"was configured on the given Active Directory server, "
|
||||
"it needs to be manually removed, otherwise it may try "
|
||||
"to reset password for accounts that are no longer "
|
||||
"existent.")
|
||||
self.log.warning("Migration completed. Please note that if PassSync "
|
||||
"was configured on the given Active Directory server, "
|
||||
"it needs to be manually removed, otherwise it may try "
|
||||
"to reset password for accounts that are no longer existent.")
|
||||
|
||||
@classmethod
|
||||
def main(cls, argv):
|
||||
@@ -350,11 +343,11 @@ class WinsyncMigrate(admintool.AdminTool):
|
||||
# Check if the IPA server is configured before attempting to migrate
|
||||
try:
|
||||
installutils.check_server_configuration()
|
||||
except admintool.ScriptError as e:
|
||||
except RuntimeError as e:
|
||||
sys.exit(e)
|
||||
|
||||
# Finalize API
|
||||
api.bootstrap(in_server=True, context='server', confdir=paths.ETC_IPA)
|
||||
api.bootstrap(in_server=True, context='server')
|
||||
api.finalize()
|
||||
|
||||
# Setup LDAP connection
|
||||
|
||||
Reference in New Issue
Block a user