X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/bab30415501b92dbece93b636dda7f6914a123fa..fb429aa6a8dd1d28d08038abd8de8b9206a1d51e:/sdk/python/arvados/commands/federation_migrate.py diff --git a/sdk/python/arvados/commands/federation_migrate.py b/sdk/python/arvados/commands/federation_migrate.py index 0d39f4fc25..5c1bb29e76 100755 --- a/sdk/python/arvados/commands/federation_migrate.py +++ b/sdk/python/arvados/commands/federation_migrate.py @@ -22,6 +22,7 @@ import hmac import urllib.parse import os import hashlib +import re from arvados._version import __version__ EMAIL=0 @@ -294,7 +295,7 @@ def activate_remote_user(args, email, homearv, migratearv, old_user_uuid, new_us return None if olduser["is_admin"] and not newuser["is_admin"]: - print("(%s) Not migrating %s because user is admin but target user %s is not admin on %s. Please ensure the user admin status is the same on both clusters" % (email, old_user_uuid, new_user_uuid, migratecluster)) + print("(%s) Not migrating %s because user is admin but target user %s is not admin on %s. Please ensure the user admin status is the same on both clusters. Note that a federated admin account has admin privileges on the entire federation." % (email, old_user_uuid, new_user_uuid, migratecluster)) return None return newuser @@ -316,7 +317,12 @@ def migrate_user(args, migratearv, email, new_user_uuid, old_user_uuid): new_owner_uuid=new_owner_uuid, redirect_to_new_user=True).execute() except arvados.errors.ApiError as e: - print("(%s) Skipping user migration because of error: %s" % (email, e)) + name_collision = re.search(r'Key \(owner_uuid, name\)=\((.*?), (.*?)\) already exists\.\n.*UPDATE "(.*?)"', e._get_reason()) + if name_collision: + target_owner, rsc_name, rsc_type = name_collision.groups() + print("(%s) Cannot migrate to %s because both origin and target users have a %s named '%s'. Please rename the conflicting items or use --data-into-subproject to migrate all users' data into a special subproject." % (email, target_owner, rsc_type[:-1], rsc_name)) + else: + print("(%s) Skipping user migration because of error: %s" % (email, e)) def main():