mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 05:45:59 +01:00
adjust some functions
This commit is contained in:
@@ -525,6 +525,30 @@ services:
|
||||
command = f'rm -f /home/{self.data["domain"]}/public_html/.htaccess'
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
|
||||
### forcefully delete containers
|
||||
|
||||
import docker
|
||||
|
||||
# Create a Docker client
|
||||
client = docker.from_env()
|
||||
|
||||
# Define the label to filter containers
|
||||
label_filter = {'name': self.data['name'].replace(' ', '-')}
|
||||
|
||||
# List containers matching the label filter
|
||||
containers = client.containers.list(filters=label_filter)
|
||||
|
||||
logging.writeToFile(f'List of containers {str(containers)}')
|
||||
|
||||
|
||||
for container in containers:
|
||||
command = f'docker stop {container.short_id}'
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
command = f'docker rm {container.short_id}'
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
from plogical.installUtilities import installUtilities
|
||||
installUtilities.reStartLiteSpeed()
|
||||
|
||||
@@ -542,7 +566,7 @@ services:
|
||||
client = docker.from_env()
|
||||
|
||||
# Define the label to filter containers
|
||||
label_filter = {'name': self.data['name']}
|
||||
label_filter = {'name': self.data['name'].replace(' ', '-')}
|
||||
|
||||
# List containers matching the label filter
|
||||
containers = client.containers.list(filters=label_filter)
|
||||
|
||||
@@ -181,7 +181,7 @@ class DockerSites(models.Model):
|
||||
port = models.CharField(max_length=100)
|
||||
CPUsSite = models.CharField(max_length=100)
|
||||
MemorySite = models.CharField(max_length=100)
|
||||
SiteName = models.TextField()
|
||||
SiteName = models.TextField(unique=True)
|
||||
finalURL = models.TextField()
|
||||
blogTitle = models.TextField()
|
||||
adminUser = models.CharField(max_length=100)
|
||||
|
||||
@@ -6906,6 +6906,7 @@ StrictHostKeyChecking no
|
||||
passdata={}
|
||||
passdata["domain"] = DockerSitesDelete.admin.domain
|
||||
passdata["JobID"] = None
|
||||
passdata['name'] = DockerSitesDelete.SiteName
|
||||
da = Docker_Sites(None, passdata)
|
||||
da.DeleteDockerApp()
|
||||
DockerSitesDelete.delete()
|
||||
|
||||
Reference in New Issue
Block a user