summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/migration.py
diff options
context:
space:
mode:
authorMartin Babinsky <mbabinsk@redhat.com>2015-02-13 17:53:27 +0100
committerMartin Kosek <mkosek@redhat.com>2015-02-16 16:33:46 +0100
commit06376a48b24949a1144d037af9fbed89d0455d79 (patch)
tree4549c4f0add69b61b33e7136d2a43fafeb702aad /ipalib/plugins/migration.py
parent373a04870d6ecc99145a6267c008702ed3e24171 (diff)
downloadfreeipa-06376a48b24949a1144d037af9fbed89d0455d79.tar.gz
freeipa-06376a48b24949a1144d037af9fbed89d0455d79.tar.xz
freeipa-06376a48b24949a1144d037af9fbed89d0455d79.zip
migrate-ds: exit with error message if no users/groups to migrate are found
'ipa migrate-ds' will now exit with error message if no suitable users/groups are found on LDAP server during migration. https://fedorahosted.org/freeipa/ticket/4846 Reviewed-By: David Kupka <dkupka@redhat.com>
Diffstat (limited to 'ipalib/plugins/migration.py')
-rw-r--r--ipalib/plugins/migration.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/ipalib/plugins/migration.py b/ipalib/plugins/migration.py
index cd1fa73f8..d9406907b 100644
--- a/ipalib/plugins/migration.py
+++ b/ipalib/plugins/migration.py
@@ -841,6 +841,12 @@ can use their Kerberos accounts.''')
api.log.info("%d %ss migrated. %s elapsed." % (migrate_cnt, ldap_obj_name, total_dur))
api.log.debug("%d %ss migrated, duration: %s (total %s)" % (migrate_cnt, ldap_obj_name, d, total_dur))
+ # if no users/groups were found (all lists in 'migrated' are empty),
+ # we raise an error that there is nothing to migrate
+ if not any(migrated.values()):
+ raise errors.NotFound(
+ reason=_("Found no users/groups to migrate "
+ "from '%(ds_ldap)s'.") % dict(ds_ldap=ds_ldap))
_update_default_group(ldap, pkey, config, context, True)
return (migrated, failed)