Source:
private SyncStatusDetail internalSynchronizeStackForDeleteUser(Stack stack, String deletedWorkloadUser) { MDCBuilder.buildMdcContext(stack); String environmentCrn = stack.getEnvironmentCrn(); Multimap<String, String> warnings = ArrayListMultimap.create(); try { FreeIpaClient freeIpaClient = freeIpaClientFactory.getFreeIpaClientForStack(stack); LOGGER.debug("Starting for environment and deleted user ...", LogEvent.USER_SYNC_DELETE, environmentCrn, deletedWorkloadUser); LogEvent logEvent = LogEvent.RETRIEVE_PARTIAL_IPA_STATE; LOGGER.debug("Starting ...", LogEvent.RETRIEVE_PARTIAL_IPA_STATE); UsersState ipaUserState = getIpaStateForUser(freeIpaClient, deletedWorkloadUser); LOGGER.debug("Finished {}, found users and groups.", logEvent, ipaUserState.getUsers().size(), ipaUserState.getGroups().size()); if (!ipaUserState.getUsers().isEmpty()) { ImmutableCollection<String> groupsToRemove = ipaUserState.getGroupMembership().get(deletedWorkloadUser); UsersStateDifference usersStateDifference = UsersStateDifference.forDeletedUser(deletedWorkloadUser, groupsToRemove); LOGGER.debug("Starting ...", LogEvent.APPLY_DIFFERENCE_TO_IPA); applyStateDifferenceToIpa(stack.getEnvironmentCrn(), freeIpaClient, usersStateDifference, warnings::put); LOGGER.debug("Finished {}.", LogEvent.APPLY_DIFFERENCE_TO_IPA); } LOGGER.debug("Finished for environment and deleted user ...", LogEvent.USER_SYNC_DELETE, environmentCrn, deletedWorkloadUser); if (warnings.isEmpty()) { return SyncStatusDetail.succeed(environmentCrn); } else { return SyncStatusDetail.fail(environmentCrn, "Synchronization completed with warnings.", warnings); } } catch (Exception e) { LOGGER.warn("Failed to synchronize environment {}", environmentCrn, e); return SyncStatusDetail.fail(environmentCrn, e.getLocalizedMessage(), warnings); } }

Target:
private SyncStatusDetail internalSynchronizeStackForDeleteUser(Stack stack, String deletedWorkloadUser) { MDCBuilder.buildMdcContext(stack); String environmentCrn = stack.getEnvironmentCrn(); Multimap<String, String> warnings = ArrayListMultimap.create(); try { FreeIpaClient freeIpaClient = freeIpaClientFactory.getFreeIpaClientForStack(stack); LOGGER.debug("Starting for environment and deleted user ...", LogEvent.USER_SYNC_DELETE, environmentCrn, deletedWorkloadUser); LOGGER.debug("Starting ...", LogEvent.RETRIEVE_PARTIAL_IPA_STATE); UsersState ipaUserState = getIpaStateForUser(freeIpaClient, deletedWorkloadUser); LOGGER.debug("Finished {}, found users and groups.", LogEvent.RETRIEVE_PARTIAL_IPA_STATE, ipaUserState.getUsers().size(), ipaUserState.getGroups().size()); if (!ipaUserState.getUsers().isEmpty()) { ImmutableCollection<String> groupsToRemove = ipaUserState.getGroupMembership().get(deletedWorkloadUser); UsersStateDifference usersStateDifference = UsersStateDifference.forDeletedUser(deletedWorkloadUser, groupsToRemove); LOGGER.debug("Starting ...", LogEvent.APPLY_DIFFERENCE_TO_IPA); applyStateDifferenceToIpa(stack.getEnvironmentCrn(), freeIpaClient, usersStateDifference, warnings::put); LOGGER.debug("Finished {}.", LogEvent.APPLY_DIFFERENCE_TO_IPA); } LOGGER.debug("Finished for environment and deleted user ...", LogEvent.USER_SYNC_DELETE, environmentCrn, deletedWorkloadUser); return toSyncStatusDetail(environmentCrn, warnings); } catch (Exception e) { LOGGER.warn("Failed to synchronize environment {}", environmentCrn, e); return SyncStatusDetail.fail(environmentCrn, e.getLocalizedMessage(), warnings); } }