12018: Avoid making duplicate api calls to add an already added user when
authorLucas Di Pentima <ldipentima@veritasgenetics.com>
Wed, 27 Sep 2017 03:44:47 +0000 (00:44 -0300)
committerLucas Di Pentima <ldipentima@veritasgenetics.com>
Wed, 27 Sep 2017 03:44:47 +0000 (00:44 -0300)
the input file has the same line more than once.

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>

sdk/python/arvados/commands/sync_groups.py

index 2bc08e23d515d9d4b9946bd2ca844284544e9189..a1125de1b628b8eb3943667a12c48252332a655e 100644 (file)
@@ -150,7 +150,8 @@ def main(arguments=None, stdout=sys.stdout, stderr=sys.stderr):
                     groups_created += 1
                 # Both group & user exist, check if user is a member
                 g_uuid = group_name_to_uuid[group]
-                if not user in remote_groups[g_uuid]['previous_members']:
+                if not (user in remote_groups[g_uuid]['previous_members'] or
+                        user in remote_groups[g_uuid]['current_members']):
                     # User wasn't a member, but should.
                     api_client.links().create(body={
                         'link_class': 'permission',