[Opensearch] : Fix the service validation in http_auth (#8609)

### Description
OpenSearch supports validation using both Master Credentials (Username
and password) and IAM. For Master Credentials users will not pass the
argument `service` in `http_auth` and the existing code will break. To
fix this, I have updated the condition to check if service attribute is
present in http_auth before accessing it.

### Maintainers
@baskaryan @navneet1v

Signed-off-by: Naveen Tatikonda <navtat@amazon.com>
This commit is contained in:
Naveen Tatikonda 2023-08-02 03:16:38 -05:00 committed by GitHub
parent 7c5c0557cb
commit d2adec3818
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,7 +85,7 @@ def _is_aoss_enabled(http_auth: Any) -> bool:
"""Check if the service is http_auth is set as `aoss`.""" """Check if the service is http_auth is set as `aoss`."""
if ( if (
http_auth is not None http_auth is not None
and http_auth.service is not None and hasattr(http_auth, "service")
and http_auth.service == "aoss" and http_auth.service == "aoss"
): ):
return True return True