From 85ea7c6544da3aa8c733bbee1ade52edb8cb052f Mon Sep 17 00:00:00 2001
From: Peter Hormanns <peter.hormanns@jalin.de>
Date: Wed, 23 Oct 2019 12:38:02 +0200
Subject: [PATCH] do not remove pacdomain

---
 hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java b/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java
index 8c40816..e2aebe3 100644
--- a/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java
+++ b/hsarback/src/de/hsadmin/mods/dom/DomainProcessorFactory.java
@@ -73,17 +73,19 @@
 		final Domain dom = (Domain) entity;
 		final String domName = dom.getName();
 		final WaitingTasksProcessor mainProcessor = new WaitingTasksProcessor(						 
-				createHiveDNSRemoveProcessor(domName)
+				createACMEBotProcessor(em, dom)
 			);
 		final Config config = Config.getInstance();
-		for (String queueName : config.getProperty("queues.dns").split(",")) {
-			mainProcessor.appendProcessor(queueName, createDNSServerConfigProcessor(em), queueName + ".hostsharing.net");
-		}
 		for (String queueName : config.getProperty("queues.mail").split(",")) {
 			mainProcessor.appendProcessor(queueName, createMailinUnsetupProcessor(em, dom), queueName + ".hostsharing.net");
 		}
 		mainProcessor.appendProcessor(dom.getHiveName(), createApacheVHostDeleteProcessor(dom), "remove apache vhost");
-		mainProcessor.appendProcessor(dom.getHiveName(), createACMEBotProcessor(em, dom), "remove letsencrypt config");
+		if (!dom.isPacDomain()) {
+			for (String queueName : config.getProperty("queues.dns").split(",")) {
+				mainProcessor.appendProcessor(queueName, createDNSServerConfigProcessor(em), queueName + ".hostsharing.net");
+			}
+			mainProcessor.appendProcessor(dom.getHiveName(), createHiveDNSRemoveProcessor(domName), "remove from hive dns");
+		}
 		return mainProcessor;
 	}
 
@@ -351,7 +353,21 @@
 		final String domName = dom.getName();
 		final int level = domName.split("\\.").length;
 		final String linkPrefix = Integer.toString(100 - level);
-		final Processor vhostDelProcessor = 
+		if (dom.isPacDomain()) {
+			return 
+				new ShellProcessor("rm -f /home/doms/" + domName +
+						" && rm -f /etc/apache2/sites-enabled/" + linkPrefix + "-" + domName +
+						" && rm -f /etc/apache2/sites-available/" + domName +
+						" && rm -f /etc/apache2/pems-enabled/" + domName + ".crt" +
+						" && rm -f /etc/apache2/pems-enabled/" + domName + ".key" +
+						" && rm -f /etc/apache2/pems-enabled/" + domName + ".chain" +
+						" && rm -f /etc/apache2/pems-generated/" + domName + ".crt" +
+						" && rm -f /etc/apache2/pems-generated/" + domName + ".key" +
+						" && rm -f /etc/apache2/pems-generated/" + domName + ".chain" +
+						" && chown -R " + dom.getUser() + ":" + dom.getUser() + " " + dom.getUser().getHomedir() + "/doms/" + domName +
+						" && invoke-rc.d apache2 reload >/dev/null 2>&1");
+		}
+		return
 			new ShellProcessor("rm -f /home/doms/" + domName +
 				" && rm -f /etc/apache2/sites-enabled/" + linkPrefix + "-" + domName +
 				" && rm -f /etc/apache2/sites-available/" + domName +
@@ -363,7 +379,6 @@
 				" && rm -f /etc/apache2/pems-generated/" + domName + ".chain" +
 				" && rm -rf " + dom.getUser().getHomedir() + "/doms/" + domName +
 				" && invoke-rc.d apache2 reload >/dev/null 2>&1");
-		return vhostDelProcessor;
 	}
 
 	private Processor createTriggerAcmebotProcessor(final EntityManager em, final Domain dom) {

--
Gitblit v1.9.0-SNAPSHOT