Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET SM policies return empty list when ism config index does not exist #1072

Merged
merged 5 commits into from
Jan 24, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,15 @@ class TransportGetSMPoliciesAction @Inject constructor(

private suspend fun getAllPolicies(searchParams: SearchParams, user: User?): Pair<List<SMPolicy>, Long> {
val searchRequest = getAllPoliciesRequest(searchParams, user)
val searchResponse: SearchResponse = try {
client.suspendUntil { search(searchRequest, it) }
return try {
val searchResponse = client.suspendUntil { search(searchRequest, it) }
parseGetAllPoliciesResponse(searchResponse)
} catch (e: IndexNotFoundException) {
aggarwalShivani marked this conversation as resolved.
Show resolved Hide resolved
throw OpenSearchStatusException("Snapshot management config index not found", RestStatus.NOT_FOUND)
// config index hasn't been initialized, catch this here and show empty result for policies
Pair(emptyList(), 0L)
} catch (e: Exception) {
throw e
}
return parseGetAllPoliciesResponse(searchResponse)
}

private fun getAllPoliciesRequest(searchParams: SearchParams, user: User?): SearchRequest {
Expand Down
Loading