mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 22:06:05 +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'
|
command = f'rm -f /home/{self.data["domain"]}/public_html/.htaccess'
|
||||||
ProcessUtilities.executioner(command)
|
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
|
from plogical.installUtilities import installUtilities
|
||||||
installUtilities.reStartLiteSpeed()
|
installUtilities.reStartLiteSpeed()
|
||||||
|
|
||||||
@@ -542,7 +566,7 @@ services:
|
|||||||
client = docker.from_env()
|
client = docker.from_env()
|
||||||
|
|
||||||
# Define the label to filter containers
|
# 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
|
# List containers matching the label filter
|
||||||
containers = client.containers.list(filters=label_filter)
|
containers = client.containers.list(filters=label_filter)
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ class DockerSites(models.Model):
|
|||||||
port = models.CharField(max_length=100)
|
port = models.CharField(max_length=100)
|
||||||
CPUsSite = models.CharField(max_length=100)
|
CPUsSite = models.CharField(max_length=100)
|
||||||
MemorySite = models.CharField(max_length=100)
|
MemorySite = models.CharField(max_length=100)
|
||||||
SiteName = models.TextField()
|
SiteName = models.TextField(unique=True)
|
||||||
finalURL = models.TextField()
|
finalURL = models.TextField()
|
||||||
blogTitle = models.TextField()
|
blogTitle = models.TextField()
|
||||||
adminUser = models.CharField(max_length=100)
|
adminUser = models.CharField(max_length=100)
|
||||||
|
|||||||
@@ -6906,6 +6906,7 @@ StrictHostKeyChecking no
|
|||||||
passdata={}
|
passdata={}
|
||||||
passdata["domain"] = DockerSitesDelete.admin.domain
|
passdata["domain"] = DockerSitesDelete.admin.domain
|
||||||
passdata["JobID"] = None
|
passdata["JobID"] = None
|
||||||
|
passdata['name'] = DockerSitesDelete.SiteName
|
||||||
da = Docker_Sites(None, passdata)
|
da = Docker_Sites(None, passdata)
|
||||||
da.DeleteDockerApp()
|
da.DeleteDockerApp()
|
||||||
DockerSitesDelete.delete()
|
DockerSitesDelete.delete()
|
||||||
|
|||||||
Reference in New Issue
Block a user