diff --git a/backend/app/services/task.py b/backend/app/services/task.py index 6a5884a..c7847f9 100644 --- a/backend/app/services/task.py +++ b/backend/app/services/task.py @@ -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":