From b9f9438ab3183f46db807cc7723c09dae60979e3 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 5 Jan 2024 12:42:03 +0500 Subject: [PATCH] update filter --- plogical/DockerSites.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plogical/DockerSites.py b/plogical/DockerSites.py index 8437c554f..7b0851d0b 100644 --- a/plogical/DockerSites.py +++ b/plogical/DockerSites.py @@ -30,6 +30,14 @@ def __init__(self, function_run, data): self.JobID = self.data['JobID'] ##JOBID will be file path where status is being written except: pass + try: + ### set docker name for listing/deleting etc + if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: + self.DockerAppName = f"{self.data['name'].replace(' ', '')}-{self.data['name'].replace(' ', '-')}" + else: + self.DockerAppName = f"{self.data['name'].replace(' ', '')}_{self.data['name'].replace(' ', '-')}" + except: + pass def run(self): try: @@ -488,7 +496,7 @@ def DeleteDockerApp(self): # Create a Docker client client = docker.from_env() - FilerValue = f"{self.data['name'].replace(' ', '')}_{self.data['name'].replace(' ', '-')}" + FilerValue = self.DockerAppName # Define the label to filter containers label_filter = {'name': FilerValue} @@ -522,7 +530,7 @@ def ListContainers(self): # Create a Docker client client = docker.from_env() - FilerValue = f"{self.data['name'].replace(' ', '')}_{self.data['name'].replace(' ', '-')}" + FilerValue = self.DockerAppName # Define the label to filter containers label_filter = {'name': FilerValue}