Skip to content

Commit

Permalink
update the testVmwareConnection func to return unauthorized both for …
Browse files Browse the repository at this point in the history
…the test and production environments

Signed-off-by: Aviel Segev <[email protected]>
  • Loading branch information
AvielSegev authored and machacekondra committed Jan 14, 2025
1 parent 315a1fb commit b6e9b41
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/agent/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ func testVmwareConnection(requestCtx context.Context, credentials *config.Creden
err = client.Login(ctx, u.User)
if err != nil {
err = liberr.Wrap(err)
if strings.Contains(err.Error(), "Login failure") {
// Cover both the different error messages returns from the production and test environments in case of incorrect credentials
if strings.Contains(err.Error(), "Login failure") ||
strings.Contains(err.Error(), "incorrect") && strings.Contains(err.Error(), "password") {
return http.StatusUnauthorized, err
}
return http.StatusBadRequest, err
Expand Down

0 comments on commit b6e9b41

Please sign in to comment.