Skip to content

Commit

Permalink
Fix args order in strings.Contains in es-rollover (#3324)
Browse files Browse the repository at this point in the history
If we do `strings.Contains("resource_already_exists_exception", errorMap["type"].(string))`,
we're basically doing `"resource_already_exists_exception" == errorMap["type"].(string)`.
I would assume that we intended to test whether `errorMap["type"]` contains
`"resource_already_exists_exception"` as a substring, so the reverse `strings.Contains` order
is more applicable here.

Signed-off-by: Pavol Loffay <[email protected]>

Co-authored-by: Iskander (Alex) Sharipov <[email protected]>
Co-authored-by: Albert <[email protected]>
  • Loading branch information
3 people authored Oct 15, 2021
1 parent 51ce980 commit 15abdb4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/es-rollover/app/init/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func createIndexIfNotExist(c client.IndexAPI, index string) error {
}
errorMap := jsonError["error"].(map[string]interface{})
// check for reason, ignore already exist error
if strings.Contains("resource_already_exists_exception", errorMap["type"].(string)) {
if strings.Contains(errorMap["type"].(string), "resource_already_exists_exception") {
return nil
}
}
Expand Down

0 comments on commit 15abdb4

Please sign in to comment.