Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/toil/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ def needs_kubernetes_installed(test_item: MT) -> MT:
def _is_kubernetes_installed_and_configured() -> bool:
try:
import kubernetes
import oauthlib.oauth2.rfc6749.errors # type: ignore[import-untyped]

try:
kubernetes.config.load_kube_config() # type: ignore[attr-defined]
Expand All @@ -537,7 +538,13 @@ def _is_kubernetes_installed_and_configured() -> bool:
kubernetes.config.load_incluster_config() # type: ignore[attr-defined]
except kubernetes.config.ConfigException: # type: ignore[attr-defined]
return False
except ImportError:
except oauthlib.oauth2.rfc6749.errors.CustomOAuth2Error:
logger.warning("Kubernetes credentials are not accepted by the cluster.")
return False
except Exception:
logger.exception("Unexpected error while checking for Kubernetes configuration.")
return False
except ImportError: # to catch any exception
Comment thread
avnig05 marked this conversation as resolved.
Outdated
return False
return True

Expand Down