mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-06 13:08:29 +00:00
4a001706e7
Currently, both the NativeUsersStore and NativeRolesStore can undergo multiple state transitions. This is done primarily to check if the security index is usable before it proceeds. However, such checks are only needed for the tests, because if the security index is unavailable when it is needed, the downstream actions invoked by the NativeUsersStore and NativeRolesStore will throw the appropriate exceptions notifying of that condition. In addition, both the NativeUsersStore and NativeRolesStore had much duplicate code that listened for cluster state changes and made the exact same state transitions. This commit removes the complicated state transitions in both classes and enables both classes to use the SecurityTemplateService to monitor all of the security index lifecycle changes they need to be aware of. This commit also moves the logic for determining if the security index needs template and/or mapping updates to the SecurityLifecycleService, and makes the NativeRealmMigrator solely responsible for applying the updates. Original commit: elastic/x-pack-elasticsearch@b31d144597