ssh фикс 3

This commit is contained in:
dv 2026-04-09 14:26:39 +03:00
parent b6eb46078d
commit ee83f74fb9

View file

@ -44,7 +44,10 @@ async def _emit(task_id: str, message: str, level: str = "info") -> None:
async def _resolve_scope(scope: dict) -> list[tuple[Device, Object]]:
"""Expand target_scope to a list of (device, parent_object) pairs."""
async with AsyncSessionLocal() as db:
query = select(Device).options(selectinload(Device.object)).where(Device.is_active == True)
query = select(Device).options(
selectinload(Device.object).selectinload(Object.ssh_credentials),
selectinload(Device.object).selectinload(Object.category_credentials),
).where(Device.is_active == True)
scope_type = scope.get("type")
if scope_type == "device":