Skip to content

Commit 25283f1

Browse files
committed
feat(sdk/python): surface cloud_vendor and cloud_product on InfoResponse
Expose the two AppInfo proto fields (15, 16) added on dstack OS >= 0.5.7 so Python callers can identify the cloud provider that hosts the CVM. Both default to empty string for backward compatibility with older guest agents that omit them. Mirrors the JS SDK change in f5ad5be.
1 parent 187868b commit 25283f1

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

sdk/python/src/dstack_sdk/dstack_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ class InfoResponse(BaseModel, Generic[T]):
260260
key_provider_info: str
261261
compose_hash: str
262262
vm_config: str = ""
263+
# Cloud provider sys_vendor (e.g. "Google"). Available on dstack OS >= 0.5.7.
264+
cloud_vendor: str = ""
265+
# Cloud provider product_name (e.g. "Google Compute Engine"). Available on dstack OS >= 0.5.7.
266+
cloud_product: str = ""
263267

264268
@classmethod
265269
def parse_response(cls, obj: Any, tcb_info_type: type[T]) -> "InfoResponse[T]":

sdk/python/tests/test_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ def check_info_response(result: InfoResponse):
8383
assert len(result.tcb_info.device_id) == 64
8484
assert len(result.tcb_info.app_compose) > 0
8585
assert len(result.tcb_info.event_log) > 0
86+
# Cloud provider fields available on dstack OS >= 0.5.7. Older OS or the
87+
# simulator may omit them; the attribute must still exist and be a str.
88+
assert isinstance(result.cloud_vendor, str)
89+
assert isinstance(result.cloud_product, str)
8690

8791

8892
@pytest.mark.asyncio

0 commit comments

Comments
 (0)