Upgrade fail with Group already exists in the Remote Directory

XMLWordPrintable

    • 5
    • Severity 3 - Minor

      Issue Summary

      When upgrade from Bamboo 6.5.x or older to Bamboo 6.6.x or later, it fail with "Group already exists in the Remote Directory" when there is a LDAP user that is assigned with a local group membership and the same membership exist in LDAP server

      Steps to Reproduce

      1. Install Bamboo 6.5.x
      2. Create a user "test" in LDAP server
      3. Configure LDAP repository
      4. From Bamboo Administration, edit the LDAP user "test" to assign it to the local Bamboo group "bamboo-admin"
      5. Create a group "bamboo-admin" in LDAP server
      6. Assign LDAP user to the group "bamboo-admin" in LDAP server
        No error in Bamboo
      7. Upgrade Bamboo to version 6.6.x

      Expected Results

      Upgrade is successful

      Actual Results

      Upgrade fail with the below exception is thrown in the atlassian-bamboo.log file:

      2019-06-21 18:18:09,977 INFO [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [AbstractUpgradeManager] 60602 : Move users to Embedded Crowd (post-bootstrap)
      2019-06-21 18:18:09,977 INFO [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [AbstractUpgradeManager] -----------------------------------------------------
      2019-06-21 18:18:10,152 INFO [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [AtlassianUserDataMigrator] Copying 2 groups...
      2019-06-21 18:18:10,170 INFO [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [UpgradeTask60602MoveUsersToEmbeddedCrowd] Migration of groups took 118.7 ms
      2019-06-21 18:18:10,170 INFO [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [AtlassianUserDataMigrator] Copying 2 users...
      2019-06-21 18:18:10,193 INFO [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [UpgradeTask60602MoveUsersToEmbeddedCrowd] Migration of users took 23.45 ms
      2019-06-21 18:18:10,196 INFO [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [AtlassianUserDataMigrator] Upgrading external membership information using data from the database
      2019-06-21 18:18:10,197 INFO [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [AtlassianUserDataMigrator] Copying 1 local memberships of LDAP users...
      2019-06-21 18:18:10,445 WARN [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [AtlassianUserDataMigrator] User not found in local repository. It might be available at external repository, creating user placeholder to be filled by Crowd on LDAP synchronization. User name: [test], group name: [bamboo-admin]
      2019-06-21 18:18:10,569 ERROR [17-UpgradeTaskBackgroundThread:pool-31-thread-1] [AbstractUpgradeManager] com.atlassian.crowd.exception.runtime.OperationFailedException: com.atlassian.crowd.exception.InvalidGroupException: Group already exists in the Remote Directory
      com.atlassian.crowd.exception.runtime.OperationFailedException: com.atlassian.crowd.exception.InvalidGroupException: Group already exists in the Remote Directory
      	at com.atlassian.crowd.embedded.core.CrowdServiceImpl.addUserToGroup(CrowdServiceImpl.java:557)
      	at com.atlassian.bamboo.upgrade.tasks.v6_6.ec.AtlassianUserDataMigrator.migrateMembershipInLocalGroup(AtlassianUserDataMigrator.java:389)
      	at com.atlassian.bamboo.upgrade.tasks.v6_6.ec.AtlassianUserDataMigrator.access$400(AtlassianUserDataMigrator.java:71)
      	at com.atlassian.bamboo.upgrade.tasks.v6_6.ec.AtlassianUserDataMigrator$4.processRowInternal(AtlassianUserDataMigrator.java:359)
      	at com.atlassian.bamboo.upgrade.tasks.v6_6.ec.SessionClearingRowCallbackHandler.processRow(SessionClearingRowCallbackHandler.java:36)
      	at org.springframework.jdbc.core.JdbcTemplate$RowCallbackHandlerResultSetExtractor.extractData(JdbcTemplate.java:1566)
      

      Notes

      Even though there is duplicate membership setting, Bamboo should skip the migration for duplicate membership instead of failing the upgrade

      Workaround

      1. Check the membership data in database:
        SELECT em.EXTENTITYID, ee.NAME, em.GROUPID, g.GROUPNAME
        FROM EXTERNAL_MEMBERS em
        JOIN EXTERNAL_ENTITIES ee ON em.EXTENTITYID=ee.ID
        JOIN GROUPS g ON em.GROUPID=g.ID;
        
      2. Compare it with LDAP server
      3. If there is any duplicate membership with LDAP server, delete it in the table EXTERNAL_MEMBERS
        DELETE FROM EXTERNAL_MEMBERS 
        WHERE EXTENTITYID=<userID>
        AND GROUPID=<groupID>;
        

            Assignee:
            Marcin Gardias
            Reporter:
            Foong (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: