Skip to content

Commit 1c09db9

Browse files
jeremymanningclaude
andcommitted
Fix CloudProviderManager import and subprocess text handling
- Add CloudProviderManager import to cloud_providers __init__.py - Fix subprocess calls to use text=True for consistent string handling - Add HuggingFace Spaces to provider imports - Address test failures related to cloud provider auto-configuration Note: 3 cloud provider integration tests still failing due to decode error, but basic functionality is working. Will address in follow-up. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6e8490d commit 1c09db9

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

clustrix/cloud_providers.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def _check_aws_context() -> bool:
5757
result = subprocess.run(
5858
["aws", "sts", "get-caller-identity"],
5959
capture_output=True,
60+
text=True,
6061
timeout=10,
6162
)
6263
return result.returncode == 0
@@ -73,7 +74,7 @@ def _check_azure_context() -> bool:
7374
# Check if Azure CLI is logged in
7475
try:
7576
result = subprocess.run(
76-
["az", "account", "show"], capture_output=True, timeout=10
77+
["az", "account", "show"], capture_output=True, text=True, timeout=10
7778
)
7879
return result.returncode == 0
7980
except (subprocess.TimeoutExpired, FileNotFoundError):
@@ -91,9 +92,10 @@ def _check_gcp_context() -> bool:
9192
result = subprocess.run(
9293
["gcloud", "auth", "list", "--filter=status:ACTIVE"],
9394
capture_output=True,
95+
text=True,
9496
timeout=10,
9597
)
96-
return result.returncode == 0 and "ACTIVE" in result.stdout.decode()
98+
return result.returncode == 0 and "ACTIVE" in result.stdout
9799
except (subprocess.TimeoutExpired, FileNotFoundError):
98100
return False
99101

@@ -156,7 +158,7 @@ def _verify_cluster_access(self):
156158
"""Verify that kubectl can access the cluster."""
157159
try:
158160
result = subprocess.run(
159-
["kubectl", "cluster-info"], capture_output=True, timeout=30
161+
["kubectl", "cluster-info"], capture_output=True, text=True, timeout=30
160162
)
161163
if result.returncode != 0:
162164
raise CloudProviderError("Cannot access Kubernetes cluster")
@@ -225,7 +227,7 @@ def _verify_cluster_access(self):
225227
"""Verify that kubectl can access the cluster."""
226228
try:
227229
result = subprocess.run(
228-
["kubectl", "cluster-info"], capture_output=True, timeout=30
230+
["kubectl", "cluster-info"], capture_output=True, text=True, timeout=30
229231
)
230232
if result.returncode != 0:
231233
raise CloudProviderError("Cannot access Kubernetes cluster")
@@ -294,7 +296,7 @@ def _verify_cluster_access(self):
294296
"""Verify that kubectl can access the cluster."""
295297
try:
296298
result = subprocess.run(
297-
["kubectl", "cluster-info"], capture_output=True, timeout=30
299+
["kubectl", "cluster-info"], capture_output=True, text=True, timeout=30
298300
)
299301
if result.returncode != 0:
300302
raise CloudProviderError("Cannot access Kubernetes cluster")

clustrix/cloud_providers/__init__.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,15 @@
2929
except ImportError:
3030
pass
3131

32-
__all__ = ["PROVIDERS"]
32+
try:
33+
from . import huggingface_spaces # noqa: F401
34+
except ImportError:
35+
pass
36+
37+
# Import CloudProviderManager from the old cloud_providers module
38+
try:
39+
from ..cloud_providers import CloudProviderManager # noqa: F401
40+
except ImportError:
41+
pass
42+
43+
__all__ = ["PROVIDERS", "CloudProviderManager"]

0 commit comments

Comments
 (0)