|
6 | 6 | import threading |
7 | 7 | from typing import Any, Dict, List, Optional, Tuple |
8 | 8 | from uuid import uuid4 |
9 | | - |
10 | 9 | from cachetools import TTLCache |
11 | 10 | import requests |
12 | 11 | from postgrest._sync.request_builder import SyncQueryRequestBuilder |
|
18 | 17 | from supabase.lib.client_options import ClientOptions |
19 | 18 |
|
20 | 19 | from robusta.core.model.cluster_status import ClusterStatus |
| 20 | +from robusta.core.exceptions import SupabaseDnsException |
21 | 21 | from robusta.core.model.env_vars import SUPABASE_TIMEOUT_SECONDS |
22 | 22 | from robusta.core.model.helm_release import HelmRelease |
23 | 23 | from robusta.core.model.jobs import JobInfo |
@@ -555,10 +555,24 @@ def publish_helm_releases(self, helm_releases: List[HelmRelease]): |
555 | 555 |
|
556 | 556 | def sign_in(self) -> str: |
557 | 557 | logging.info("Supabase dal login") |
558 | | - res = self.client.auth.sign_in_with_password({"email": self.email, "password": self.password}) |
559 | | - self.client.auth.set_session(res.session.access_token, res.session.refresh_token) |
560 | | - self.client.postgrest.auth(res.session.access_token) |
561 | | - return res.user.id |
| 558 | + try: |
| 559 | + res = self.client.auth.sign_in_with_password({"email": self.email, "password": self.password}) |
| 560 | + self.client.auth.set_session(res.session.access_token, res.session.refresh_token) |
| 561 | + self.client.postgrest.auth(res.session.access_token) |
| 562 | + return res.user.id |
| 563 | + except Exception as e: |
| 564 | + # Check if this is a DNS-related error |
| 565 | + error_msg = str(e).lower() |
| 566 | + if any(dns_indicator in error_msg for dns_indicator in [ |
| 567 | + "temporary failure in name resolution", |
| 568 | + "name resolution", |
| 569 | + "dns", |
| 570 | + "name or service not known", |
| 571 | + "nodename nor servname provided" |
| 572 | + ]): |
| 573 | + dns_exc = SupabaseDnsException(e, self.url) |
| 574 | + raise dns_exc from e |
| 575 | + raise |
562 | 576 |
|
563 | 577 | def to_db_cluster_status(self, data: ClusterStatus) -> Dict[str, Any]: |
564 | 578 | db_cluster_status = data.dict() |
|
0 commit comments