diff --git a/app/core/docker.py b/app/core/docker.py index 43e6564..e2fa2a7 100644 --- a/app/core/docker.py +++ b/app/core/docker.py @@ -353,18 +353,26 @@ def list_containers_with_remote(projects: Optional[List[str]] = None, include_st # Объединяем локальные и удаленные контейнеры all_containers = local_containers + remote_containers + # Фильтруем demo и test контейнеры + filtered_containers = [] + for container in all_containers: + container_name = container.get("name", "").lower() + # Исключаем контейнеры с demo или test в названии + if "demo" not in container_name and "test" not in container_name: + filtered_containers.append(container) + # Фильтруем по проектам, если указаны if projects: - filtered_containers = [] - for container in all_containers: + project_filtered_containers = [] + for container in filtered_containers: if container["is_remote"]: # Для удаленных контейнеров проверяем соответствие хоста if any(f"remote-{container['hostname']}" in project for project in projects): - filtered_containers.append(container) + project_filtered_containers.append(container) else: # Для локальных контейнеров проверяем проект if container["project"] in projects or "standalone" in projects: - filtered_containers.append(container) - return filtered_containers + project_filtered_containers.append(container) + return project_filtered_containers - return all_containers + return filtered_containers diff --git a/test_fixes.py b/test_fixes.py index 472dcd3..6a671f8 100644 --- a/test_fixes.py +++ b/test_fixes.py @@ -39,9 +39,9 @@ def test_fixes(): containers = response.json() print(f"✅ Контейнеров получено: {len(containers)}") - # Анализируем контейнеры - local_containers = [c for c in containers if not c.get('is_remote', False)] - remote_containers = [c for c in containers if c.get('is_remote', False)] + # Анализируем контейнеры (исключаем demo и test контейнеры) + local_containers = [c for c in containers if not c.get('is_remote', False) and not any(x in c['name'].lower() for x in ['demo', 'test'])] + remote_containers = [c for c in containers if c.get('is_remote', False) and not any(x in c['name'].lower() for x in ['demo', 'test'])] print(f"\n📊 Статистика контейнеров:") print(f" 📍 Локальные контейнеры: {len(local_containers)}")