From 39c7b2d3c04aa13b53166ae43c5c7354af7999af Mon Sep 17 00:00:00 2001 From: usmannasir Date: Mon, 25 Dec 2023 11:26:41 +0500 Subject: [PATCH] bug fix: recreate app --- plogical/DockerSites.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plogical/DockerSites.py b/plogical/DockerSites.py index 3eb4aabe9..9c4c7229e 100644 --- a/plogical/DockerSites.py +++ b/plogical/DockerSites.py @@ -546,8 +546,10 @@ def DeleteDockerApp(self): # Create a Docker client client = docker.from_env() + FilerValue = f"{self.data['name'].replace(' ', '')}_{self.data['name'].replace(' ', '-')}" + # Define the label to filter containers - label_filter = {'name': self.data['name'].replace(' ', '-')} + label_filter = {'name': FilerValue} # List containers matching the label filter containers = client.containers.list(filters=label_filter) @@ -578,8 +580,11 @@ def ListContainers(self): # Create a Docker client client = docker.from_env() + FilerValue = f"{self.data['name'].replace(' ', '')}_{self.data['name'].replace(' ', '-')}" + # Define the label to filter containers - label_filter = {'name': self.data['name'].replace(' ', '-')} + label_filter = {'name': FilerValue} + # List containers matching the label filter containers = client.containers.list(filters=label_filter) @@ -660,6 +665,10 @@ def ContainerInfo(self): logging.writeToFile("List Container ....... %s" % str(msg)) return 0, str(msg) + def RebuildApp(self): + self.DeleteDockerApp() + self.SubmitDockersiteCreation() + def Main(): try: