Add error handling for unconfigured Wazuh Indexer connector
Taylor committed
Jan 30, 2024 at 14:41 UTC
eb93826f257773e0106a4e334df613de93592c9e
1 file changed
+3
-1
backend/app/connectors/wazuh_indexer/utils/universal.py
+3
-1
@@ -23,7 +23,9 @@ async def verify_wazuh_indexer_credentials(attributes: Dict[str, Any]) -> Dict[s
23
dict: A dictionary containing 'connectionSuccessful' status and 'authToken' if the connection is successful.
24
"""
25
logger.info(f"Verifying the wazuh-indexer connection to {attributes['connector_url']}")
26
-
26
+ if attributes["connector_url"] == "https://example.com:9200":
27
+ logger.error("Wazuh Indexer connector not configured")
28
+ raise HTTPException(status_code=500, detail="Wazuh Indexer connector not configured")
29
try:
30
es = Elasticsearch(
31
[attributes["connector_url"]],