Skip to content

Commit

Permalink
update filter
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Jan 5, 2024
1 parent 3029e2e commit b9f9438
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions plogical/DockerSites.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit b9f9438

Please sign in to comment.