From 18b2c6d70d39b8b01a8d2e0a446243dc516fba06 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Mon, 14 Apr 2025 22:38:06 +0500 Subject: [PATCH] bug fix: call function to install docker --- plogical/DockerSites.py | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/plogical/DockerSites.py b/plogical/DockerSites.py index 00795a9b4..5a2c7ca4f 100644 --- a/plogical/DockerSites.py +++ b/plogical/DockerSites.py @@ -708,11 +708,28 @@ services: # Create a Docker client client = docker.from_env() - FilerValue = self.DockerAppName + # Debug logging + if os.path.exists(ProcessUtilities.debugPath): + logging.writeToFile(f'DockerAppName: {self.DockerAppName}') - # List all containers and filter by name - all_containers = client.containers.list(all=True) # all=True to show both running and stopped containers - containers = [c for c in all_containers if FilerValue in c.name] + # List all containers without filtering first + all_containers = client.containers.list(all=True) + + if os.path.exists(ProcessUtilities.debugPath): + logging.writeToFile(f'Total containers found: {len(all_containers)}') + for container in all_containers: + logging.writeToFile(f'Container name: {container.name}') + + # Now filter containers + containers = [] + for container in all_containers: + if os.path.exists(ProcessUtilities.debugPath): + logging.writeToFile(f'Checking container: {container.name} against filter: {self.DockerAppName}') + if self.DockerAppName.lower() in container.name.lower(): + containers.append(container) + + if os.path.exists(ProcessUtilities.debugPath): + logging.writeToFile(f'Filtered containers count: {len(containers)}') json_data = "[" checker = 0 @@ -741,6 +758,9 @@ services: json_data = json_data + ']' + if os.path.exists(ProcessUtilities.debugPath): + logging.writeToFile(f'Final JSON data: {json_data}') + return 1, json_data except BaseException as msg: